Top Banner
LPC2148 –DAC Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] Department of EIE / PEC Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College [email protected]
12

LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., [email protected] Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

May 20, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

LPC2148 –DAC

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

Dr.R.SundaramurthyDepartment of EIE

Pondicherry Engineering College

[email protected]

Page 2: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

ADC

• 10 bit digital to analog converter

• Resistor string architecture

• Buffered output

• Power-down mode

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

• Power-down mode

• Selectable speed vs. power

Page 3: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

PLL

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

VPBDIV = 0x00000001;

Page 4: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

Pins InvolvedDAC

ADC0.4 [Pin 9] P0.25

p

o

t

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

Page 5: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

ADC

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

AD0.4 / AOUT

Page 6: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

SFRs Involved

• VLSI Peripheral Bus Divider - VPBDIV

• P0 Pin Select Register - PINSEL1

• DAC Control Register - DACR

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

Page 7: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

Pin Select SFRs

• PINSEL0 for GPIO pins 0.0 to 0.15

• PINSEL1 for GPIO pins 0.16 to 0.31

• PINSEL2 for GPIO pins 1.16 to 1.31

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

Each Pin is Associated with multiple functions

Pin Select enable you to select which pin

functions you would like to use

Page 8: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

How to Use PINSEL

• Each associated 'pin' in PINSEL is assigned a

2-bit address.

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

PINSEL1 = PINSEL1 | 2 << (25-16) * 2

Page 9: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

DAC Control Register - DACR

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

Page 10: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

void sendDAC(unsigned int DACdata)

{

pinselect(0,25,2);

DACR = DACdata << 6;

}

void GenerateSine()

{

// 100 samples

// 1 KHz

// T= 1ms / 100 samples = 10micro

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

// T= 1ms / 100 samples = 10micro

unsigned int sinedata[10] =

{1,2,3,4,5,6,7,8,9,10} ;

int i;

for(i=0;i<10;i++)

{

sendDAC(sinedata[i]);

delayus(10);

}

}

Page 11: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

pinselectvoid pinselect(int portnumber,int pinnumber, int functionselect)

{

if (portnumber == 0)

{

if (pinnumber >= 0 && pinnumber <= 15 )

PINSEL0 |= functionselect << (pinnumber * 2 ) ;

if (pinnumber >= 16 && pinnumber <= 31 )

PINSEL1 |= functionselect << ((pinnumber - 16) * 2 ) ;

}

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

}

else if (portnumber == 1)

{

if (pinnumber >= 16 && pinnumber <= 31 )

PINSEL2 |= functionselect << ((pinnumber - 16) * 2 ) ;

}

else

portnumber = 3; // Dummy Write }

Page 12: LPC2148 –DAC - Weebly · LPC2148 –DAC Department of EIE / PEC Dr.R.Sundaramurthy., M.E.,Ph.D., sundar@pec.edu Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College

End of Session

Dr.R.Sundaramurthy.,M.E.,Ph.D., [email protected] of EIE / PEC

[email protected]