I'm sending a few bytes of data between 28x1's via Hserout/Hserin(background receive with flag5 set as interrupt trigger). I have Hserial setup as follows:
The transmitter code is:
On the receiver side I have:
On the receiver the Sertxd shows the Hserptr ends up as "104" which means only 4 bytes received, not 5 that was sent. Also the the second Sertxd shows:
Sending from the "receiver" (20 bytes) using the same routine "SendIt" has no problems being received on the "transmitter" without missing last byte.
Any ideas ?
Code:
setfreq m8
pause 2000 'pause for LCD startup etc.
put 2,0:put 3,0:put 4,0:put 5,0 'O/P pins clear limit flags
setintflags %00100000,%00100000
pause 5
hsersetup B9600_8,%01
pause 5
hserptr=100
pause 5 'operations data stored below RAM 100
hserflag=0
pause 5
Code:
'Transmitter sending routine.
put 80,10:put 81,0
put 82,3:put 83,0:put 84,5
gosub SendIt
'-------------------------
SendIt:
for cntb1= 80 to 84 '5 data bytes
get cntb1,cntb2 'get the byte
hserout 0,(cntb2) 'send the data byte
pause 2 'give receiver time to write
next cntb1
return
'-------------------------
Code:
get 100,cntb1 'read the code
select case cntb1 'immediately decode for action
case 10 'LIMIT switch TRIPPED !
low Sdn 'immediately stop all shutters !
low Sup
low Ndn
low Nup
pause 5
get 101,cntb1 'get 1st O/P pin, 2/3/4/5(Sup/Sdn etc)
get 102,cntb2 'get 2nd O/P pin
get 103,cntb3 'get 3rd O/P pin
get 104,nowtb 'get 4th O/P pin
sertxd("hserptr= ",#hserptr,cr,lf)
pause 2000 'just to see it
put 2,cntb1:put 3,cntb2
put 4,cntb3:put 5,nowtb
sertxd("received - /",#cntb1,"/",#cntb2,"/",#cntb3,"/",nowtb,"/")
missing the byte that should be in "nowtb"...received - /2/0/0/
Sending from the "receiver" (20 bytes) using the same routine "SendIt" has no problems being received on the "transmitter" without missing last byte.
Any ideas ?
Last edited: