Home › Forums › Raspberry Pi Compatible Compiler for LabVIEW Forum › Raspberry Pi Compatible Compiler for LabVIEW Support Forum › issue with I2C_Write Block Data
I need help with writing data to an I2c device.
I want to control 0-10V output with an D/A device. The board is contolled by an PIC 18F13K22 microcontroller which enables the comminication with an 4 channel MCP4812 D/A converter via the I2c bus. The resolution is 10 bit and with an OP it is possible to get an output between 0-10V.
With my Python script running on the pi everything is fine and it works perfect:
bus = smbus.SMBus(1)
aout = 1023
Hby = int (aout / 256)
LBY = int (aout – Hby * 256)
field = [LBY, Hby]
bus.write_i2c_block_data (0x58, 0x00, field)
aout is the output voltage, the I2C address is 0x58 and the Labview example give back the correct address. 0x00 means channel 1 on the D/A bord.
But Iam not able to write Hby byte and the LBy.
I tried everything without success.
Do have anyone an idea to write the correct data to the I2C device ? May be with an simple example ?
Any help is welcome….
Hi….Are the high and low-level voltages on SDA and SCL correct during I2C transfers? The I2C standard defines the low-level threshold with 0.3 Vcc, the high-level threshold with 0.7 Vcc. Modifying the termination resistance Rp, the serial resistors Rs or lowering the SCL clock rate could help here.
Hi…. Thank you very much for your reply.
If I run the Python script as you can see above on the PI, everything is working correctly. So I think it is not an elecrtical problem (with Pull up or pull down resitances).
My problem is that I can I am not able to create an Labiew VI runnining on the PI which do the same as the Python script.
The I2C address 0x58 is correctly recognised within the I2C_Detct.vi but writing data with byte I2C_WriteByte.vi or I2C_WriteBlock.vi show no success.
I need help for an VI which writes data to the I2C device the same as the python script does.
Any suggestions are welcome…. I could not find any solution until now….
You must be logged in to reply to this topic.