Electronic – Reading data from digital pressure sensor (Pressure sensor SPD100GD)

avrclock-speedpressuresensor

We need to read the digital output from a Pressure sensor SPD100GD with an AVR micro (Atmega128). According to the datasheet we must estimate transmission speed.
The datasheet is saying:

The transmission speed depends on the update rate and ranges up to 8 kHz.
The software has to determine the digital output speed by the “Start Bit”.
This Start bit is 50% low and 50% high.
Based on this in formation the speed of the incoming data can be interpreted. The parity is defined as even meaning in case the number of 1’s in the word is even the parity is zero and in case the number is odd the parity bit is 1. Between the high and lower byte there is a stop bit, level 1, with the length of half the data cell (not drawn in picture).

So how we could estimate the transmission speed, and after that – is there any similar C or C++ Code for this kind of digital sensors.

Best Answer

From the data sheet, a single byte on the wire would look like this:

Manchester coded data

I do not believe your UART could decode this, so you may need to resort to bit banging a digital IO pin.

Start at the left; a stop bit is a high for an entire bit period. Wait for a transition to low and measure the time until transition to high. Wait for a transition to low and measure this time.

If those times are equal, this is a start bit. These two measurements added are a bit period.

Now wait for a transition to high - if this time is 75% of a complete bit time and the next transition to low is 25% of a bit time, this is a '0'.

Rinse and repeat - the unit sends 8 bits of data at a time, with the line held high for a complete bit time to indicate a stop bit.