Hi,
i am struggling with serial communication that uses 11 bits, 1 start, 8 data, 1 mode and 1 stop bit. The default is 1 pairity bit instead of the mode bit, but it seems i cant set this bit by myself.
Is there any way /library for sending custom length serial data?
i found sth like that with registers etc, but with this sollution i would be forced to use a toolchain and raw c code with my mega, but i want to use the .ino files since i have a lot of other stuff to do also, stepper motors etc.
wouldnt be sending just another bit in the write method be enought? since its just a matter of setting tx high or low once again
You really, really need to consult the ATMega328 data sheet (or the one for whatever processor you are using).
From the data sheet:
20.6.2 Sending Frames with 9 Data Bit
If 9-bit characters are used (UCSZn = 7), the ninth bit must be written to the TXB8 bit in
UCSRnB before the low byte of the character is written to UDRn. The following code examples
show a transmit function that handles 9-bit characters. For the assembly code, the data to be
sent is assumed to be stored in registers R17:R16.
Tarcontar:
but how do i write then 9 bits of data, simply write a uint16_t instead of an uint8_t?
You don't need 9 bits of data, at least that is not what you said in the first post. Your mode bit of 1 followed by a stop bit is the same as two stop bits. Or you can have one stop bit and a parity bit.