Go Down

Topic: Serial protocol ? (Read 591 times) previous topic - next topic

vogel1230

Aug 01, 2012, 05:18 pm Last Edit: Aug 01, 2012, 05:28 pm by vogel1230 Reason: 1
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!!

pylon

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.

Go Up