Hello everyone sorry did not reply earlier.
hello mackrackit , is enabled every time it happens the serial interrupt. is used to determine if there are no more characters to read and works. original code from modbus.pl
If (NewFrame = 1) OR (Length = 0) then 'New modbus frame start
NewFrame = 0
T2CON.2 = 1 ' Enable Timer2
Length = 1
EndIf
hello Jerson, the crc16 is working, the led is switched off in the Main, is switched on every time PIR1.5 = 1. when the fault occurs, the LED lights (I'm in the interruption) and then turn off.
hello HenrikOlsson, explain why "Define very large", look:
while (PIR1.5 = 1) 'Write modbus frame to buffer
buffer[Length] = RCREG
Length = Length + 1
if Length >=20 then ' here check buffer
Length = 0
EndIf
wend
Bookmarks