Shop OBEX P1 Docs P2 Docs Learn Events
SEROUT 9600 8E2 — Parallax Forums

SEROUT 9600 8E2

Hello

I was wondering if it is possible to do 9600 8E2 with the serial command?

if so how?

it seems to be set to 8N1 or 711

this is what I was sending

SEROUT 10, $8000+240, [$FE,$FE,$FE,$05,$04,$00,$05,$0D,$E5]

regards

Jeff

Comments

  • JonnyMacJonnyMac Posts: 9,156
    edited 2017-01-19 21:02
    Can you do parity with 8 bits? I'm not sure you can (because the 8th bit IS the parity bit).

    If you are looking for extra time between bytes, you can use the optional pace parameter of SEROUT.

    In my BASIC Stamp 2 template I have a conditional section that handles details -- I edited for 9600 baud, even parity
    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        T1200       CON     813
        T2400       CON     396
        T4800       CON     188
        T9600       CON     84
        T19K2       CON     32
        T38K4       CON     6
      #CASE BS2SX, BS2P
        T1200       CON     2063
        T2400       CON     1021
        T4800       CON     500
        T9600       CON     240
        T19K2       CON     110
        T38K4       CON     45
      #CASE BS2PX
        T1200       CON     3313
        T2400       CON     1646
        T4800       CON     813
        T9600       CON     396
        T19K2       CON     188
        T38K4       CON     84
    #ENDSELECT
    
    SevenBit        CON     $2000
    Inverted        CON     $4000
    Open            CON     $8000
    
    Baud            CON     T9600 | SevenBit
    
    You can add the pacing like this:
      SEROUT Sio, Baud, 1,  [$FE,$FE,$FE,$05,$04,$00,$05,$0D,$E5]
    
    You'll get 1ms between bytes -- hopefully, your device will be okay with this.
  • Now that I look at your data -- you can't use 7-bit transmission because some of your bytes have bit7 set.

    What are you sending the data to?
  • Well, I originally coded it in assembler, which worked fine, since I just used a logic scope and converted the signal to high/low with delays, but I recently used the c version of prop, used the serial.h, but couldn't match the signal, so since basic stamp seemed to allow more flexibility, I switched over, but still couldn't match the signal, then I checked ,some old notes and they used 8E2, 9600, so I just thought it there was a,way I could get rid of all the assembler code, easier to read. Could I use a uart?, and then have more options? The signal is exactly 10.44 ms long and sends the 9 bytes above, I also tried us delays between bytes but got no return data,

    I'll add a logic trace of the working signal tomorrow.

    Regards

    Jeff
  • kwinnkwinn Posts: 8,697
    edited 2017-01-20 03:01
    I'm almost 100% certain that you could do 8 bits with parity, which made for a minimum of 11 bits (1 start + 8 data + 1 parity + 1 stop bit) on some of the older uart chips. That 11 bit times per character requirement sticks in my memory even though I can no longer recall the specific application any longer. A bit frustrating that, but a lot of bits have passed under the bridge.

    EDIT Of course 8E2 would be 12 bits.
  • yes, 8E2 is 12 bits, so can basic stamp or propeller do 12 bits? (or even the sx microprocessor) I like the propeller and parallax hardware and really don't want to add additional HW or microprocessors, all other functions for interfacing work fine, this is the last issue.

    regards

    jeff
  • kwinnkwinn Posts: 8,697
    Jkane wrote: »
    yes, 8E2 is 12 bits, so can basic stamp or propeller do 12 bits? (or even the sx microprocessor) I like the propeller and parallax hardware and really don't want to add additional HW or microprocessors, all other functions for interfacing work fine, this is the last issue.

    regards

    jeff

    For sure the Propeller can do 12 bits but it would require changing the pasm code to add the parity bit and a second stop bit.
  • Tracy Allen helped me modify his four port serial driver, written in Spin/PASM, to use even parity on one channel. I'll see if I can find a link to the forum thread discussing this modification.
  • Here's the thread where Tracy kindly (as usual) helped me figure out how to add even parity.

    I attached a version of the driver to this post.

    The driver can be used from multiple objects and cogs. Just make sure and only call "Init" and "Start" from a single object and cog.

  • Hello, well I temporally went to another microprocessor to validate the return data from the device, but it is messy, adds to much complexity for the needed result, so I'm back I'll test your suggestions.
    thank you for your help, from what I read, it should work fine, regards Jeff
Sign In or Register to comment.