I'm trying to interface a SensorTechnics pressure sensor to a Mega. The device is a SSIB001GU9AH5 0-1bar stainless steel housed pressure sensor, seemingly ideal (if a little expensive @£80) for what I need.
It's i2c capable, but also has a analogue voltage out. I'd like to us the i2c function as (if I can get it working) because ultimately I'd like an array of the units.
Attached are the datasheets that I've managed to track down. In one of these there is the code snippet below, which I'm guessing is C ??, but as a Arduio beginner I'm finding it hard to follow/translate this into something I can use on the Arduino.
The datasheet also specifies that the device needs 1.5 K Ohm pullup resistors on from the 5v supply as well as 240 Ohm resistors on the SDA\SCL lines
My question is two fold:
1) Can anyone help me to understand this code and how to get it working?
2) Does the Arduino already have these pullup resistors on the SDA & SCL lines?
I wondered if this might be a device that could be added to the Arduino library....
byte byte_msb, byte_lsb; // 8bit values
int16 pressure; // 16bit value
// Set I2C unit to I2C master mode, clock speed 100 kHz and 7 bit addressing
configureI2C (I2C_MASTER | CLK_SPEED_100KHZ | ADDRESSING_7BIT);
// Set the target address of the sensor (0x78 = 120dec)
// Send start condition for reading from sensor (slave)
// Read first (MSB) data byte and answer with ACK (continue communication)
I2C_read (&byte_msb, SEND_ACK);
// Read second (LSB) data byte and answer with NACK (end communication)
I2C_read (&byte_lsb, SEND_NACK);
// Send Stop condition
// Put both values together
pressure = ((int16)byte_msb << 8) | byte_lsb;