even paraty setup

stefstef Posts: 173
edited 2011-09-10 - 02:06:00 in Propeller 1
Hi

I always use the Fullduplex.spin for serial comunication. It is working fine. Now I need to interface to a device that has specification 2400,8,E,1.

The baud rate is not a problem to set up.

How do I specify the E (Even parity)??

Stef

Comments

  • AribaAriba Posts: 2,209
    edited 2011-09-07 - 22:08:58
    Hi Stef

    Search for "FD_Serial_Conf.spin" in the forum, this object should do what you want.

    Andy
  • Mike GreenMike Green Posts: 22,856
    edited 2011-09-07 - 22:25:54
    You can use FullDuplexSerial by computing the parity yourself and adding it into the 8-bit value you're sending. For transmitting a 7-bit character CH with even parity, do:
    FDS.tx((CH & %1111111) | (((CH<<1) ^ (CH<<2) ^ (CH<<3) ^ (CH<<4) ^ (CH<<5) ^ (CH<<6) ^ (CH<<7) ^ %10000000) & %10000000))
    On receive, you'd do a similar calculation, but compare the result with what was actually received.
  • stefstef Posts: 173
    edited 2011-09-08 - 08:44:15
    Tanks to all

    I'm going to try it out.

    Stef
  • Heater.Heater. Posts: 21,213
    edited 2011-09-08 - 09:02:59
    Wait a mintute. I thought 8,E,1 meant 8 Data bits plus 1 parity bit plus 1 stop bit. So putting the parity bit into the top bit of the 8 bits of data does not do what you want.
  • Mark_TMark_T Posts: 1,884
    edited 2011-09-08 - 09:15:32
    I think 8, E means 8 bits including even parity, 8+parity would mean 9 bits...
  • Heater.Heater. Posts: 21,213
    edited 2011-09-08 - 09:32:09
    Ok. I'm confused. If the parity bit is in the 8 data bits would that not really be 7 data bits plus 1 parity bit or "7,E,1"?
  • kwinnkwinn Posts: 8,178
    edited 2011-09-08 - 20:04:22
    Heater is right. 2400,8,E,1 would be 2400 baud, 1 start bit, 8 data bits, 1 even parity bit, and 1 stop bit for a total of 11 bits.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • BEEPBEEP Posts: 58
    edited 2011-09-10 - 02:06:00
    "For example, a frame that uses seven data bits, even parity, and one stop bit is abbreviated 7E1, and one that uses eight data bits, no parity, and one stop bit is abbreviated 8N1."

    http://www.freeopenbook.com/pc-hardware-nutshell-2/pchardnut2-CHP-22-SECT-1.html
Sign In or Register to comment.