hab jetzt nochmal ein neues Programm geschrieben, welches mit weniger Hardware auskommt (also nur 2 ext. Interrupts) und sonst nichts
Dadurch hast du nicht immer diese blöde Timer-isr und hast mehr Zeit für andere sachen.
Hier mal der Code:
Aber hier noch die Antworten auf deine Frage, falls du lieber den ersten Code verwenden möchtest:Code:$regfile = "m32def.dat" $crystal = 16000000 $framesize = 80 $hwstack = 80 $swstack = 80 Config Lcd = 20 * 4 Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.4 , Rs = Portc.5 Config Lcdbus = 4 Initlcd Cls Cursor Off Config Pind.2 = Input Portd.2 = 0 Config Pind.3 = Input Portd.3 = 0 Config Int0 = Rising On Int0 Kanal_1 Enable Int0 Config Int1 = Rising On Int1 Kanal_2 Enable Int1 Dim Kanal(2) As Word Dim Rc(2) As Word Enable Interrupts Do Locate 1 , 1 Lcd "Servo(1): " ; Rc(1) ; " " Locate 2 , 1 Lcd "Servo(2): " ; Rc(2) ; " " Waitms 100 Loop End Kanal_1: While Pind.2 = 1 Waitus 10 Incr Kanal(1) Wend Rc(1) = Kanal(1) Kanal(1) = 0 Return Kanal_2: While Pind.3 = 1 Waitus 10 Incr Kanal(2) Wend Rc(2) = Kanal(2) Kanal(2) = 0 Return
Im label "Servo_input" schreibst du nach "Servo_wert_read = Servo_wert " noch "servo_wert = 0".
Das mit dem disablen der Interrupts kannst du dir sparen, da diese sowieso standartmäßig disabled sind (also in isr's)
Solltest du es doch verwenden wollen (aus welchen Gründen auch immer), könntest du auch "Disable Timer1" schreiben, dann wird nur dieser disabled.
Gruß
Chris







Zitieren

Lesezeichen