Hello Friends,
Need help with the below code.
The above code works well without the timeout, but i need to put timeout in there.
PIC18f2520 @20mhz
Any help suggestion shall be helpful.
Cheers
Mastero
Need help with the below code.
Code:
Define SERIN_TIMEOUT_REG = INTCON
Define SERIN_TIMEOUT_BIT = TMR0IE
slave: 'check communication with slave
i = 0
slaveready = False
Serout PORTB.0, 9600, "A", CrLf
loop:
INTCON = %10100000
T0CON = %11100111
Serin PORTB.1, 9600, serdata
If serdata > 0 Then
If serdata = "K" Then 'OK received
slaveready = True
INTCON = %00000000
T0CON = %01100111
Return
Endif
Endif
i = i + 1
If i = 10000 Then
INTCON = %00000000
T0CON = %01100111
Return 'timeout
Endif
Goto loop
Return
The above code works well without the timeout, but i need to put timeout in there.
PIC18f2520 @20mhz
Any help suggestion shall be helpful.
Cheers
Mastero