Hallo Community,
habe ein Problem bei folgendem Code (gekürzt):
Das Problem liegt in den letzten zwei Zeilen. Die Funktion Getnumber liefert einen Wert zurück und sollte diesen in der Variable A speichern... wenn ich mir jedoch durch LCD die variable anzeigen lasse, ist sie leer!Code:$regfile = "m16def.dat" $crystal = 16000000 $sim Declare Function Iskeywaiting() As Byte Declare Function Getkey() As Integer Declare Function Waitforkey() As Integer Declare Function Getnumber() As Integer Declare Function Keytochar(byval K As Integer) As Byte Declare Function Keytonumber(byval K As Integer) As Integer Declare Function Keytype(byval K As Integer) As Byte Declare Sub Waitforkeypress() Declare Sub Calculate(byref Zahl1 As Integer , Byval Zahl2 As Integer) 'Konstanten Const Deb_time = 20 'Debounce time Const Logo_time = 20 Const Debugtime = 50 'Variablen deklarieren Dim Op As Integer Dim Keyb_col As Byte Dim Keyb_row As Byte Dim Keyboard As Integer Dim Ctmp As Byte Dim A As Integer Dim B As Integer Keyboard = 0 Keyb_col = &B11111110 Portd = Keyb_col Pwm1a = 150 'LCD konfigurieren Config Lcd = 16 * 2 Config Lcdpin = Pin , Db4 = Porta.5 , Db5 = Porta.4 , Db6 = Porta.3 , Db7 = Porta.2 , E = Porta.0 , Rs = Porta.1 Config Lcdbus = 4 Cursor Off Noblink Cls 'PWM konfigurieren Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Prescale = 1 'Tastaturtimer initialisieren Config Timer0 = Timer , Prescale = 1024 Enable Timer0 On Timer0 Keyb_isr Enable Interrupts 'Portdirection festlegen Config Porta = Output Config Portb = Input ' Damits das LCD net stört Config Portc = Input Config Portd = Output Portc = 255 ' Pullup Widerstände EIN '*************************** Anfang Hauptprogramm 'Begrüßung Cls Locate 1 , 1 Lcd " Willkommen " Locate 2 , 1 Lcd " eCalc " Waitms Logo_time Cursor On Noblink 'Hauptschleife Do Cls A = Getnumber() Lcd A![]()
schreibe ich stattdessen direkt "LCD Getnumber()" funktioniert es.
Kann mir bitte jemand helfen? Ich versteh das einfach nicht =/
MFG







Zitieren
Lesezeichen