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

timing question

cplattcplatt Posts: 55
edited 2011-07-10 15:04 in BASIC Stamp
Hello everyone.

My BS2e is polling a Memsic 2125 accelerometer and transmitting the data via an XBee to my laptop. How do I figure out how often can I poll the Memsic before I need to buffer the data stream??? Would the bottle neck be at polling the accelerometer, transmitting at the XBee, or receiving at the laptop? (The raw data is 2000-4000 range, tx and rx at 9600 baud) Thank you!!!

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-07-10 12:23
    Not following you... You are always buffering the data. The BS2e has 38 bytes of RAM. So, you have 38 byes of buffer.

    You're laptop has a comparatively huge buffer but your receive app has to do something with the incoming stream.

    The XBee has buffers too...
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-07-10 12:24
    It wouldn't be the Stamp.
    As it's single-threaded, it reads the accel., then SEROUTs its data, it can't do both simultaneously, so there's no bottleneck there.
  • cplattcplatt Posts: 55
    edited 2011-07-10 13:13
    Sorry guys, I am a nub and I will try better. I cannot poll the accelerometer every 1 ms with the stamp can I? The stamp must take some time to process the information. For example with a stopwatch you time this simple loop:

    for i=i+1
    debug dec i
    next

    it takes about 2ms to execute per cycle (2000 cycles per minute) So basically what I am asking is what would the pause be here:

    PULSIN x,y,data 'data from accelerometer
    pause x
    SEROUT x,y,data 'data to be transmitted
    pause x

    to receive a data stream at the hyperterminal of the laptop without missing any numbers?
    thank you!!
  • Mike GMike G Posts: 2,702
    edited 2011-07-10 15:04
    Like PJ said the STAMP is single-threaded. The STAMP can only do one thing at a time.

    PULSIN waits for a transition; HIGH to LOW or LOW to HIGH. SEROUT sends serial data. Placing a pause between commands does not make much sense. For example, execution waits until the PULSIN command sees a state change, we PAUSE a bit, send some data, and PAUSE a bit.

    Please read about the PULSIN and SEROUT commands in the help file.

    Are you having a problem? Are you missing numbers?
Sign In or Register to comment.