How to communicate with multiple I2C devices within one session?
2 views (last 30 days)
On my board there are two I2C devices: an ADC and a DAC. They are connected via one I2C bus and there are no base address conflicts. Via an Aardvark adapter and the ICT, I want to communicate with the devices within one session. What is the best way to create two I2C –object instances?
dac = i2c('aardvark',0,16);
adc = i2c('aardvark',0,76);
fwrite(dac,[bias 00 00])
%write control register of adc: not continuous, convert v1 v2 v3 v4
%write trigger register to start
fwrite(adc,0); status = ['status : ' dec2bin(fread(adc,1))]
Doing it is similair to GPIB session with multiple instruments . However it generates an error:
Error using i2c/fopen (line 82)
Unsuccessful open: Cannot connect to the device. Possible reasons are another
application is connected, a driver is missing or the device is not available.
Error in aardvarktest2 (line 24)
Communication to each device separately is successful . But two devices in one session does not work. Anyone an idea how to communicate with two I2C devices in one session?