Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hi All
I have been building small pic networks using the rs232 interface, hardware (16f874) or software version (16f84). PROBLEM. If you use serin it will wait for the amount of bytes specified, forever. IS there a timeout available ?
Define CONF_WORD = 0x3ff2
Dim x As Bit
Dim y As Byte
init:
AllDigital
x = 1
main:
Serout RB0, 9600, "Hello world!", CrLf
While x = 1
Call serin_timeout(100)
Wend
End
Proc serin_timeout(t As Byte)
Dim serin_flag As Bit
serin_flag = 0
'enable prescaler for tmr0
OPTION.PSA = 0
'set tmr0 prescaler for 8
OPTION.PS2 = 0
OPTION.PS1 = 1
OPTION.PS0 = 0
'enable tmr0
OPTION.T0CS = 0
'clear tmr0
TMR0 = 0
While TMR0 < t
If PORTB.1 = 0 Then
Serin RB1, 9600, y
Serout RB0, 9600, y, CrLf
serin_flag = 1
Endif
Wend
If serin_flag = 0 Then
Serout RB0, 9600, "TIMEOUT", CrLf
Endif
'clear tmr0
TMR0 = 0
'disable TMR0
OPTION.T0CS = 1
End Proc
Can't you use the WDT?If you use serin it will wait for the amount of bytes specified, forever. IS there a timeout available ?