Shop OBEX P1 Docs P2 Docs Learn Events
BAUD — Parallax Forums

BAUD

PFloyd36069PFloyd36069 Posts: 135
edited 2008-06-14 19:33 in BASIC Stamp
Hi,

Will the BS2 go down to 160 Baud or is 300 actually as low as it will go?

Thanks,

Bryan

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-23 20:37
    The equation for the BS2 'plain' is:

    BS2, BS2e, and BS2pe = INT(1,000,000
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2008-04-30 19:45
    Yeah but will the stamp actually read serial data down to that low baud rate? I tried communicating with something of that baud but all i got was a Zero, and a bunch of 1's.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-30 20:19
    If the baud rates match, AND the BS2 enters the "SERIN" BEFORE the 'sending' device starts sending, then yes it really will go that slow.

    Now, you do have to run a ground wire, as well as the serial wire. And I don't know what device you have that actually talks at 160 baud -- that's a weird rate.
    Usual rates are 50, 110, 300, 600, 1200 (VERY common), 2400, 4800, 9600 (1 mSec per byte, also common), 19200, 38400.

    You may have to add 16384 to the value, to set the "inverted" flag, depending on if you have a Max232 in the circuit or not.

    Post Edited (allanlane5) : 4/30/2008 8:27:00 PM GMT
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2008-04-30 21:22
    Does the input to the stamp need to bo RS-232 or can it be TTL? I am trying to interface my stamp to the ALDL port on my car (thats where the weird baud of 160 came from) and i cant quite figure it out.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-01 01:48
    If you stick a 22 Kohm resistor in series (from the car to the I/O pin) it won't matter. The BS2 has "clipping" diodes on it, which will 'clip' a signal to 0 to +5, as long as you limit the current with something like the 22 Kohm resistor. If the signal is already 0 to +5 volts, it will still work.
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2008-05-30 19:09
    I still cant get this stupid thing to work. maybe the problem is in my code(I will post it), it is probably all screwed up. i dont know why it is coming up with all ones though. i guess im not much of a programmer



    '{$STAMP BS2}
    '{$PBASIC 2.5}

    A···· VAR···· Word
    B···· VAR···· Bit

    FOR A = 0 TO 161
    ··· IF A = 161 THEN
    ····· END
    ··· ENDIF
    ··· SERIN 8, 14422, [noparse][[/noparse]B]
    ··· WRITE A, B
    ··· DEBUG DEC B
    · NEXT
    END
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-30 19:19
    Why are you only reading one single bit at a time? "SERIN" reads bytes really well. I'd never use it for a "BIT".
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2008-05-30 19:23
    you are right that would be kinda stupid wouldnt it. i knew there was stupid stuff wrong with my code like that. so what i am trying to read is 20 words containing 7 bits of data and store it in the eeprom. what do i need to do in my program to make that work correctly.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-30 19:31
    Brute Force:

    MyBuf BYTE(20)

    SERIN <SerPin>, <baudmode>, [noparse][[/noparse]STR MyBuf\20]

    Something like that. This will take 20 of your available 26 bytes of RAM, but you only need it for a little bit.
  • CelticLordCelticLord Posts: 50
    edited 2008-06-14 19:33
    You don't need a conditional.....
    ··· IF A = 161 THEN
    ····· END
    ··· ENDIF
    to check the loop as it will branch out when it comes to the end of the loop. If you wanted to branch out early then a conditional would be needed.
Sign In or Register to comment.