Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The parity bit that this is referring to is a bit in an on-chip transmit control register. This register has to be modified to cause the chip generated parity bit to be set to indicate an address byte. And then be modified again to turn off address-mode.

My guess is the Device::SerialPort module doesn't use it's parity argument for this purpose.

Of course it does not. It becomes obvious when you read the POD of Device::SerialPort:


One of the following: "none", "odd", "even".

To use the parity bit for non-parity purposes, you would need other values, e.g. "mark" and "space" or simply "0" and "1".

Also, parity() is one of the configuration parameter methods, not an operating method. It is not clear if changing the parity at operation time is supported:

Some individual parameters (eg. baudrate) can be changed after the initialization is completed. These will be validated and will update the serial driver as required.

Just to see an alternative implementation of a non-PC USART, here is a part of the documentation for the SERCOM peripheral of the Atmel/Microchip SAM D21 in USART Mode. It is also available in other SAMs, like the L21 and the D5x/E5x:

USART Features

  • Full-duplex Operation
  • Asynchronous (with Clock Reconstruction) or Synchronous Operation
  • Internal or External Clock source for Asynchronous and Synchronous Operation
  • ...
  • Supports Serial Frames with 5, 6, 7, 8 or 9 Data bits and 1 or 2 Stop bits
  • Odd or Even Parity Generation and Parity Check
  • Selectable LSB- or MSB-first Data Transfer
  • ...

Note that neither mark or space are supported for parity, but you can transfer 9 data bits. The data register is 16 bits wide to support using 9 data bits.

If you want to drive people really mad, you use 9 bit mode with parity enabled and two stop bits. This ends with a line format of 13 bits (1 start + 9 data + 1 parity + 2 stop bits), and only a few other U(S)ARTs will be able to send or receive that format.


Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^6: How to read serial port with WIN32:SerialPort? by afoken
in thread How to read serial port with WIN32:SerialPort? by mastertone

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2022-05-16 09:15 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (62 votes). Check out past polls.