0% found this document useful (0 votes)
9 views5 pages

Lab 8

The document outlines an experiment aimed at generating various waveforms (saw-tooth, triangular, and square) by interfacing an ARM processor with a Digital to Analog Converter using assembly language programming in Keil UV4 software. It includes detailed procedures, assembly language programs, and embedded C code for each waveform generation. Additionally, it presents pre-lab and post-lab questions related to the LPC2148 processor's registers and programming directives.

Uploaded by

nayansoni306
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

Lab 8

The document outlines an experiment aimed at generating various waveforms (saw-tooth, triangular, and square) by interfacing an ARM processor with a Digital to Analog Converter using assembly language programming in Keil UV4 software. It includes detailed procedures, assembly language programs, and embedded C code for each waveform generation. Additionally, it presents pre-lab and post-lab questions related to the LPC2148 processor's registers and programming directives.

Uploaded by

nayansoni306
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

8 DIGITAL TO ANALOG CONVERTER INTERFACING WITH ARM

PROCESSOR

8.1. Aim(s) / Objective(s) / Purpose


The purpose of this experiment is to generate waveforms through interfacing of ARM
processor with Digital to Analog Converter. Write assembly language programming in Keil UV4
software.
8.2 Introduction / Background
The purpose of this experiment is to create saw-tooth wave, triangular wave and square waveform
using digital to analog converter interface with ARM processor.

8.3 Materials / Equipment

1.​ Andrew Sloss, Dominic Symes, and Chris Wright. ARM system developer's guide: designing and
optimizing system software. Elsevier, 2004.
2.​ Mazidi, M., Naimi, S., Naimi, S. and Mazidi, J., ARM Assembly Language Programming &
Architecture. y Pearson Education, Inc., 2013.

8.4 Software Requirement:


​ KEIL UV4 with supported device packages installed.

8.5 Procedure
i)​ Enter the PROGRAM
ii)​ Execute the program
iii)​ Check for the result in destination.

8.6 PROGRAMS:
Program 1: SAWTOOTH WAVEFORM GENERATION (Assembly Language Program)

ADDRES LABEL MNEMONICS OPCODE COMMENTS


S

AREA SAWTOOTH, CODE,


READONLY

PINSEL1 EQU 0xE002C004

DACR EQU 0xE006C000

LDR R3,= 0X000003FF

LDR R1, = PINSEL1

LDR R2, = 0x00080000


STR R2,[R1]

LDR R0, = DACR

LDR R2, = 0x0

L1 LSL R1,R2,#6

STR R1,[R0]

ADD R2,R2,#1

CMP R2,R3

BLT L1​

LDR R2,= 0x0

B L1

END

Sawtooth Waveform Embedded C Code:


SOURCE CODE COMMENTS

#include<lpc214x.h>
int count = 0;
int main (void)
{
PINSEL1 = 0X00080000;
while(1)
{
For (count=0; count<1023; count++)
{
​ DACR = (count<<6);
}
For (count=0; count>0; count--)
{
​ DACR = (count<<6);
}
}
}

Program 2: TRIANGULAR WAVEFORM GENERATION (Assembly Language Program)


ADDRESS LABEL MNEMONICS OPCODE COMMENTS

AREA TRI, CODE, READONLY

PINSEL1 EQU 0xE002C004

DACR EQU 0xE006C000

LDR R3,= 0X000003FF

LDR R1, = PINSEL1

LDR R2, = 0x00080000

STR R2,[R1]

LDR R0, = DACR

LDR R2, = 0x0

L1 LSL R1,R2,#06

STR R1,[R0]

ADD R2,R2,#01

CMP R2,R3

BLT L1​

L2 LSL R1,R2,#06

STR R1,[R0]

SUBS R2,R2,#01

BNE L2
B L1

END

Triangular Waveform Embedded C Code:


SOURCE CODE COMMENTS

#include<lpc214x.h>
int count = 0;
int main (void)
{
PINSEL1 = 0X00080000;
while (1)
{
For (count=0; count<1023; count++)
{
​ DACR = (count<<6);
}
For (count=1023; count>0; count--)
{
​ DACR = (count<<6);
}
}
}

Program 3: SQUARE WAVEFORM GENERATION (Embedded C Code)

SOURCE CODE COMMENTS


#include<lpc214x.h>
int count = 0;
int main (void)
{
unsigned int value=0;
PINSEL1 = 0X00080000;
while(1)
{
for (count=0; count<1023; count++)
{
Value =1023;
DACR = (value<<6);
}
For (count=0; count<1023; count++)
{
​ ​ value =0;
​ ​ DACR = (value<<6);
​ }
}
}

PRE-LAB QUESTIONS:
1.​ Comment on the PINSEL registers of LPC2148 processor
2.​ How does the DACR register of LPC2148 processor is accessed for ARM operations?

POST-LAB QUESTIONS:
1.​ List the special function registers of LPC2148 device.
2.​ What is the purpose of using EQU directive in source code.

Result:

You might also like