Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-03

Serial port parity...

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mihai Rainer

Hello,

Is there eny chance to handle the parity bit for serial port communication?
I am using a 9 bit communication with a device and I need to control the 9th bit.
I tried synaser. It dows not handle parity for MARK/SPACE. I have written a procedure to count bits in a byte and config the port for EVEN/ODD parity acordingly to have the parity bit as I need. It is working, but, I have to insert a 2ms delay after each byte sent for settling serial port on each parity mode change. It is working fine except that 2ms will trigger the timeout procedure on the serial equipment. So, I need to control parity bit on the fly. Any chance to do that without building a serial interface with a uC?

I am using Ubuntu with FPC 2.2.4.

Thank you very much and best regards,
Mihai

Henry Vermaak
to Mihai Rainer
Mihai Rainer wrote 16 lines
Hello, Is there eny chance to handle the parity bit for serial port communication? I am using a 9 bit communication with a device and I need to control the 9th bit. I tried synaser. It dows not handle parity for MARK/SPACE. I have written a procedure to count bits in a byte and config the port for EVEN/ODD parity acordingly to have the parity bit as I need. It is working, but, I have to insert a 2ms delay after each byte sent for settling serial port on each parity mode change. It is working fine except that 2ms will trigger the timeout procedure on the serial equipment. So, I need to control parity bit on the fly. Any chance to do that without building a serial interface with a uC?

Read `man termios` (see the CMSPAR, PARENB, PARODD flags). You can probably modify synaser, or just call tcgetattr/tcgetattr yourself (these are in unit termio.pp). Note that this is not supported on all hardware.

Henry