Hello I am using the following on a 28x1 with 16Mhz resonator. I am receiving a data string about 50 bytes long and trying to write to the scratch pad as a sort of serial buffer.
This is pretty much what I use (actual code on another computer) and for the most part it works pretty good. Except it does on some instances fail 10 times even though it does not reach the end of the string. I have a counter on the actual program and it will sometimes fail 2 or 3 times with the qualifier yet work of the 4th or 5th attempt even though it is using the same data!
Im reading in mac addresses so the chances of the previous 4 bytes being the same are pretty remote. If I try and qualify by all 10 bytes it never works.
Why would this be? Im thinking the device is sending data before serin get's it's A into G so misses the first few bytes but this would fail every time wouldn't it?
Cheers
Code:
(some code to start device sending)
SERIN 1,T9600_16,B1,B2,B3,B4,B5,B6,B7,B8,B9,B10 'GET FIRST 10 BYTES
INC B20 'INCREMENT SCRATCH PAD POINTER
PUT B20,B1 'WRITE BITE TO SCRATCH PAD
INC B20
PUT B20,B2
INC B20
PUT B20,B3
INC B20
PUT B20,B4
INC B20
PUT B20,B5
INC B20
PUT B20,B6
INC B20
PUT B20,B7
INC B20
PUT B20,B8
INC B20
PUT B20,B9
INC B20
PUT B20,B10
READIN:
(some code to start device sending)
'QUALIFY NEXT 10 BYTES WITH PREVIOUS 4 BYTES
SERIN [2000,RETRY],1,T9600_16,(B7,B8,B9,B10),B1,B2,B3,B4,B5,B6,B7,B8,B9,10
INC B20
PUT B20,B1
INC B20
PUT B20,B2
INC B20
PUT B20,B3
INC B20
PUT B20,B4
INC B20
PUT B20,B5
INC B20
PUT B20,B6
INC B20
PUT B20,B7
INC B20
PUT B20,B8
INC B20
PUT B20,B9
INC B20
PUT B20,B10
GOTO READIN
RETRY:
INC B19
IF B19 > 10 THEN END_OF_STRING
GOTO READIN
Im reading in mac addresses so the chances of the previous 4 bytes being the same are pretty remote. If I try and qualify by all 10 bytes it never works.
Why would this be? Im thinking the device is sending data before serin get's it's A into G so misses the first few bytes but this would fail every time wouldn't it?
Cheers