I have an I2C device that I know the address is 0x70 (probed when connected to Raspberry Pi using i2cdetect -y 1). My issue is that the bytes I want to look at need to be called in WiringPi. The output string is seven bytes long and WiringPi looks at the device address and then looks at the byte address I want to read. That being said, would the addressing look like
That being said, would the addressing look like:
Device Addr.= 0x70: First Byte Addr.= 0x01 ----or---- First Byte Addr.=0x71
Does the address need a 'new' address identification (starting from 1) or does the address number get 'appended' (yes, I use that loosely) to the device address?New Information: I found this documentation after sifting deeper: Upgrade Guide and Short Communication Guide
Device AddrIt seems that from the upgrade sheet the slave's internal address for the address byte is 0xE0 for write.= 0x70 The command byte I want to use the command(#3.5): First Byte Addr 0b000001100 (which I assume in hex is: 0x0C).= 0x01 ----or---- First Byte Addr It then seems that the address byte for read is 0xE1.=0x71 From this point how would I read from the data bytes since their registers aren't explicitly shown (look at the Upgrade Guide)?
Does the address need a 'new' address identification (starting from 1) or does the address number get 'appended' (yes, I use that loosely) to the device address?Here is my current code in WiringPi (C++):
#include <iostream>
#include <errno.h>
#include <wiringPiI2C.h>
using namespace std;
#define SLAVE_ADDR 0x70
#define DEV_ADDR_W 0XE0
#define DEV_ADDR_R 0XE1
#define DEV_COMMAND 0X0C //GET STATUS
int main(){
int fd,writeRes,comm_res,readRes;
fd=wiringPiI2CSetup(SLAVE_ADDR);
cout<<"Initial Result: "<<fd<<endl;
for(int i=0;i<1;i++){
writeRes=wiringPiI2CWriteReg8(fd,DEV_ADDR_W,0);
cout<<"Write to Address(write): "<<writeRes<<endl;
comm_res=wiringPiI2CWriteReg8(fd,DEV_COMMAND,0);
cout<<"Slave Command Acknowledge: "<<comm_res<<endl;
readRes=wiringPiI2CWriteReg8(fd,DEV_ADDR_R,0);
cout<<"Write to Recieve Data: "<<readRes<<endl;
int readD_1=wiringPiI2CReadReg8(fd,0x0D);
cout<<"Data 1, VOC= "<<readD_1<<endl;
}
return 0;
}