Hi, You are using AckI2C calls. I suppose you are trying to wait for the acknowledge bit, but the micro does the job for you. This function is intended to *generate* an ack bit, not wait for it. Replace this functions with IdleI2C(), to make it wait until the bits are sent. This code will give you a staircase voltage in DAC0, at least in a MAX518. The difference between the chips is minimal. Rafael #include "p18f252.h" #include "i2c.h" #define strobe LATCbits.LATC2 unsigned char contador; unsigned char loop1; unsigned char loop2; unsigned char loop3; void main(void) { TRISCbits.TRISC2 = 0; TRISCbits.TRISC3 = 1; TRISCbits.TRISC4 = 1; contador=0xAA; SSPADD = 0xFF; OpenI2C(MASTER, SLEW_OFF);// Initialize I2C module while(1) { strobe=1; while( loop1<250 ) loop1++; strobe=0; while( loop1<250 ) loop1++; while( loop1<250 ) loop1++; while( loop1<250 ) loop1++; // genera la condicion de start (send start) StartI2C(); // envia direccion (send chip address) IdleI2C(); WriteI2C( 0x5E ); // envia comando (send command) IdleI2C(); WriteI2C( 0x0 ); // envia datos (send data) IdleI2C(); WriteI2C(contador); // genera la condicion de stop (send stop) IdleI2C(); StopI2C(); IdleI2C(); // espera un tiempo (wait) loop1=0; while( loop1<5 ) { loop2=0; while( loop2<2 ) { loop2++; } loop1++; } contador++; if (contador>254) contador=0; } } > Here is my source code: > #include > #include > > file://function prototype > void MAX517(unsigned int channel); > > void main(void){ > > char data_DAC; > > file://init condition > TRISC = 0X1A; file://Set SDA & SCL as 1. Activate I2C port > > OpenI2C(MASTER, SLEW_ON); file://Initialize I2C module > SSPADD = 9; file://400KHz Baud clock (9) @16MHz > > while(1){ file://Start condition > data_DAC = 0xFF; > MAX517(data_DAC); file://Write data to I2C DAC > }//end of while > }//end of main > > void MAX517(unsigned int channel){ > StartI2C(); file://Start condition > WriteI2C(0x58); file://Address byte of DAC > AckI2C(); file://Ack > WriteI2C(0x00); file://Command byte > AckI2C(); file://Ack > WriteI2C(channel); file://Output Data > AckI2C(); file://Ack > StopI2C(); file://Stop condition > }//end of MAX517 funtion > > Nicholas > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads