Nicholas wrote: > 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? Hi Nicholas, I don't see anything wrong. You are doing things correctly as far as setting SDA and SCL as inputs via the TRISC register. Do you have any oscilloscopes in the lab? I don't know if you know how to use one, but if not, someone in the lab should be able to help you out. After you ensure that your "tin can" 40 MHz clock oscillator is connected to the PIC's OSC1/CLKI pin (by probing this with a 'scope as well), you could probe the SCL line to see if you see it toggling. But in this case, you would want to put your DAC write function in an infinite loop. If you have not, it would be a good idea to embed your PIC18F452 Configuration Bit settings in your C source code. I have not used Microchip's C18 C compiler, but you should look up in the manual to see how this is done. I'm guessing there should be some type of CONFIG directive in C18. Perhaps a scan in the table of contents or index will help you. On Monday, send me your HEX file and a screen shot of your Configuration Bit settings in MPLAB. I can't stress this enough: --------------------------- If your configuration bit settings are not set correctly (especially with regard to the oscillator settings), then your microcontroller most likely will not run. You will need to use the EC or ECIO oscillator type setting with regard to the FOSC2, FOSC1, and FOSC0 configuration bits because you are using a 40 MHz external "tin can" clock oscillator. We have to make sure you are on track in this regard before proceeding to other levels of troubleshooting. Best regards, Ken Pergola -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body