Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic dac

Status
Not open for further replies.
You can use a PWM signal and "play" with the duty cycle to get an analog signal (with proper filtering).
 
PWM means pulse width modulation. It means having a rectangular waveform that is fixed frequency, but the "on" times varies. The average voltage is the "on" voltage multiplied by the fraction of the time that it is "on" (assuming that the "off" voltage is zero).

An RC filter, usually one stage but you can use more, will remove the frequency and leave the average voltage. The "on" time can be varied under program control, therefore varying the average voltage, and you have a DAC that costs nearly nothing.

The PWM module allows the program to send some numbers to configure the module and it gets on with producing the PWM waveform without the program having to do anything else. I think that the PWM is limited to 10 bits.

I have used software PWM where I wanted 12 bit resolution. However, the timing is all important, and the program structure has to be such that the timing is maintained perfectly.

It is also possible to connect an external DAC to a PIC. I have use one of these https://www.analog.com/static/imported-files/data_sheets/AD5320.pdf. Data is sent to them from a PIC SPI module, or by bit bashing. As with the PWM module, the DAC output doesn't change after the data has been sent, so there is less program overhead.

I have used the both software PWM DAC and the external DAC in TCXOs. (Temperature compensated crystal oscillators). A digital temperature sensor, such as an LM95071, was used to measure the temperature. The PIC calculated the compensation required and the DAC output was used to vary the crystal loading so that the frequency varies as little as possible.
 
hi Diver 300

thanks for the information

i also found other chip that can be used as DAC

from this quote

or drive a simple 8-pin serial DAC, like microchip TC1321, Maxim
MAX541, ....boy I'd better not mention them all, I'll be typing all
night.

what are those SDA and SCL pin for ?
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top