I used to receive the packets using SERIN2 and it works quite well but when the data comes one after another too fast I start loosing packets while the program is out doing other things after the serin2 times out.


'*************** Variables for Receiving Pelco-P data *********

data_1 VAR BYTE ' Header
data_2 VAR BYTE ' ID Camera
data_3 VAR BYTE ' 1st Data
data_4 VAR BYTE ' 2nd Data
data_5 VAR BYTE ' 3th DAta
data_6 VAR BYTE ' 4th DAta
data_7 VAR BYTE ' Trailer
data_8 VAR BYTE ' Checksum

'*************** CONSTANTS ***********************
baud con 16390'Baud rate for test pin output



START:


'**RECEIVE DATA FROM RS485 AND SEE IF IT IS A PELCO-P COMMAND ****

Receiving:


SERin2 DATAIN,188,1000,timeout,[data_1,data_2,data_3,data_4,data_5,data_6,data_7,d ata_8]

timeout:

if (data_1 <> $A0) then 'Check if the 1st byte is Pelco ($A0).
goto receiving
endif

etc.... etc do the decoding....