I have this code for I2C Interface.Is this correct for DAC 7678EVm,but I am not getting Output on the DAC Channels. The code takes the data,but how to see any waveform in the Oscilloscope , Please Help.
Please Help me.
#include <wiringPiI2C.h>
#include<wiringPi.h>
#include <stdio.h>
//unsigned char test[2] ={0};
int fd;
int i=4095;
int dID = 0x48;
int main(void){
printf("check1");
int j;
if((fd=wiringPiI2CSetup(dID))<0){
printf("error opening i2c channel\n\r");
return 0;
}
wiringPiI2CWrite(fd,0x80);
wiringPiI2CWrite(fd,0x00);
wiringPiI2CWrite(fd,0x00);
//void digitalWriteByte(0x88);
//void digitalWriteByte(0x40);
sleep(1);
if((fd=wiringPiI2CSetup(dID))<0){
printf("error opening i2c channel\n\r");
return 0;
}
if(wiringPiI2CWrite(fd,(0b00001111))<0){
printf("ERROR 1");
return 0;
}
// for(i=0; i<1000; i++){
while(i--){
if(wiringPiI2CWrite(fd, 0b11110000)<0){
printf("ERROR 2");
}
if(wiringPiI2CWrite(fd, 0b11111111)<0){
printf("ERROR 3");
}
printf("Success: %d \n",i);
for(j=0 ; j<100000; j++);
wiringPiI2CReadReg8(fd,0b00001111);
wiringPiI2CReadReg8(fd,0b11110000);
//sleep(1);
// }
//if((e= wiringPiI2CWrite(fd,23))<0){
//printf("error writing to slave\n\r");
//}else{
//printf("writing hex:0x%i size:%i\n\r",test,sizeof(test));
}
sleep(1);
return 0;
}