Pages: [1]   Go Down
Author Topic: Serial protocol ?  (Read 555 times)
0 Members and 1 Guest are viewing this topic.
Kansas City, MO
Offline Offline
Jr. Member
**
Karma: 0
Posts: 71
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From looking at the SDI-12 protocol it states the following with regards to the data:

1 start bit
7 data bits, least significant bit transmitted first
1 parity bit, even parity
1 stop bit

From looking at some other posts I see you should be able to change the bits and parity by using the following:

UCSR0C = (2<<UPM00)|(0<<USBS0)|(2<<UCSZ00)|(0<<UCPOL0); // configure for 7E1 not 8N1

My question has to do with the LSB transmitted first part. Is this standard in a typical Serial.print command or would I have to format the serial data differently before sending out the serial lines? and the corresponding receive?

Any help would be greatly appreciated. And yes, I'm aware that SDI-12 is completely different from RS232 as far as how the tx/rcv lines are set up. I just need to make sure the data is going out and being received correctly.

Thanks!!
« Last Edit: August 01, 2012, 10:28:16 am by vogel1230 » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My question has to do with the LSB transmitted first part. Is this standard in a typical Serial.print command or would I have to format the serial data differently before sending out the serial lines? and the corresponding receive?

If that question means: Is the ATmega328's USART sending a bit LSB first? That answer is: yes.

If your hardware is doing the inversion (in SDI-12 1 means 0V and 0 means 5V, page 3 of http://www.aquatrak.com/Downloads/SDI-12_version1_3.pdf) you should be fine.
Logged

Pages: [1]   Go Up
Jump to: