MEFT-SAD/1ºSEMESTER- 2016/20172ndLab Guide
Digital to Analog conversion (DAC). Simple Converters and External Chips. Signal reconstruction.
Group no: Students:
Include all the circuits used, plot and results. When needed get an oscilloscope screen copy, showing the measured parameter. Attach the dsPIC “C” and Octave/Matlabwell commented codes in the annexes
Objectives:
The main goal with this activity is to implement simple DAC circuits in the Lab and to connect a micro controller to external chips. Reconstruct and “play” some signals acquired in Lab 1.
Equipment:
- Microcontroller board with microcontroller dsPIC30F4011 (version 3)
- “MPLAB X” programming software and “C” compiler “XC16”
- Electronic Test Bench with Signal generator/ Digital Oscilloscope / Multimeter
- Electronic “breadboard”
- Electronic Switch TTL compatible 74HCT4066
- External SPI DAC chips MCP4921/MCP4821
- Linux PC with a RS232 terminal app (e.g. Putty)
- Optional Audio board of the PC Linux stations / Audacity Software
Procedures:
1rstPart:Simple baseband DAC circuits:
1)Implement, test and make the necessary measurement to characterize the following simple DAC circuits with an output range 0-5V, controlled by the microcontroller.
- 1 Bit (electrical switch)
- 2 or 3 bit (R-Ladder)
- 4 bit (R-2R Ladder);
2nd Part: PWM DAC circuit
1)Write a program able to produce a periodic Fpwmhigh frequency (TIMER pre-scaler at minimum) PWM signal at the digital output OC2/4 with a Duty-Cycle (D.C.) modifiable through the serial port and a PC keyboard key code. The integer DC value should have at least 1024 steps (10 bit resolution)
2)Design and implement a low pass filter (Sallen-key) to apply to the output PWM signal. It should designed to reduce the Fpwmcomponent to a low level
(criteria: Vac(pwm)0.1% *Vdc ) while the D.C. is kept at 50%
3)Measure the output average level with the mustimeter as function of the D.C. (take a minimum of 20 data points). Build a sketch of DAC transfer function.
4)Making an abrupt change of the DC from 1% ->99% (and vice versa) measure the “Delay”, “Settling Time”and “Ringing” for this DAC circuit
5)Measure the AC amplitude of the Fpwm signal and compare against the expression SNR = 6.02 * N + 1.76 dB.
Fig. 1. “Delay”, “Settling Time”, “Ringing” and Error Band for a DAC circuit
6)Make a simple program to generate a (very) low frequency signal with arbitraryshape (sinus, triangular, saw-tooth, etc.). The update value routine should be called from a TIMER INT routine and use pre-calculated values (Look-up-Table in the “C” program).
3rd Part: External DAC SPI device (MCP4821)
1)Make a simple program to communicate the data samples with the DAC chip through SPI interface (three wire plus GND), using the dsPIC30F4011SPI internal peripheral.
2)Install the MCP4821 on the breadboard and connect the power and necessary links the microcontroller. Test the communication and measure a set of 20 output DC values to draw the DAC transfer function.
3)Repeat the step 6) of the first part with this chip.
4)Try to reconstruct some signals sampled and acquired on the 1rst Lab Work and reconvert them back to analog format.
Suggestion: Some theof signals might need some kind of digital processing in octave (e.g. up-sampling and digital low pass filter) before DAC converting. You can use the AUDACITY programme and the PC sound card DAC output.
5)Keep the DAC circuit on the breadboard. You’ll need it for the Lab 3. (ADC implementations)