I've done some C programming in the past but only using notepad as an editor, so I'm trying to learn Visual Stuido and C#. I have a i2c device with a gyro, accelerometer and compass all on one chip and for now I just want to be able to read off values from certain registers but am a bit confused as to how the acknowledgements work.(I have read the linked article amoung others but I'm still unclear)
For an example I want to read from slave device (mpu3500 gyro - 7 bit device address 1101000), and read data from its address register 0x1D.
Heres what I think should be happening, it's just a rough outline of what should be happening is it along the right lines?
i2c.start() //start i2c bus
ic2.writebinary(1,1,0,1,0,0,0,0) // send slave address with lsb bit set to write
// slave should send acknowledge bit here, do I need do anything here in the program?
ic2.writebinary(0,0,1,1,1,0,1,0) // address of register with lsb set to write, dummy write.
//again another acknowledge sent from slave?
i2c.start() // Repeated start
ic2.writebinary(0,0,1,1,1,0,1,1) // address of register with lsb set to read
//slave should then send ack then 8 bits of data from register
Master sends ack? how?
Basically I'm confused with the whole acknowledge parts and how these are handled etc.
If anyone could shed some light on the subject I would be very grateful! Am I even on the right tracks?!