SDI-12 communication
danielreis
Posts: 16
Hi guys,
I need to communicate with a sensor that communicates using SDI-12 protocol:
. 1200 baud
. 1 start bit
. 7 data bits, least significant bit first
. 1 parity bit, even parity
. 1 stop bit
How can I configure to send and receive commands with that configuration in propeller?
With the BS2pe, I use the value $432a for SDI-12 communication in "serin" and "serout" commands, but I don't know how to make that configuration using the propeller.
Can somebody help me?
Thanks,
Daniel Reis
I need to communicate with a sensor that communicates using SDI-12 protocol:
. 1200 baud
. 1 start bit
. 7 data bits, least significant bit first
. 1 parity bit, even parity
. 1 stop bit
How can I configure to send and receive commands with that configuration in propeller?
With the BS2pe, I use the value $432a for SDI-12 communication in "serin" and "serout" commands, but I don't know how to make that configuration using the propeller.
Can somebody help me?
Thanks,
Daniel Reis
Comments
This is used to process the 7 bit values for transmission (adding even parity):
This is used to check even parity:
I haven't tested this, but feel like it should work. Hope this helps.
Jonny, I tried to use your code but it didn't work, and I couldn't find what's the error
Mike, I'm having trouble to implement your code. I think that my problem is to understand better how the communication happens. How can I send all my "packet" of bits through the pin? The parity bit is the LSB?
There are several asynchronous serial I/O drivers available. The easiest to understand is either "Simple Serial" or the serial I/O routines in "BS2 Functions", both downloadable from the Propeller Object Exchange.
If you need buffered I/O, you can use "FullDuplexSerial" which comes with the Propeller Tool and also is downloadable from the Object Exchange.
These drivers act as a UART and take care of shifting out (and shifting in) the data as well as the timing of the bits.
The routines I posted are used for pre-processing your data to generate the parity bit for transmission (and make a 7-bit value into an 8-bit value including the parity bit) or to check the parity bit on reception.
I will try to use your code and post here the results.
Thank you!