Hi people,
Im using an 16F877 in a RS485 network. Everything is working fine except when a have noise on the network.
Im using HSERIN (without interrupt) and when I have noise on the network it cant use the timeout statement. When this happens, the program stop until the HSERIN command execute the time out. But I lost some information of the other pins that are counting some events.
The best thing to do is to eliminate the interferente (I know this) but Im trying to do a "noise proof" program, this means that even if I cant communicate I wont lost the counting.
Ï was thinking to use a timer interrupt like this:
INTCON.2 = 0
TMR0 = $00 ' reload TMR0
enable
T1CON.0 = 1 'Start timer1 again
HSERIN 50,Inicio,[WAIT("A"),Data_Rec(0)...]
T1CON.0 = 0 'Stop timer1 while we're messing with it
disable
Where I enable the interrupt only during the serial RX using a timer overflow > 50ms (the HSERIN timeout). If a serial lockup occurs, the timer interrupt will save me! With this I think I can resolve the problema.
What do you think? Problems? Sugestions? Any tip will help!
Best Regards,
Sergio
Bookmarks