Shop OBEX P1 Docs P2 Docs Learn Events
Serin question — Parallax Forums

Serin question

Bobb FwedBobb Fwed Posts: 1,119
edited 2008-06-09 23:01 in BASIC Stamp
I have a BS2pe, it checks sensors and controls stuff, but I want it to receive Serial info. The problem is, there is no flow control possible (from a separate device) and the serial info will come at unknown times. Is there any way to get the serial info when it comes?

Obviously I can have it run a Serin between each cycle (which is about 3 cycles per second) and add a timeout of no more than 200ms, but that gives a very small window to hit if the other device is sending info.

What is the easiest/cheapest way to get serial info at random times?

Comments

  • sylvie369sylvie369 Posts: 1,622
    edited 2008-06-06 22:52
    Does the data being sent have any consistent beginning characters? You can use the "wait" function in Serin to have it just sit around "sniffing", as it were, until it detects a code that signals the data you want it to receive. For example, if the data being sent always start with "*DT", use

    serin RX, Baud, [noparse][[/noparse]wait ("*DT"), dec var1, dec var2]
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-06 22:53
    You would have to add an external serial buffer like: www.proteanlogic.com/product_periph_rs232.shtml.

    Post Edited (Mike Green) : 6/6/2008 10:58:32 PM GMT
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2008-06-06 23:08
    There are some prefix data bytes, but I think the buffer is needed either way, huh? Have you used these before?
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-06-08 02:59
    If Mike says you need a buffer, don't listen to me.·smile.gif·· He's right.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2008-06-09 23:01
    I just bought a couple of these, I will try to remember to let you know how it goes.
Sign In or Register to comment.