Shop OBEX P1 Docs P2 Docs Learn Events
Timeout parameter with SERIN — Parallax Forums

Timeout parameter with SERIN

paolopaolo Posts: 17
edited 2006-12-19 08:16 in General Discussion
Hi

Is it possible to use SERIN with a word variable for the Timeout parameter?
I've tried to do that with the SX48, but it seems that the compiler·doesn't set the internal parameters __PARAM1 and __PARAM2.

I'm using the SXB Ver. 1.51.03.

Thank you.

Comments

  • BeanBean Posts: 8,129
    edited 2006-12-18 16:11
    No the timeout value can only be a byte. You'll have to put the SERIN inside a loop and use another variable to get a longer timeout.

    Somthing like this:

    timeout1 = 200
    timeout2 = 200
     
    TryAgain:
      DJNZ timeout2,TimedOut
      SERIN ...., timeout1, TryAgain
      ' Here if we received a byte  
     
    TimedOut:
      ' Here if we timed out
    
    


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • paolopaolo Posts: 17
    edited 2006-12-18 17:00
    Thank you Bean for your prompt reply.
    I was confused by the online help which says: "Timeout is an optional byte or word variable/constant...".

    I will try to put SERIN inside a loop, hoping that this way I will not miss any character.

    Paolo
  • BeanBean Posts: 8,129
    edited 2006-12-18 17:21
    Paolo,
    Your right. It should allow a word variable, but it doesn't. I will fix that in the next release.
    Note that you CAN use a word constant for the timeout.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • paolopaolo Posts: 17
    edited 2006-12-19 08:16
    Great! I'll wait for the new revision.
    Thank you.
Sign In or Register to comment.