Shop OBEX P1 Docs P2 Docs Learn Events
serial communications — Parallax Forums

serial communications

Doug ShaveDoug Shave Posts: 2
edited 2005-07-22 18:12 in BASIC Stamp
hello all,
I am working on a project with the basic stamp, I have multiple temp sensors on the stamp that I am reading using the 1-wire protocol; however, I also want to read serial input from another device.· My question is:
···· I am trying to get serial data into the stamp, but I am unsure about the timing.·
·The device I am using has 9600 baud, n, 8, 1.· How would I go about getting the data without any losses.
and is there a way to poll the data every so often to refresh it.

thanks,
Doug

Comments

  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2005-07-21 16:31
    Would dumping the data to a serial LCD help? What Stamp are u using? Can you inititiate communication, will it wait for you to talk to it first or do you need to be listening all the time? If you need a buffer that the stamp could read when it's ready, you would have to build one. Depending on the stamp you have, 9600 baud could be a bit of a challenge. Check out the SERIN help in the BS2 editor HELP.Can you use another Stamp to handle that communication? I haven't Googled it yet but there may be a hardware soultion on the web.
    ·What about this device? http://www.gaoresearch.com/onlinestore/index.php?main_page=product_info&products_id=49

    Post Edited (Philip Gamblin) : 7/21/2005 4:39:36 PM GMT
  • Larry~Larry~ Posts: 242
    edited 2005-07-21 16:48
    If this secret device is just pumping out data then I would try
    ·
    Serin pin, 16468,[noparse][[/noparse] use String or ]
    Serin pin, 16468,[noparse][[/noparse]byte1,byte2- byte8,byte9]
    OR
    Serin pin, 84,[noparse][[/noparse] use String or ]
    Serin pin, 84,[noparse][[/noparse]byte1,byte2- byte8,byte9]
    ·
    And then do a debug out take a look at what shows up
    Not knowing what the data is and how much will be showing up will be your major problem
  • Doug ShaveDoug Shave Posts: 2
    edited 2005-07-22 17:24
    Thank you for your reply's gentlmen.

    I am using the BS2p basic stamp, as far as the device that I am trying to attach to the stamp it is a pulse oximeter.· I am concerned with 3 bytes of data.· The first byte being the status, Second byte the heart rate, and the third byte is the (Oxygen level) Spo2. These 3 bytes are transmitted once per second.

    Packet description:

    Byte-1······················ Byte-2················· Byte-3

    bit7 = 1····················· = 0····················· ·= 0

    bit6 = snsd················ =· hr6··················· = sp6

    bit5 = oot················· = hr5····················· =sp5

    bit4 = lprf················· = hr4······················=sp4

    bit3 = mprf··············· = hr3······················ =sp3

    bit2 = artf················ = hr2······················ =sp2

    bit1 = hr8················ = hr1······················ =sp1

    bit0 = hr7················ =hr0························=sp0·



    thanks again for the help
  • YanroyYanroy Posts: 96
    edited 2005-07-22 18:12
    it seems to me that the best way to do it would be to have your SERIN read in 5 bytes of data (you're guaranteed to get a complete 3-byte sequence that way) and then look for the byte with the high-bit set and treat that as the start, using that byte and the next two.· This will cause a delay in your program of up to 2 seconds, however.· If you're able to do your other processing in less than a second, you could just do a serin for 3 bytes and if you synchronize it properly when the program first starts, it will stay synchronized.· That method will be trickier.
Sign In or Register to comment.