DOC PREVIEW
UNCC ECGR 4101 - Study Notes

This preview shows page 1-2-3-4 out of 13 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

AbstractIntroductionD-A ConverterImplementationConclusionsReferenceSoftware CodeAPPLICATION NOTE M16C/62 Using the M16C/62 D-A Converter 1.0 Abstract The following article introduces and shows an example of how to use the D-A Converter on the M16C/62 group device. 2.0 Introduction The Renesas M16C/62 series of microcontrollers is a 16-bit family of MCUs, based on Renesas’ popular M16C CPU core. These parts provide high memory efficiency, power-saving ability, low noise emission, and improved noise immunity. The M16C family features an impressive list of features including LCD, USB, 10-bit A-D converter, UARTs, timers, DMA controllers, D-A converter, and large on-chip ROM and RAM and FLASH. The M16C/62 part series can be used in many applications such as office equipment, PC peripherals, portable devices, automotive, cameras, audio, and more. This article shows how to create a simple waveform generator using the D-A converter and other peripherals on the M16C/62 series of microcontrollers. 3.0 D-A Converter Digital-to-Analog conversion is a process in which digital signals are converted into analog signals. The circuit that performs this function is the D-A converter (DAC). Some common examples of DAC uses are for modems, motor control, and audio output. The M16C/62 group microcontroller contains two independent 8-bit D-A converter channels. This D-A converter uses the 8-bit R-2R technique for conversion. This technique uses a resistor ladder network that is connected to the 8 digital bit outputs to create a corresponding analog value. Figure 1 shows an example R-2R circuit. R2RRRRRRR2R2R 2R 2R 2R 2R 2R 2RBit 0Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Analog Out(DA0,DA1)D-A Register contents Figure 1 Example DAC R-2R Circuit REU05B0008-0100Z June 2003 Page 1 of 12M16C/62Using the M16C/62 D-A Converter The analog output voltage of the DAC has a total range from 0V to VREF. The output voltage can be calculated at any time by using DAC Output = (VREF/256) x D-A register contents The following is a list of all the DAC related pins and registers in the M16C/62: D-A converter related pins: • DA0 pin – Analog output of D-A channel 0 • DA1 pin – Analog output of D-A channel 1 • VREF – External reference voltage • Avcc, Avss – Power and ground pins used by the DAC D-A converter related registers: • D-A Register 0 (DA0) – Digital value for D-A conversion, output on channel 0 • D-A Register 1 (DA1) – Digital value for D-A conversion, output on channel 1 • D-A Control Register (DACON) – D-A enable bits (refer to Figure 2) • Port 9 Direction Register (PD9) – Set DA0 pin and DA1 pin to outputs D-A control registerSymbol Address When resetDACON 03DC16 0016b7 b6 b5 b4 b3 b2 b1 b0D-A0 output enable bit DA0EBit symbol Bit name Function R W0 : Output disabled1 : Output enabledD-A1 output enable bit0 : Output disabled1 : Output enabledDA1ENothing is assigned.In an attempt to write to these bits, write “0”. The value, if read, turns out to be “0” (JB-02-UM60)D-A registerSymbol Address When resetDAi (i = 0,1) 03D816, 03DA16IndeterminateWRb7 b0Function R WOutput value of D-A conversion Figure 2 D-A Control and Data Registers for M16C/62 To perform a D-A conversion: 1. Set the D-A channel output pin(s) that will be used for output mode in the Port 9 Direction Register. 2. Write the initial value to be converted to the D-A register (DA0, DA1). D-A conversion starts when a value is written to the D-A register. 3. Set the D-A output enable bit to “1” to start outputting the analog signal on the DA pin. REU05B0008-0100Z June 2003 Page 2 of 12M16C/62Using the M16C/62 D-A Converter 4. Write new digital values to the D-A register at any time to be converted and sent out on the DA pin. 5. The D-A converter continues outputting an analog signal until the D-A output is disabled by setting the D-A enable bit to “0”. More information on the D-A converter can be found in the M16C/62 group data sheet. 4.0 Implementation A simple waveform generator sample program is included to demonstrate the use of the D-A converter. This program is written to run on Renesas’ MSV1632 evaluation board. This board allows easy evaluation for any M16C/62 microcontroller. More information on this evaluation board and other starter kits can be found at http://www.renesaschips.com. 4.1 Program Operation This program generates a square wave, a triangle wave, or a sine wave and outputs it on D-A channel 0 (DA0 pin). The frequency and amplitude of any of the waveforms are adjustable using the push buttons on the evaluation board, except that the amplitude for the sine wave cannot be changed. The amplitude of the sine wave is fixed to 5 volts, where the maximum amplitude of the square and triangle waveforms can be changed from 0 to 5 volts. The frequency for any of the waveforms can be changed from approximately 30 Hz to 800 Hz. Connect an oscilloscope to the DA0 pin to see the output waveforms. There are three push buttons on the evaluation board that are used to change the waveform type, the frequency, and the amplitude. The button labeled SW1 is used for a mode select function. Pushing this button changes the mode to one of the following: Waveform Type, Amplitude, or Frequency. The current selected mode is displayed on the LCD. The buttons SW2 and SW3 are used to modify the values of the current selected mode. Pushing SW2 causes the waveform type to cycle forwards, the amplitude to increase in value, and the frequency to increase. Pushing SW3 causes the waveform type to cycle backwards, the amplitude to decrease, and the frequency to decrease. When an amplitude or frequency reaches its maximum or minimum value, a message is displayed on the LCD indicating max or min. 4.2 Triangle Waveform The triangle waveform is a good example of how the D-A converter works. Start by putting 0 into the D-A register. Now for every step of the waveform just add 1 to the value that was previously written to the D-A register. By stepping up from 0016 to FF16 in the D-A register, a rising line is created that goes from 0 volts to 5 volts (or VREF voltage) with its slope dependent on the amount of time between steps. Once FF16 is reached, the program starts subtracting 1 from the D-A register every step. This will create a downward sloped line. When 0016 is reached, the process is repeated. Continue to repeat this procedure to create a continuous triangle wave. Adding or subtracting 1 from the


View Full Document

UNCC ECGR 4101 - Study Notes

Documents in this Course
Load more
Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?