General area when it fits no where else

Moderator: Mmiscool

User avatar
By bugs
#52577 Had to download and re-program the chip as the new commands were not in the alpha .30 version.
I wish the download page indicated the version number as you don't get to know until after programming!

I don't understand the received numbers you have shown.
Do you get the same result every time?

I just used this section of your program:-
Code: Select allserialbranch [serialin]
wait

[serialin]
ID$ = ""
Do
    ID$ = str(serial.read.int()) & ID$
Loop while serial.available()

    print "received:" & ID$
   


and sent the following 10 characters from my terminal (your data with spaces omitted):-
00826B6F86
and printed:-
received:54567054665450564848

adding some spaces
54 56 70 54 66 54 50 56 48 48
and going to a decimal-ASCII table :-
6 8 F 6 B 6 2 8 0 0
which, as you say, is reversed
EDIT: but that can be changed by modifying the line to:-
ID$ = ID$ & str(serial.read.int())

But it is (sort of) recognisable as the string of characters I sent in the first place.
This is my doubt with your received number - not only is there and odd number of digits (13) - I can't spot any relationship to what you are sending/receiving.
My suggestion would be to concentrate on getting just this part of the program working consistently with your serial input so that the number can be recognised as something sensible.
User avatar
By Ecoli-557
#52579 Some good news, I figured out how to read the chars in the correct order, code below:
Code: Select all'dimension string and numeric arrays
dim a$(5)
dim b(5)

serialbranch [serialin]
wait

[serialin]
ID$ = ""
Do
    ID$ = ID$ & str(serial.read.int())
Loop while serial.available()

print "received:" & ID$

end


and it prints: received:0130107111134
Knowing what the tag is and what my eavesdropper receives, the received bytes should be (in hex)
00 82 6B 6F 86 (spaces for clarity.
knowing this, adding spaces manually to the received data and printed from program, it should be
0 130 107 111 and checksum is 134

Now to figure out how to get a byte at a time even if it is decimal so it can be converted to HEX to come up with the correct tag ID number.
User avatar
By bugs
#52583 OK - that seems like a step forward.

You could maybe add a separating space by
ID$ = ID$ & str(serial.read.int()) & " "
then use instr(ID$," ") in a loop to get the individual decimals.
something like (untried vb code)

Code: Select alli = 0
n = instr(ID$, " ")
while n > 0
  b(i) =  left(ID$,n)
 ID$ = mid(ID$,n+1)
 i = i +1   
wend