Hier jetzt mal der aktuelle Code.
Code:
$regfile = "m88def.dat"
$prog &HFF , &HE2 , &HDF , &HF9 ' generated. Take care that the chip supports all fuse bytes.
$hwstack = 128
$framesize = 128
$swstack = 128
Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portd.0 , _
Db7 = Portd.1 , E = Portb.4 , Rs = Portb.5
Config Lcd = 16 * 2
Cursor Off
Config Timer1 = Timer , Prescale = 64
Config Int0 = Falling
Config Int1 = Falling
On Int0 Ges 'Geschwindigkeit
On Int1 Dre 'Drehzahl
On Timer1 Timer_irq
Enable Int0
Enable Int1
Enable Timer1
Config Sda = Portc.4
Config Scl = Portc.5
Config Portd.2 = Input
Config Portd.3 = Input
Config Portd.0 = Output
Pind.2 = 1
Pind.3 = 1
Dim G_pre As Long
Dim G_set As Word
Dim G_calc As Single
Dim G_out As Integer
Dim D_pre As Long
Dim D_set As Word
Dim D_out As Integer
Do
Upperline : Lcd " " ; D_out ; " " ; G_calc ; " "
Lowerline : Lcd " " ; Timer1 ; " "
Waitms 1000
Loop
Ges:
G_calc = G_set - G_pre
G_pre = G_set
G_set = Timer1
Return
Dre:
D_out = D_set - D_pre
D_pre = D_set
D_set = Timer1
Return
Timer_irq:
D_pre = D_pre - 65535
G_pre = G_pre - 65535
Return
End
Was mach ich falsch, dass er die Trigger INT0/1 gegen Masse nicht erkennt und die Differenz zwischen den 'pre" und 'set' nicht ausgibt?
Lesezeichen