Hi Ken, The frequency of the PIC18F452 is 40MHz. It is fast enough to drive the I2C devices which is 400KHz. But I may need to have a Timer routine eventually to clock my wave file at a smapling rate of 8KHz. But this is the later part of the project. Now the critical part is to make the DAC function. So I believed that the microcontroller will be fast enough for the I2C devices. The C18 source code is very limited for I2C. Here the site to see: MPLAB. C18 C Compiler Libraries http://www.microchip.com/download/tools/picmicro/code/mplab18/51297b.pdf MPLAB. C18 C Compiler User's Guide http://www.microchip.com/download/tools/picmicro/code/mplab18/51288b.pdf Right now, I am willing to try anything as long as to get the DAC to get working. I am wondering whether is my TRISC initialise wrongly. Am I right to put both SDA and SCL as input (1) for TRISC? Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 PORTC RC7 RC6 RC5 RC4 RC3 RC2 RC1 RC0 TRISC 0 0 0 1 1 0 0 0 SDA SCL Nicholas ----- Original Message ----- From: "Ken Pergola" To: Sent: Saturday, March 20, 2004 12:41 AM Subject: Re: [PIC]:I2C DAC test > Hi Nicholas, > > Another question: is your clock or crystal driving the PIC really 16 MHz as > your comments indicate? > I realize that your comment says 16 MHz, but the reason I'm asking, is > sometimes code comments do not always reflect actual hardware details -- > especially if the hardware is in a state of flux. > > In order to operate according to the PIC18F452's I2C engine spec, the > PIC18F452's Fosc must be 10 MHz minimum to operate at an I2C SCL frequency > of 400 KHz. If you do have a 16 MHz clock or crystal, then you're golden. :) > > The other thing Nicholas: > > Can you supply the actual C source code behind those C18 functions? I hate > not being able to see what's behind the scenes. > I'm tempted to say you might need to use the IdleI2C() function between your > I2C events, but I have never used the C18 compiler or its I2C function > library. Maybe those C18 I2C functions embed use the IdleI2C() within > them -- I don't know. There does not seem to be much documentation in the > PDF link you listed regarding the I2C functions so I share your pain. > > > If you could the questions I posed here (and from my previous post) that > would be great. > > > Best regards, > > Ken Pergola > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.