9-bit seriel
hello,
as asked in this topic need doing 9-bit serial arduino uno. can see in topic, cr0sh helped find code in atm328 datasheet doing 9-bit serial. questions didn't answered:
1. use serial.println( data ); ?:
2. , serial.read(); ?:
both codes directly pasted atm328 datasheet.
jan
as asked in this topic need doing 9-bit serial arduino uno. can see in topic, cr0sh helped find code in atm328 datasheet doing 9-bit serial. questions didn't answered:
1. use serial.println( data ); ?:
code: [select]
void usart_transmit( unsigned int data )
{
/* wait empty transmit buffer */
while ( !( ucsrna & (1<<udren))) )
;
/* copy 9th bit txb8 */
ucsrnb &= ~(1<<txb8);
if ( data & 0x0100 )
ucsrnb |= (1<<txb8);
/* put data buffer, sends data */
udrn = data;
}
2. , serial.read(); ?:
code: [select]
unsigned int usart_receive( void )
{
unsigned char status, resh, resl;
/* wait data received */
while ( !(ucsrna & (1<<rxcn)) )
;
/* status , 9th bit, data */
/* buffer */
status = ucsrna;
resh = ucsrnb;
resl = udrn;
/* if error, return -1 */
if ( status & (1<<fen)|(1<<dorn)|(1<<upen) )
return -1;
/* filter 9th bit, return */
resh = (resh >> 1) & 0x01;
return ((resh << 8) | resl);
}both codes directly pasted atm328 datasheet.
jan
likely, yes - limitation able transmit , receive integer value (unlike serial library).
note haven't played of code, nor understand how works; working directly single uart on atmega, , usb serial stuff in way, have disable (ie, route around it) - losing bootloader access (you'd want use icsp uploading code - means need familiar that, , either second arduino or avr isp device upload hex code).
i ran across code while browsing datasheet else, remembered post, , posted it.
hope helps...

note haven't played of code, nor understand how works; working directly single uart on atmega, , usb serial stuff in way, have disable (ie, route around it) - losing bootloader access (you'd want use icsp uploading code - means need familiar that, , either second arduino or avr isp device upload hex code).
i ran across code while browsing datasheet else, remembered post, , posted it.
hope helps...

Arduino Forum > Forum 2005-2010 (read only) > Software > Development > 9-bit seriel
arduino
Comments
Post a Comment