Docsity

Understanding Parallel Ports and DAC Conversion with AD0832 and DAC0830 - Prof. Bradley J., Study notes of Microcomputers

Partial preview of the text

Download Understanding Parallel Ports and DAC Conversion with AD0832 and DAC0830 - Prof. Bradley J. and more Study notes Microcomputers in PDF only on Docsity!

ECE 4510/

Microcontroller ApplicationsMicrocontroller Applications

DAC0832DAC0832^ Dr. Bradley J. BazuinAssociate ProfessorDepartment of Electrical and Computer EngineeringCollege of Engineering and Applied SciencesCollege of Engineering and Applied Sciences

Chapter 7: Parallel Portsp

•^ Parallel Port Usage

g

•^ Data Port Pins•^ Control Port Pins ECE 4510^

The AD0832 DAC

(2 of 2) - The output is considered acurrent with:

_ 256

worddigital

VrefIout ⋅= k Ω

_ 255256

worddigital

Vref − Iout^ ⋅= k Ω

DAC0830/DAC0832 8-Bit

μP Compatible, Double-Buffered D to A Converter Data Sheet, National Semiconductor Corp., March 2002. http://www.national.com/ds/DA/DAC0830.pdf.

AD0832 R-2R Ladder

•^ Each “tap” is one half the voltage of the higher level tap

p^

g^

g^

p

when all the 2R outputs are grounded. ECE4510/

DAC0830/DAC0832 8-Bit

μP Compatible, Double-Buffered D to A Converter Data Sheet, National Semiconductor Corp., March 2002. http://www.national.com/ds/DA/DAC0830.pdf.

OP Amp Nulling Circuit

p^

g

•^ LM741 – the oldest op amp

p^ p

Note: use a 10k

Ω^ trimmer

potentiometer (trim-pot)

ECE4510/

LM741 Operational Amplifier Data Sheet, National Semiconductor Corp.,August 2000. http://www.national.com/ds/LM/LM741QML.pdf

Alternate Output Configuration

p^

g^ A 5V reference should resultin a range of 10V to +10 Vin a range of -10V to +10 V

ECE4510/

DAC0830/DAC0832 8-Bit

μP Compatible, Double-Buffered D to A Converter Data Sheet, National Semiconductor Corp., March 2002. http://www.national.com/ds/DA/DAC0830.pdf.

AD0832 Control and Timing

g

ECE4510/

Using the Input and DAC Registersg

p^

g

-^ First write the value to the inputregister.•^ Second transfer the input register to the^ DAC register

ECE4510/

Example C Code

void main(void){

p

{ unsigned char count = 0;DDRP^

= 0xFF;^

/* configure Port P for output */ DDRM^

|= 0x0F;^

/* configure Port M for output */ PTP^

= count;^

/* Output the first count value to Port P*/ PTM^

|= 0x03;^

/* Perform fast DAC trasnfers WR2,XFER low */ while (1) {PTP^

= count;^

// output the next data value PTM^ &= ~(0x01);

// deassert CS PTM^ &=^ (0x02);

// deassert WR PTM^ &= ~(0x02);

// deassert WR asm(“nop”);^

// wait 125 nsec asm(“nop”);^

// wait 250 nsec asm(“nop”);^

// wait 375 nsec PTM^ |= 0x02;

// assert WR1| PTM^ |= 0x01;

// assert CS (CS must hold longer than WR1) count++;^

// sawtooth sequence

} } C^

k^ hi^

ll bl^ f

i^

Can you make this a callable function?void dac_out(char dac_value);