My serin2 statement differs from the examples in the book in many ways. And I don't know which differences are important. I've tried lots of variations, and the error is not "plain as day" to me. Can I just get an answer? I promise I have not come the forum as a first resort.
My point exactly: You're serin2 statement differs from the examples in the book in many ways.
Does that tell you anything? Such as that if it differs, it probably won't work right.
Try to make your serin2 statement look like something in the book. Compare the SERIN with the SERIN2 statement. What's different about the two? Specifically, the 3rd paragraph of Page 132 and the 2nd paragraph of Page 130.
It's just that easy! Really it is.
You could 'just get an answer', but you're not going to learn anything about learning anything.
The following code works. Serin2 modes differ from serin modes, and I think the variables for serin and serout ports have to have numbers.
DEFINE OSC 20
S0 var portb.0 ' Define serial out pin
S1 var portb.1 ' Define serial in pin
RDR1 VAR portb.3 ' serial in from reader
RST1 VAR portb.2 ' reader reset
B0 var byte 'byte variable
tag var BYTE[10] ' Creates a byte array of 10 bytes
HIGH RST1 'reset Reader
loop: Serin S1,6,B0 ' B0 = input character
PAUSE 1500 'wait a sec
Serout S0,6,["ready "] 'Send ready
SERIn2 RDR1, 16468,[skip 2, STR tag\10] 'read in tag ID
SEROUT S0,6,["got the code: "] 'acknowledge
print: Serout2 S0,16468,[STR tag] 'send out tag ID
Serout S0,6,[" done"] 'print done
Goto loop 'do it again
Good game....That's what I was getting at the whole time.
SERIN/SEROUT; use modes (t2400, n9600, etc)
SERIN2/SEROUT2; you have to figure out the 'mode number' depending on what you want to do according to the manual (or towards the back somewhere there's a table with a lot of values already in it). But one of the advantages of the SERIN2/SEROUT2 over regular SERIN/SEROUT is that you can set it up to run at 4,578 baud if you want (I don't know if that works out in the math, but I think you get my point), that and the big one is the much better string/variable handling options.
Bookmarks