Shop OBEX P1 Docs P2 Docs Learn Events
SERIN on Temperature Device — Parallax Forums

SERIN on Temperature Device

ArchiverArchiver Posts: 46,084
edited 2000-04-16 23:10 in General Discussion
I am new to the Stamp list, and BasicStamps. My first
real project is to read data from a serial temperature
sender and display that information on an LCD display.

The serial data comes from the temperature controller
at 2400 baud, in this format:

22.3 6.7 –1.6 18.2 –99.9 –99.9 –99.9 –99.9

I want to use SERIN to get the data into eight
variables, but do not understand how. My first problem
is that each temperature reading is not of equal
length.

Does anyone have hints on how to do this?

Jack


__________________________________________________
Do You Yahoo!?
Send online invitations with Yahoo! Invites.
http://invites.yahoo.com

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-04-16 15:24
    SERIN is very versitile. I don't know what the funny characters are between
    the numbers, but SERIN will read a number until it hits some unknown
    character if you use the DEC modifier.

    So if baud is the right baudmode constant, and pin is the right pin:


    tmp var word
    SERIN pin, baud, [noparse][[/noparse]dec tmp]

    At 2400 baud you might be able to read one do something and then come back
    around. At high speeds, you have to read everything in one swoop because the
    overhead is significant enough that you will lose characters if you don't.

    For example:
    SERIN pin, baud, [noparse][[/noparse]dec t1, dec t2, dec t3]

    Hope that helps. The Stamp manual has several examples of this under SERIN.

    Regards,

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller at
    http://www.al-williams.com/awce


    >
    Original Message
    > From: Jack Scasserra [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=jHgvNFsk8cWOxc6N8tE8ed_tX3qHV_naaXcN40lCRSNj5z6-JqZYxF7ZDkTGo7-eaa0G9Ud5bPrNYg]jscasserra@y...[/url
    > Sent: Sunday, April 16, 2000 8:15 AM
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] SERIN on Temperature Device
    >
    >
    > I am new to the Stamp list, and BasicStamps. My first
    > real project is to read data from a serial temperature
    > sender and display that information on an LCD display.
    >
    > The serial data comes from the temperature controller
    > at 2400 baud, in this format:
    >
    > 22.3 6.7 –1.6 18.2 –99.9 –99.9 –99.9 –99.9
    >
    > I want to use SERIN to get the data into eight
    > variables, but do not understand how. My first problem
    > is that each temperature reading is not of equal
    > length.
    >
    > Does anyone have hints on how to do this?
    >
    > Jack
    >
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Send online invitations with Yahoo! Invites.
    > http://invites.yahoo.com
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-04-16 18:43
    Al and others,

    I have tried using the DEC modifier, but do not seem
    to be getting to far.

    One of my first questions might be what I should
    declare the variable as first (T1, T2, T3, etc).

    When capturing the eight readings, they are separated
    by a space, and any one value can range from -55.0 to
    125.9 - will this present more of a problem for me?

    I am quite lost right now, so assistance is really
    appreciated.

    --- Al Williams <alw@a...> wrote:
    > SERIN is very versitile. I don't know what the funny
    > characters are between
    > the numbers, but SERIN will read a number until it
    > hits some unknown
    > character if you use the DEC modifier.
    >
    > So if baud is the right baudmode constant, and pin
    > is the right pin:
    >
    >
    > tmp var word
    > SERIN pin, baud, [noparse][[/noparse]dec tmp]
    >
    > At 2400 baud you might be able to read one do
    > something and then come back
    > around. At high speeds, you have to read everything
    > in one swoop because the
    > overhead is significant enough that you will lose
    > characters if you don't.
    >
    > For example:
    > SERIN pin, baud, [noparse][[/noparse]dec t1, dec t2, dec t3]
    >
    > Hope that helps. The Stamp manual has several
    > examples of this under SERIN.
    >
    > Regards,
    >
    > Al Williams
    > AWC
    > * Floating point math for the Stamp, PIC, SX, or any
    > microcontroller at
    > http://www.al-williams.com/awce
    >
    >
    > >
    Original Message
    > > From: Jack Scasserra [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=5eGNZ1YbYMyPA4y8kuIO_wlOGXI2VlQGIiZaarjc6J9F_hUN2XKkBpj89oFgeyMEluetj09QPFXMSobdXA]jscasserra@y...[/url
    > > Sent: Sunday, April 16, 2000 8:15 AM
    > > To: basicstamps@egroups.com
    > > Subject: [noparse][[/noparse]basicstamps] SERIN on Temperature Device
    > >
    > >
    > > I am new to the Stamp list, and BasicStamps. My
    > first
    > > real project is to read data from a serial
    > temperature
    > > sender and display that information on an LCD
    > display.
    > >
    > > The serial data comes from the temperature
    > controller
    > > at 2400 baud, in this format:
    > >
    > > 22.3 6.7 –1.6 18.2 –99.9 –99.9 –99.9 –99.9
    > >
    > > I want to use SERIN to get the data into eight
    > > variables, but do not understand how. My first
    > problem
    > > is that each temperature reading is not of equal
    > > length.
    > >
    > > Does anyone have hints on how to do this?
    > >
    > > Jack
    > >
    > >
    > > __________________________________________________
    > > Do You Yahoo!?
    > > Send online invitations with Yahoo! Invites.
    > > http://invites.yahoo.com
    > >
    > >
    >
    >
    >
    >
    >

    __________________________________________________
    Do You Yahoo!?
    Send online invitations with Yahoo! Invites.
    http://invites.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2000-04-16 23:10
    I would declare them as words so they could hold a 16-bit number. I guess if
    both parts are <255 you could use a byte.

    You numbers have decimal points in them, so you'd have to read the whole
    part and the fractional part separate. How you put them together will depend
    on your program logic.

    So I'm thinking something like SERIN p,b,[noparse][[/noparse]dec t1,".",dec t2].
    Now if you wanted the readings in decisomethings t0=t1*10+t2

    Good luck,

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller at
    http://www.al-williams.com/awce/pak1.htm



    >
    Original Message
    > From: Jack Scasserra [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=MERyyQUszMxvS9TU9lwQfXQQN_rvz06sa76iMdFwJqdLxA0ZsMsiYAI4msa7HylYfgubuv9Gcf2Lb_5_zww]jscasserra@y...[/url
    > Sent: Sunday, April 16, 2000 12:43 PM
    > To: basicstamps@egroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] SERIN on Temperature Device
    >
    >
    > Al and others,
    >
    > I have tried using the DEC modifier, but do not seem
    > to be getting to far.
    >
    > One of my first questions might be what I should
    > declare the variable as first (T1, T2, T3, etc).
    >
    > When capturing the eight readings, they are separated
    > by a space, and any one value can range from -55.0 to
    > 125.9 - will this present more of a problem for me?
    >
    > I am quite lost right now, so assistance is really
    > appreciated.
    >
    > --- Al Williams <alw@a...> wrote:
    > > SERIN is very versitile. I don't know what the funny
    > > characters are between
    > > the numbers, but SERIN will read a number until it
    > > hits some unknown
    > > character if you use the DEC modifier.
    > >
    > > So if baud is the right baudmode constant, and pin
    > > is the right pin:
    > >
    > >
    > > tmp var word
    > > SERIN pin, baud, [noparse][[/noparse]dec tmp]
    > >
    > > At 2400 baud you might be able to read one do
    > > something and then come back
    > > around. At high speeds, you have to read everything
    > > in one swoop because the
    > > overhead is significant enough that you will lose
    > > characters if you don't.
    > >
    > > For example:
    > > SERIN pin, baud, [noparse][[/noparse]dec t1, dec t2, dec t3]
    > >
    > > Hope that helps. The Stamp manual has several
    > > examples of this under SERIN.
    > >
    > > Regards,
    > >
    > > Al Williams
    > > AWC
    > > * Floating point math for the Stamp, PIC, SX, or any
    > > microcontroller at
    > > http://www.al-williams.com/awce
    > >
    > >
    > > >
    Original Message
    > > > From: Jack Scasserra [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=MERyyQUszMxvS9TU9lwQfXQQN_rvz06sa76iMdFwJqdLxA0ZsMsiYAI4msa7HylYfgubuv9Gcf2Lb_5_zww]jscasserra@y...[/url
    > > > Sent: Sunday, April 16, 2000 8:15 AM
    > > > To: basicstamps@egroups.com
    > > > Subject: [noparse][[/noparse]basicstamps] SERIN on Temperature Device
    > > >
    > > >
    > > > I am new to the Stamp list, and BasicStamps. My
    > > first
    > > > real project is to read data from a serial
    > > temperature
    > > > sender and display that information on an LCD
    > > display.
    > > >
    > > > The serial data comes from the temperature
    > > controller
    > > > at 2400 baud, in this format:
    > > >
    > > > 22.3 6.7 –1.6 18.2 –99.9 –99.9 –99.9 –99.9
    > > >
    > > > I want to use SERIN to get the data into eight
    > > > variables, but do not understand how. My first
    > > problem
    > > > is that each temperature reading is not of equal
    > > > length.
    > > >
    > > > Does anyone have hints on how to do this?
    > > >
    > > > Jack
    > > >
    > > >
    > > > __________________________________________________
    > > > Do You Yahoo!?
    > > > Send online invitations with Yahoo! Invites.
    > > > http://invites.yahoo.com
    > > >
    > > >
    > >
    > >
    > >
    > >
    > >
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Send online invitations with Yahoo! Invites.
    > http://invites.yahoo.com
    >
    >
Sign In or Register to comment.