Shop OBEX P1 Docs P2 Docs Learn Events
Serout/Serin Numeric Probs — Parallax Forums

Serout/Serin Numeric Probs

ArchiverArchiver Posts: 46,084
edited 2003-06-15 03:27 in General Discussion
HELP.. I know Im missing somethin simple here.

I am passing data between 2 stamps with the following:

From Slave
...
result var word
...do stuff...
SEROUT 0\1,16468,6000,nomaster,[noparse][[/noparse]sensor, result]
debug dec sensor," ", dec result, cr
... loop for all 5

To Master
...
result var word
...
serin 2\3, 16468, 3000, waitforslave, [noparse][[/noparse]sensor, Result]
debug dec sensor," ", dec result, cr
.. keep polling slave for all 5

Debug output
Master Slave
Sensor 1 113 Sensor 1 113
Sensor 2 14 Sensor 2 526
Sensor 3 228 Sensor 3 484
Sensor 4 127 Sensor 4 383
Sensor 5 109 Sensor 5 365

I noticed that the 113 value of sensor 1 is correct, but what is
happening to 4-5 I have not been able to fix with formatting either
on the serin or serout side of things. Both "result" are defined as
words. Result gets its value from the following line of code:
SHIFTIN 9,SCLK,2,[noparse][[/noparse]result\12] which is a MAX 186 ADC.

Your thoughts?
Thanks in advance.

rltaylor001@h...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-06-14 21:56
    SERIN and SEROUT work with bytes. Try this:

    SEROUT 0\1, 16468, 6000, No_Master, [noparse][[/noparse]sensor, result.LOWBYTE,
    result.HIGHBYTE]

    and...

    SERIN 2\3, 16468, 3000, Wait_For_Slave, [noparse][[/noparse]sensor, result.LOWBYTE,
    result.HIGHBYTE]

    -- Jon Williams
    -- Parallax


    In a message dated 6/14/2003 3:23:17 PM Central Standard Time,
    rltaylor001@h... writes:

    > HELP.. I know Im missing somethin simple here.
    >
    > I am passing data between 2 stamps with the following:
    >
    > From Slave
    > ...
    > result var word
    > ...do stuff...
    > SEROUT 0\1,16468,6000,nomaster,[noparse][[/noparse]sensor, result]
    > debug dec sensor," ", dec result, cr
    > ... loop for all 5
    >
    > To Master
    > ...
    > result var word
    > ...
    > serin 2\3, 16468, 3000, waitforslave, [noparse][[/noparse]sensor, Result]
    > debug dec sensor," ", dec result, cr
    > .. keep polling slave for all 5
    >
    > Debug output
    > Master Slave
    > Sensor 1 113 Sensor 1 113
    > Sensor 2 14 Sensor 2 526
    > Sensor 3 228 Sensor 3 484
    > Sensor 4 127 Sensor 4 383
    > Sensor 5 109 Sensor 5 365
    >
    > I noticed that the 113 value of sensor 1 is correct, but what is
    > happening to 4-5 I have not been able to fix with formatting either
    > on the serin or serout side of things. Both "result" are defined as
    > words. Result gets its value from the following line of code:
    > SHIFTIN 9,SCLK,2,[noparse][[/noparse]result\12] which is a MAX 186 ADC.
    >
    > Your thoughts?
    > Thanks in advance.
    >
    > rltaylor001@h...



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-14 22:30
    Thanks, nice to have a second set of eyes.. I am assuming that I'll
    have to do the same when I serout to VB, since the "word" is greater
    than 255. Are there issues gluing the low/high bytes back together
    in VB?

    Thanks again,
    RLT






    --- In basicstamps@yahoogroups.com, jonwms@a... wrote:
    > SERIN and SEROUT work with bytes. Try this:
    >
    > SEROUT 0\1, 16468, 6000, No_Master, [noparse][[/noparse]sensor, result.LOWBYTE,
    > result.HIGHBYTE]
    >
    > and...
    >
    > SERIN 2\3, 16468, 3000, Wait_For_Slave, [noparse][[/noparse]sensor, result.LOWBYTE,
    > result.HIGHBYTE]
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    > In a message dated 6/14/2003 3:23:17 PM Central Standard Time,
    > rltaylor001@h... writes:
    >
    > > HELP.. I know Im missing somethin simple here.
    > >
    > > I am passing data between 2 stamps with the following:
    > >
    > > From Slave
    > > ...
    > > result var word
    > > ...do stuff...
    > > SEROUT 0\1,16468,6000,nomaster,[noparse][[/noparse]sensor, result]
    > > debug dec sensor," ", dec result, cr
    > > ... loop for all 5
    > >
    > > To Master
    > > ...
    > > result var word
    > > ...
    > > serin 2\3, 16468, 3000, waitforslave, [noparse][[/noparse]sensor, Result]
    > > debug dec sensor," ", dec result, cr
    > > .. keep polling slave for all 5
    > >
    > > Debug output
    > > Master Slave
    > > Sensor 1 113 Sensor 1 113
    > > Sensor 2 14 Sensor 2 526
    > > Sensor 3 228 Sensor 3 484
    > > Sensor 4 127 Sensor 4 383
    > > Sensor 5 109 Sensor 5 365
    > >
    > > I noticed that the 113 value of sensor 1 is correct, but what is
    > > happening to 4-5 I have not been able to fix with formatting
    either
    > > on the serin or serout side of things. Both "result" are defined
    as
    > > words. Result gets its value from the following line of code:
    > > SHIFTIN 9,SCLK,2,[noparse][[/noparse]result\12] which is a MAX 186 ADC.
    > >
    > > Your thoughts?
    > > Thanks in advance.
    > >
    > > rltaylor001@h...
    >
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-14 22:51
    > Thanks, nice to have a second set of eyes.. I am assuming that I'll
    > have to do the same when I serout to VB, since the "word" is greater
    > than 255. Are there issues gluing the low/high bytes back together
    > in VB?
    >
    > Thanks again,
    > RLT

    I have a VB project showing how to receive byte-sized data and
    combine bytes to form words, extract & act on individual bytes, etc,
    here http://www.rentron.com/PicBasic/VB_PIC_TEMP.htm


    Regards,

    -Bruce
    tech@r...
    http://www.rentron.com
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-14 23:17
    BINGO, Thanks

    RLT


    --- In basicstamps@yahoogroups.com, <tech@r...> wrote:
    > > Thanks, nice to have a second set of eyes.. I am assuming that
    I'll
    > > have to do the same when I serout to VB, since the "word" is
    greater
    > > than 255. Are there issues gluing the low/high bytes back
    together
    > > in VB?
    > >
    > > Thanks again,
    > > RLT
    >
    > I have a VB project showing how to receive byte-sized data and
    > combine bytes to form words, extract & act on individual bytes, etc,
    > here http://www.rentron.com/PicBasic/VB_PIC_TEMP.htm
    >
    >
    > Regards,
    >
    > -Bruce
    > tech@r...
    > http://www.rentron.com
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-15 03:27
    No problem at all. To see how to exchange data with VB, go to our web site
    and download Nuts & Volts article #89.

    -- Jon Williams
    -- Parallax

    In a message dated 6/14/2003 4:31:33 PM Central Standard Time,
    rltaylor001@h... writes:

    > Thanks, nice to have a second set of eyes.. I am assuming that I'll
    > have to do the same when I serout to VB, since the "word" is greater
    > than 255. Are there issues gluing the low/high bytes back together
    > in VB?
    >
    > Thanks again,
    > RLT



    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.