Hi Guys
Haven't been around in a while and I hope everyone is well :-)
I am trying to do a kind of wireless capture and compare but I have a problem on the receiving end that I lookings for some suggestions on.
Heres the pseudo code:
1.send/transmit 4 bytes 4 times (done and it's working!)
2.receive the 4 bytes 4 times (the receiver receives the 4 bytes 4 times successfully -using serial port tool)
3.Store the 4 instances/lines of 4 bytes (Here's where I have the problem)
4.Compare lines 3 and 4 (or any of the lines with one of the others.This is the other problem I have)
Heres my code:
Code:
'Variables begin here
SYNK VAR BYTE
SYNK = $7E '126 DECIMAL, BINARY 11111110
TRAIN VAR BYTE
TRAIN = $B3
WNUM VAR BYTE
XNUM VAR BYTE
YNUM VAR BYTE
ZNUM VAR BYTE
WNUM = 31
XNUM = 1
YNUM = 2
znum = 2
'end of variables
main:
low led 'set led low
If GPIO.2 = 1 then main 'check button
send:
for counter = 0 to 3
DEBUG train,train,train,train,train,synk,WNUM,XNUM,YNUM,ZNUM,$d,$a
next counter
high led 'set led high
pause 200
goto main
end
So as you can see I use DEBUG to send the same this to the serial port 4 times which renders this output in the serial tool:
³³³³³~
³³³³³~
³³³³³~
³³³³³~
which converted to DECIMAL looks like this:
17917917917917912631122
17917917917917912631122
17917917917917912631122
17917917917917912631122
PERFECT but .....
How can I receive and store each instance of WNUM,XNUM,YNUM,ZNUM.
In other words I would like to have four instances of WNUM,XNUM,YNUM,ZNUM, so I could compare each instance of WNUM,XNUM,YNUM and ZNUM.
What is the best way to do it ?
Would I use 4 different arrays?
For example array1 would hold the first line conatining the values for WNUM,XNUM,YNUM,ZNUM.
Array2 would hold the values for the second line and array3 for line 3 and array4 for line 4.
Some help would really be appreciated.
Kind regards
Dennis
Bookmarks