sample code A/D, D/A in C programming

Discussion in 'Embedded Systems and Microcontrollers' started by tomnaive, Jan 15, 2009.

  1. tomnaive

    Thread Starter New Member

    Jan 15, 2009
    Hi all,
    I'm new to this forum and PIC18 series too.
    I've read CCS complier but still I cannot figure out how to write A/D, D/A convertion in C program for my PIC18 if the analog signal coming from an anlog phone (i.e. regular analog home phone). Could you please give me some sample codes how to set up ports, timer....
    Thank you!
  2. AlexR

    Well-Known Member

    Jan 16, 2008
    Forget the CCS documentation. If you want to know how to setup the PIC read the PIC18 data sheet appropriate to the PIC you are using. You can download it from the Microchip WEB site.

    There are plenty of examples on the WEB just do a google search for PIC18 ADC.

    The PIC18 may do AtoD conversion depending on the PIC model but not DtoA. You need external hardware to do that.
    Last edited: Jan 16, 2009
  3. futz


    Dec 14, 2008
    Another must-have doc for 18F PICs is the PIC18C MCU Family Reference Manual . It goes over the stuff in the datasheets in more detail. There are some datasheets where certain details got skimmed over or even left out entirely. That information can be found in the Reference Manual.