PIC Programming in C

Thread Starter

MCU

Joined Feb 8, 2009
3
Hey all

I was wondering if I could get some opinions or suggestions relating my project . I am trying to interface a PIC into my circuit where it recieves 8 bit digitized input (From a separate ADC) . The PIC reqiures to perform a DAC every T minutes (Log) and save it into SD card (txt file , Time and D/A value). Does anyone know good resources to develop a code for performing D/A in C . And what family of PICs would be the ideal choice. I have PIC18F242 or 18F452 in mind .



Thanks
 
Last edited:

mik3

Joined Feb 4, 2008
4,843
I don't know any PICs which have a built in DAC. Maybe the ds30 family has otherwise you will need an external DAC. However, most PICs have a built in ADC.
 

Thread Starter

MCU

Joined Feb 8, 2009
3
Yes very few PICs have direct built in DACs . But while I was looking at the ds30 family as you suggested I realised you can achieve a reasonable DAC using PWM . Any idea how this can be done in C say using PIC18452 ?
 

mik3

Joined Feb 4, 2008
4,843
Yes very few PICs have direct built in DACs . But while I was looking at the ds30 family as you suggested I realised you can achieve a reasonable DAC using PWM . Any idea how this can be done in C say using PIC18452 ?
If you know how to program in C then set the uC to produce PWM, buffer the PWM output with a transistor and put a low pass filter to take the average value of the PWM signal. By varying the duty cycle the average voltage on the low pass filter will vary.
 

Thread Starter

MCU

Joined Feb 8, 2009
3
I decided to merge the ADC into PIC. (Since I need the ADC to sleep during conversion) . So I used Assembly language to perform 10 bit ADC . Now I need to log this to the SD card . There are alot of SD card libraries , long codes and confusing
cant find a good tutorial on SD card read/write.
 
Top