Still having serious serin problems (HELP!!)
Archiver
Posts: 46,084
Hi All,
I posted this the other day, and still cannpt make it work after mnay hours
of head banging. Save my forehead and my sanity! What is going on here?
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 an ASCII byte that never comes, although I have tried
dec1-dec5. This should be so simple, and it is driving me mad! I have tried
many combinations of this code, and just can't get the data across right.
This is just like a problem I had before when the baud rates were wrong, but
they aren't.
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 posted this the other day, and still cannpt make it work after mnay hours
of head banging. Save my forehead and my sanity! What is going on here?
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 an ASCII byte that never comes, although I have tried
dec1-dec5. This should be so simple, and it is driving me mad! I have tried
many combinations of this code, and just can't get the data across right.
This is just like a problem I had before when the baud rates were wrong, but
they aren't.
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
>
> 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]
>
try #dat instead of dec dat, and see if it works
> 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
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
jpeakall@m... writes:
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 an ASCII byte that never comes, although I have tried
dec1-dec5. This should be so simple, and it is driving me mad! I have tried
many combinations of this code, and just can't get the data across right.
This is just like a problem I had before when the baud rates were wrong, but
they aren't.
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!
>
Try this:
serout 0, baud, [noparse][[/noparse]"A", dat]
and
serin 0, baud, [noparse][[/noparse]wait("A"), dat]
If this doesn't work contact Bruce at tech@r....
Sid Weaver
W4EKQ
Port Richey, FL
[noparse][[/noparse]Non-text portions of this message have been removed]
It doesn't work. However, if I substitute the serin line with:
serin 0, baud [noparse][[/noparse]wait(125),dat]
it does work, but with the data from "dat" still being incorrect. Is there
any possibility this is because I am using the 1.33 editor on my RWS side
and the 1.33b version on my TX side?
Thanks for the help, I need it!
Jonathan
Original Message
From: <Newzed@a...>
To: <basicstamps@yahoogroups.com>
Cc: <tech@r...>
Sent: Friday, January 03, 2003 8:43 AM
Subject: Re: [noparse][[/noparse]basicstamps] Still having serious serin problems (HELP!!)
> In a message dated 01/03/2003 11:16:59 Eastern Standard Time,
> jpeakall@m... writes:
> 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 an ASCII byte that never comes, although I have
tried
> dec1-dec5. This should be so simple, and it is driving me mad! I have
tried
> many combinations of this code, and just can't get the data across right.
> This is just like a problem I had before when the baud rates were wrong,
but
> they aren't.
>
> 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!
> >
>
> Try this:
>
> serout 0, baud, [noparse][[/noparse]"A", dat]
>
> and
>
> serin 0, baud, [noparse][[/noparse]wait("A"), dat]
>
> If this doesn't work contact Bruce at tech@r....
> Sid Weaver
> W4EKQ
> Port Richey, FL
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
jpeakall@m... writes:
> it does work, but with the data from "dat" still being incorrect. Is there
> any possibility this is because I am using the 1.33 editor on my RWS side
> and the 1.33b version on my TX side?
>
>
No, different editors has nothing to do with it. Try serouting "A" instead
of what you are using for dat. Make sure that all cons and vars are the same
in both programs. When you serin, store the incomuing byte in dat, the debug
dat. You should get the letter A without the quotes. Let me know.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
Hmmm. I decided to just hook the two Stamps together minus the RF link. The
same problem occurred until I remembered to connect the grounds of both
systems. Now it works fine, with code I have tried over and over. Now with
the RF setup, obviously the grounds will not be tied together, but this may
be a clue. At least I have ruled out any editor error and operator error.
Now I need to verify the hardware (yet again!) and see if I find problems
there.
Thanks for the replies,
Jonathan
Original Message
From: <Newzed@a...>
To: <basicstamps@yahoogroups.com>
Sent: Friday, January 03, 2003 11:56 AM
Subject: Re: [noparse][[/noparse]basicstamps] Still having serious serin problems (HELP!!)
> In a message dated 01/03/2003 14:45:07 Eastern Standard Time,
> jpeakall@m... writes:
>
>
> > it does work, but with the data from "dat" still being incorrect. Is
there
> > any possibility this is because I am using the 1.33 editor on my RWS
side
> > and the 1.33b version on my TX side?
> >
> >
>
> No, different editors has nothing to do with it. Try serouting "A"
instead
> of what you are using for dat. Make sure that all cons and vars are the
same
> in both programs. When you serin, store the incomuing byte in dat, the
debug
> dat. You should get the letter A without the quotes. Let me know.
>
> Sid
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
(Dout). On the TWS, make sure pins 1 and 2 are tied together, and that pins
3 and 4 are tied together. The 22K on pin 3 of the receiver is a pull down
resistor that keeps the receiver from pulsing at random.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
helpful--
http://www.rentron.com/Stamp_RF.htm
The example is set up to use a BS1 as the transmitter and a BS2 as
the receiver, but you can apply it to the BS2sx. He defines a warm-
up "junk " number to send before the "sync" character, because in RF
it's easy for the receiver to mess up the first byte of data coming
from the transmitter. The receiving STAMP effectively ignores
the "junk" number.
txpin con 0
baud con 17405 'BS2sx baud is 2400 8N1 inverted
junk con 126
sync con "A"
dat var byte
dat=0
serout TXPIN, baud, [noparse][[/noparse]junk, sync, dat, cr]
(etc.)
*****************************
On the receiver side:
rxpin con 1
baud con 17405 'BS2sx baud is 2400 8N1 inverted
sync con "A"
dat var byte
serin RXPIN, baud, [noparse][[/noparse]wait(sync), dec dat]
debug dec dat, cr
(etc.)
*****************************
Now, I'm a fan of Timeout, so I would probably include a few extra
features in the receiver code:
rxpin con 1
baud con 17405 'BS2sx baud is 2400 8N1 inverted
sync con "A"
TKO con 500 'for BS2sx timeout units=400us so 500 means 200ms
dat var byte
LISTEN:
serin RXPIN, baud, TKO, UHOH, [noparse][[/noparse]wait(sync), dec dat]
debug dec dat, cr
goto listen
UHOH:
debug "Nobody home", cr
goto LISTEN
********************
That way you get some indication when the receiver isn't getting the
data.
You are using 255 as your sync byte; maybe you'd do better with "A"
or some other non-decimal character. Also I think you ought to use
the dec formatter before the dat, and include a CR (carriage return)
at the end of your serout command. That way when the stamp sees
something that isn't a decimal number, it will know to stop receiving.
I hope this helps. Good luck,
Marie
--- In basicstamps@yahoogroups.com, "Jonathan Peakall"
<jpeakall@m...> wrote:
> Sid,
>
> Hmmm. I decided to just hook the two Stamps together minus the RF
link. The
> same problem occurred until I remembered to connect the grounds of
both
> systems. Now it works fine, with code I have tried over and over.
Now with
> the RF setup, obviously the grounds will not be tied together, but
this may
> be a clue. At least I have ruled out any editor error and operator
error.
> Now I need to verify the hardware (yet again!) and see if I find
problems
> there.
>
> Thanks for the replies,
>
> Jonathan
>
>
Original Message
> From: <Newzed@a...>
> To: <basicstamps@yahoogroups.com>
> Sent: Friday, January 03, 2003 11:56 AM
> Subject: Re: [noparse][[/noparse]basicstamps] Still having serious serin problems
(HELP!!)
>
>
> > In a message dated 01/03/2003 14:45:07 Eastern Standard Time,
> > jpeakall@m... writes:
> >
> >
> > > it does work, but with the data from "dat" still being
incorrect. Is
> there
> > > any possibility this is because I am using the 1.33 editor on
my RWS
> side
> > > and the 1.33b version on my TX side?
> > >
> > >
> >
> > No, different editors has nothing to do with it. Try
serouting "A"
> instead
> > of what you are using for dat. Make sure that all cons and vars
are the
> same
> > in both programs. When you serin, store the incomuing byte in
dat, the
> debug
> > dat. You should get the letter A without the quotes. Let me
know.
> >
> > Sid
> >
> >
> > [noparse][[/noparse]Non-text portions of this message have been removed]
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
Subject and
> Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >
> >