View previous topic :: View next topic |
Author |
Message |
soundscu
Joined: 29 Jun 2007 Posts: 62 Location: Raleigh, NC
|
switching between 8 and 9 data bits for usart tx |
Posted: Mon Mar 31, 2008 2:48 pm |
|
|
I need to send usart messages to multiple destination devices, switching between two different data formats: either (a) 38400 bps with 8 data bits, or (b) 250000 bps with 9 data bits. I'm using enable lines on two different hardware drivers to direct each format out a different physical port. Obviously, only one format will be in use at any given time, but the application will be switching back and forth quite rapidly.
Looking at the documentation for the setup_usart() function, there does not appear to be a parameter for selecting 8 or 9 data bits. Will I need to poke the usart config bits with a custom function, or is there an undocumented parameter or function for doing this?
The #use_rs232 directive provides support for 8 or 9 data bits, but I need to change this parameter on the fly, between data packets.
Thanks for your help,
Jim |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 01, 2008 12:07 pm |
|
|
Quote: | Will I need to poke the usart config bits with a custom function ? |
Yes. |
|
|
John P
Joined: 17 Sep 2003 Posts: 331
|
|
Posted: Tue Apr 01, 2008 1:35 pm |
|
|
Sounds like someone is playing with DMX-512.
It ought to be possible to set up the system to use 9 data bits, then any time you only want to send 8, just set the 9th bit high. Then the receiving unit will think it was a character with 2 stop bits, or simply a pause between characters. Does that count as a "custom function"? |
|
|
|