Recieving serial data with a bs1?
Hward
Posts: 8
I have a little x10 single reciever that sends the signal out a serial port· Could someone help me just get the stamp to just read from it and debug what it recieved?
This is the reciever i have··· http://www.wgldesigns.com/w800.html
·
This is the reciever i have··· http://www.wgldesigns.com/w800.html
·
Comments
·· Besides being RS-232 levels, the baud rate for this device is listed as 4800 bps, while the BS1 can only go up to 2400 bps.· You would need a BASIC Stamp 2 for this device.· Sorry.· =(
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
http://www.wgldesigns.com/protocols/w800rf32_protocol.txt
and what does the level shifter do?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Generally speaking devices which boost RS-232 signal levels also invert the data. Thus, incoming RS-232 data can either be (so called) TRUE or INVERTED. You will need to use the SERIN command to access RS-232 data. In the SERIN command, you specify (at minimum) the receiving pin port number, the BAUDMODE (baud rate + polarity), and the name of the receiving data field, like so:
baud_mode con 16752 ' BS-2 : 4800, no parity, 1 STOP, INVERTED
'baud_mode con 188 ' BS-2 : 4800, no parity, 1 STOP, TRUE
RX_Pin con 0 'Arbitrary RS-232 input pin port number
datum var byte(4) 'Establish a 4 byte data array to receive X-10 data
SERIN RX_Pin, baud_mode, [noparse][[/noparse]datum\4] 'Read 4 bytes of serial input data from W800
etc
That should get you started. Since I suspect there will be more questions about how to handle this slightly unusual data, I printed out the protocol document, which I would suggest you do as well.
Here are two simple but slightly tricky routines which may help you in dealing with this data, and save you some precious variable space in the process:
Rule of logic 1: Any data field exclusively ORed with itself will always result in binary zeros
Application: X = X^X results in X = 00H
Rule of logic 2: Any two data fields exclusively ORed with each other three times, alternating the source and destination fields, will result in a swapping of the data in those two fields without the need for an intermediate storage area.
Application:
Initially: A = 1, B - 2
A = A ^ B
B = B ^ A
A = A ^ B
Result: A = 2, B = 1
One additional PBASIC hint. The REV operator will reverse the bit order in a specified data field.
Regards,
Bruce Bates