Sorry for my bad Eng
Can't find bug
This code works not correct.
Each ~30 toggles it switch port faster. Then ~30 toggles normal and 2-3 switches faster. Then ~30 normal .......
If this code move to Timer_ISR, then no bug!!! All works correct!
But in main: not.
Code: Select all
DIM Tmsec as BYTE at GTimer 'Alias èëè ïñåâäîíèì ìëàäøåãî áàéòà
DIM Tsec as WORD at GTimer 'Alias èëè ïñåâäîíèì ìëàäøåãî ñëîâà 65ñåê ìàêñèìóì
' Main program
main:
Dim _tsec_old as WORD
Dim _tsec_now as WORD
DDRD=$FF '
DDRB=$FF
PORTB=%10101010
PORTD=%01010101
InitMessages()
InitTimers()
SREG_I_bit = 1 '
Wait:
_tsec_now=Tsec
If (_tsec_now-_tsec_old>400*msec) Then
PORTD=not PORTD
_tsec_old=Tsec
End If
GoTo Wait
' While TRUE
' wend
Thank You!
Project: