Serin troubles
Archiver
Posts: 46,084
Hi All,
I am trying to use a RWS/TWS 433mHz transmitter receiver setup, using a B2SX
for both receiver and transmitter. I can get it to send and receive data,
but the data is wrong, as if the baud rate is wrong or I am not using the
"dec" modifier correctly. If I transmit a zero, I get 255 on the other end.
If I insert a "dec" into the serin line on the receiver code, I get nothing,
like it is waiting for a synch byte that never comes. As you can see, I use
the number 255 on both sides and it receives correctly. Here is the code
snip:
TX:
'{$STAMP BS2sx}
dat var byte
synch var byte
baud var word
synch=255
baud = 17405
dat = 0
Send_Data:
serout 0,baud,10,[noparse][[/noparse]synch,dat]
pause 100
goto Send_Data
RX:
'{$STAMP B2sx}
dat var byte
baud con 17405
synch con 255
Get_Data:
serin 0,baud,[noparse][[/noparse]wait(synch),dat]
pause 500
debug dec dat, cr,cr
I have made this setup work before using a PIC for the xmit and a B2SX for
the recieve, so I know the hardware is good. Help me get off the short bus!
Jonathan
www.madlabs.info
I am trying to use a RWS/TWS 433mHz transmitter receiver setup, using a B2SX
for both receiver and transmitter. I can get it to send and receive data,
but the data is wrong, as if the baud rate is wrong or I am not using the
"dec" modifier correctly. If I transmit a zero, I get 255 on the other end.
If I insert a "dec" into the serin line on the receiver code, I get nothing,
like it is waiting for a synch byte that never comes. As you can see, I use
the number 255 on both sides and it receives correctly. Here is the code
snip:
TX:
'{$STAMP BS2sx}
dat var byte
synch var byte
baud var word
synch=255
baud = 17405
dat = 0
Send_Data:
serout 0,baud,10,[noparse][[/noparse]synch,dat]
pause 100
goto Send_Data
RX:
'{$STAMP B2sx}
dat var byte
baud con 17405
synch con 255
Get_Data:
serin 0,baud,[noparse][[/noparse]wait(synch),dat]
pause 500
debug dec dat, cr,cr
I have made this setup work before using a PIC for the xmit and a B2SX for
the recieve, so I know the hardware is good. Help me get off the short bus!
Jonathan
www.madlabs.info
Comments
> Hi All,
>
> I am trying to use a RWS/TWS 433mHz transmitter receiver setup, using a B2SX
> for both receiver and transmitter. I can get it to send and receive data,
> but the data is wrong, as if the baud rate is wrong or I am not using the
> "dec" modifier correctly. If I transmit a zero, I get 255 on the other end.
Sounds like you might be inverting the data at one end or the
other - I'd look into that possibility.
Our government it seems has got a new plan...
Seize and search the private records of every man.
No warrants, no judges, no due process required,
With "Homeland Security" the 4th Amendment's retired.
"Total Information Awareness" the project is called,
Oh would our forefathers be aghast and appalled!
http://geocities.com/totalinformationawareness/