You are on page 1of 25

LIST OF EXPERIMENTS

1. Study of ARM evaluation system


2. Interfacing ADC and DAC.
3. Interfacing LED and PWM.
4. Interfacing real time clock and serial port.
5. Interfacing keyboard and LCD.
6. Interfacing EPROM and interrupt.
7. Mailbox.
8. Interrupt performance characteristics of ARM and FPGA.
9. Flashing of LEDS.
10. Interfacing stepper motor and temperature sensor.
11. Implementing zigbee protocol with ARM.

1.STUDY OF ARM EVALUATION SYSTEM


AIM :
To study the ARM Evaluation processor NXP LPC11U24.
THEORY
The mbed NXP LPC11U24 Microcontroller in particular is designed for prototyping low cost
USB devices, battery powered applications and 32-bit ARM Cortex-M0 based designs. It is packaged
as a small DIP form-factor for prototyping with through-hole PCBs, stripboard and breadboard, and
includes a built-in USB FLASH programmer.

The mbed Microcontrollers provide experienced embedded developers a powerful and productive
platform for building proof-of-concepts. For developers new to 32-bit microcontrollers, mbed provides an
accessible prototyping solution to get projects built with the backing of libraries, resources and support
shared in the mbed community.

Features

NXP LPC11U24 MCU


o Low power ARM Cortex-M0 Core
o 48MHz, 8KB RAM, 32KB FLASH
o USB Device, 2xSPI, I2C , UART, 6xADC, GPIO

Prototyping form-factor
o 40-pin 0.1" pitch DIP package, 54x26mm
o 5V USB, 4.5-9V supply or 2.4-3.3V battery
o Built-in USB drag 'n' drop FLASH programmer

mbed.org Developer Website


o Lightweight Online Compiler
o High level C/C++ SDK
o Cookbook of published libraries and projects

Tools and Software


The mbed Microcontrollers are all supported by the mbed.org developer website, including a
lightweight Online Compiler for instant access to your working environment on Windows, Linux
or Mac OS X.
Also included is a C/C++ SDK for productive high-level programming of peripherals. Combined
with the wealth of libraries and code examples being published by the mbed community, the
platform provides a productive environment for getting things done. keil uvision4 can also a
compatible compiler for mbed boards.

RESULT :
Thus the study of ARM Evaluation is completed.

2.ADC INTERFACING WITH ARM PROCESSOR


AIM
To interface convert Analog signal in digital form using ADC in ARM processor.

APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. potentiometer
4. general purpose board.
5. jumper wires.
THEORY
A potentiometer is a variable resistor used to divide the applied signal across it into discrete
voltage levels using an attached rotating shaft. The shaft makes electrical contact with a carbon-based ring
upon variable resistance that occurs during rotation. The change in resistance affects the applied signal
(voltage).
PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. Supply and Ground are connected to the potentiometer and variable end of a potentiometer is
connected to the analog pin of a M0 board.
3.Using keil uvision analog to digital c program was compiled and bin file is generated .
4. Bin file is transferred to ARM M0 board.
5. Observe the respective digital voltage values in LCD by varying the potentiometer .
PROGRAM
//Connect p20 through p27 lpc11u24 with DB0 through DB7 of lcd display
//Enable pin of lcd to pin 30
//RS pin of lcd to pin 29
//R/W pin of lcd to GROUND
//Potentiometer to pin 19
#include "mbed.h"
AnalogIn pot(p19);
DigitalOut en(p30);
DigitalOut rs(p29);
BusOut data(p20,p21,p22,p23,p24,p25,p26,p27);
void lcdCommand(int cmd){
rs = 0;
data = cmd;
en = 1;
en = 0;
wait(.01);
}
void lcdData(int character){
rs = 1;
data = character;
en = 1;
en = 0;
wait(.01);
}
void lcdWriteText(char *line1,char *line2=""){
lcdCommand(0x80);
while(*line1)
lcdData(*line1++);

lcdCommand(0xc0);
while(*line2)
lcdData(*line2++);

void lcdWrite4Digit(int digit){


lcdData(digit/1000+48);
lcdData(digit/100%10+48);
lcdData(digit/10%10+48);
lcdData(digit%10+48);
}
void lcdInit(){
lcdCommand(0x38);
lcdCommand(0x0e);
lcdCommand(0x01);
lcdCommand(0x80);
}
int main(){
lcdInit();
lcdWriteText("Potentiometer");
while(1){
lcdWrite4Digit(1024*pot.read());
lcdCommand(0xc0);
wait(.1)
}
}

INPUT
ANALOG VALUE
(Mutimeter)
GND

OUTPUT
DIGITAL VALUE
(LCD value)
0

RESULT
Thus the Conversion of Analog to Digital is performed and verified with ARM processor
successfully

3. LED INTERFACING WITH ARM PROCESSOR


AIM
To interface LED with ARM processor.
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. LED
4.Resister 1K
5. general purpose board.
6. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .
4. Bin file is transferred to ARM M0 board.
5. Observe the LED ON and OFF like blinking led.
PROGRAM

MULTIPLE LED in Emb Exp Board

//connection::p5 connected to led

#include "mbed.h"

// Header file

// DigitalOut Function Name; //led1 variable Name; //LED1 - PinNo


DigitalOut led1(p5); // Initialization port p5

int main()

// Program start

{
while(1)
{
led1 = !led1; // NOT Function, 1 ON , 0 - OFF
wait(0.2); // 200ms delay
led1 = !led1;
wait(0.2);
}}

RESULT
Thus the interfacing of LED with ARM processor is done successfully.

4.PWM WITH ARM PROCESSOR


AIM
To interface LED with ARM processor and control the LED using PWM.
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. LED
4.Resister 1K
5. general purpose board.
6. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .
4. Bin file is transferred to ARM M0 board.
5. PWM pulse width modulation is the technique behind signal generation PWM will be used in the
application of waveform generation by changing the width of the waveform the intensity of the LED
is controlled. observe the LED ON and OFF with varying intensity level.
PROGRAM
#include "mbed.h"
PwmOut led(LED2);

int main() {
// specify period first, then everything else
led.period(4.0f); // 4 second period
led.pulsewidth(2); // 2 second pulse (on)
while(1);
// led flashing
}

RESULT
Thus the interfacing of LED with PWM ARM processor is done successfully.

5. INTERFACING REAL TIME CLOCK ARM PROCESSOR


AIM
To interface real time clock with ARM processor .
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. RTC-DS1307 IC
4. general purpose board.
5. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .
4. Bin file is transferred to ARM M0 board.
5. PWM pulse width modulation is the technique behind signal generation PWM will be used in the
application of waveform generation by changing the width of the waveform the intensity of the LED
is controlled. observe the LED ON and OFF with varying intensity level.

PROGRAM
#include "mbed.h"
#include "Rtc_Ds1307.h"

//RtcCls rtc(p28, p27, p29, true);


Rtc_Ds1307 rtc(p28, p27);
Serial pc(USBTX, USBRX, "pc");
char buffer[128];
int readptr = 0;
int main() {
char c;
Rtc_Ds1307::Time_rtc tm = {};
while(1) {
pc.printf("*************************************\n");
pc.printf("* Menu for RTC Test :
*\n");
pc.printf("* read - reads the clock
*\n");
pc.printf("* start - start the clock
*\n");
pc.printf("* stop - stop the clock
*\n");
pc.printf("* write - write the clock
*\n");
pc.printf("* ena
- enable Square wave output *\n");
pc.printf("* dis
- disable square wave outp. *\n");
pc.printf("*************************************\n");
while( (c = pc.getc()) != '\n') {
buffer[readptr++] = c;
}
buffer[readptr++] = 0;
if (strncmp(buffer, "read", 4) == 0) {
// perform read
pc.printf("Performing read operation\n");
if (rtc.getTime(tm) ) {
pc.printf("The current time is : %02d:%02d:%02d\n",
tm.hour, tm.min, tm.sec);
pc.printf("The current date is : %s, %02d/%02d/
%04d\n", rtc.weekdayToString(tm.wday), tm.mon, tm.date, tm.year);
}
}
else if (strncmp(buffer, "write", 5) == 0) {
// perform write
pc.printf("Enter the date (date 0..31)");
pc.scanf("%d", &tm.date);
pc.printf("Enter the date (month 1..12)");
pc.scanf("%d", &tm.mon);
pc.printf("Enter the date (year)");
pc.scanf("%d", &tm.year);
pc.printf("Enter the time (hours 0..23)");
pc.scanf("%d", &tm.hour);
pc.printf("Enter the time (minutes 0..59)");
pc.scanf("%d", &tm.min);
pc.printf("Enter the time (seconds 0..59)");
pc.scanf("%d", &tm.sec);
pc.printf("Performing write operation\n");
while(pc.readable())
pc.getc();
rtc.setTime(tm, false, false);
}
else if (strncmp(buffer, "start", 5) == 0) {

// start
pc.printf("Performing start operation\n");
rtc.startClock();

}
else if (strncmp(buffer, "stop", 4) == 0) {
// stop
pc.printf("Performing stop operation\n");
rtc.stopClock();
}
else if (strncmp(buffer, "ena", 3) == 0) {
int rs;
pc.printf("Please specify the frequency : [0 = 1Hz, 1 =
4.096kHz, 2 = 8.192kHz, 3 = 32.768kHz] ");
scanf("%d", &rs);
pc.printf("Enabling the output with %d option\n", rs);
rtc.setSquareWaveOutput(true,
(Rtc_Ds1307::SqwRateSelect_t)rs);
}
else if (strncmp(buffer, "dis", 3) == 0) {
pc.printf("Disableing square wave output\n");
rtc.setSquareWaveOutput(false, Rtc_Ds1307::RS1Hz);
}
else {
pc.printf("syntax error\n");
}
readptr = 0;
pc.printf("\n\n\n");
}
}
RESULT
Thus the interfacing of Real Time Clock with ARM processor is done and the output was
verified at Hyperterminal successfully.

6.SERIAL PORT (UART) WITH ARM PROCESSOR

AIM
To interface real time clock with ARM processor .
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. UART serial cable
4. general purpose board.
5. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .

4. Bin file is transferred to ARM M0 board.


5. PWM pulse width modulation is the technique behind signal generation PWM will be used in the
application of waveform generation by changing the width of the waveform the intensity of the LED
is controlled. observe the LED ON and OFF with varying intensity level.
PROGRAM

//connect p9 and p10 to tx and rx respectively of jp40 and 5V to any pin of jp32.
//connect the serial cable and you can see the output in advance serial port terminal.
//what ever you sent will be echoed back.

#include "mbed.h"
Serial async_port(p9,p10);
unsigned char Received_Byte = 0;
int main()
{
async_port.baud(9600);
async_port.printf("SERIAL COMMUNICATION TEST\n\r"); // String Print
async_port.putc('E'); // Single Character Print
async_port.putc('C');
async_port.putc('E');

while(1)
{
Received_Byte = async_port.getc();

// receive single byte

async_port.putc(Received_Byte);

// print the received byte

}
}

RESULT
Thus the interfacing of UART with PWM ARM processor is done successfully.

7.INTERFACING KEYBOARD WTH ARM PROCESSOR


AIM
To interface real time clock with ARM processor .
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. RTC-DS1307 IC
4. general purpose board.
5. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .

4. Bin file is transferred to ARM M0 board.


5. PWM pulse width modulation is the technique behind signal generation PWM will be used in the
application of waveform generation by changing the width of the waveform the intensity of the LED
is controlled. observe the LED ON and OFF with varying intensity level.

#include <LPC214x.h>
#include <stdio.h>
// #define CR
0x0D
#define D0
16
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Declarations
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Delay(void);
unsigned char Row_Data, Col_Data;
unsigned char M,N;
unsigned char Msg[4][4] =
{ '0','1','2','3',
'4','5','6','7',
'8','9','A','B',
'C','D','E','F'
};
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Code Begins Here
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Delay SubRoutine
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Delay(void)
{
unsigned int i,j;
for(i=0;i<350;i++)
for(j=0;j<1234;j++);
}
void KeyScan ()
{
Delay();
/*^^^^^^^^^^^^^^^^^^^^^ Scanning of Rows ^^^^^^^^^^^^^^^^^^^^^^^^^*/
IODIR0 = (0x0F << D0);
// Configuring Rows as Input && Colum as OutPut
IOPIN0 = (0xF0 << D0);
// Push Column Values to LOW so as to get ROW value
while (((IOPIN0>>D0)&0x00F0) == 0xF0);
M = IOPIN0 >> D0;
if (M == 0xE0)
{
Row_Data = 0;
}
else if (M == 0xD0)

(P0.16 - P0.23)

{
Row_Data = 1;
}
else if (M == 0xB0)
{
Row_Data = 2;
}
else if (M == 0x70)
{
Row_Data = 3;
}
else
Row_Data = 4;
Delay();
Delay();
/*^^^^^^^^^^^^^^^^^^^ Scanning of Column ^^^^^^^^^^^^^^^^^^^^^^^^^*/
IOPIN0
=
0x0F << D0;
IODIR0
=
(0xF0 << D0);
// Configure Column as Input and Rows as OutPut

(P1.16 - P1.23)

IOPIN0 =
(0x0F << D0);
// Push LOW to Rows to get the Column value of Key Press
while (((IOPIN0>>D0)&0x000F) == 0x0F);
N = (IOPIN0 >> D0);
if (N == 0x0E)
{
Col_Data = 0;
}
else if (N == 0x0D)
{
Col_Data = 1;
}
else if (N == 0x0B)
{
Col_Data = 2;
}
else if (N == 0x07)
{
Col_Data = 3;
}
else
Col_Data = 4;
Delay();
IOPIN0 =
Delay();

0xF0 << D0;

}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Main Function
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void main(void)
{

U0LCR =
U0DLL =
U0LCR =

0x83; //8-Bit, 1 Stop Bit, No Parity


0x61; //9600 baud rate @ 15MHz Clock
0x03;

PINSEL0

|=
0x05;
//Pin Select for configuring P0.0 and P0.1 as UART0

U0THR=

0x0C;
//Clear the Hyperterminal

while (1)
{
Delay();
KeyScan();
/* Call KeyScan to Scan Row & Column */
if (Row_Data < 4 && Col_Data < 4)
{
U0THR
=
Msg[Row_Data][Col_Data];
Delay();
U0THR=
'\n'; // new line
Delay();
U0THR
=
'\r'; //Cursor to start of line
}
}
}

8. INTERFACING LCD WTH ARM PROCESSOR


AIM
To interface real time clock with ARM processor .
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. RTC-DS1307 IC
4. general purpose board.
5. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .
4. Bin file is transferred to ARM M0 board.
5. PWM pulse width modulation is the technique behind signal generation PWM will be used in the
application of waveform generation by changing the width of the waveform the intensity of the LED
is controlled. observe the LED ON and OFF with varying intensity level.

PROGRAM
//connection::p30-en , p29-rs to lcd's p20 to p27 db0 to db7 connect rw to ground.

#include "mbed.h"
DigitalOut en(p30);
DigitalOut rs(p29);
BusOut data(p20,p21,p22,p23,p24,p25,p26,p27);
void lcdCommand(int cmd){
rs = 0;
data = cmd;
en = 1;
en = 0;
wait(.01);
}
void lcdData(int character){
rs = 1;
data = character;
en = 1;
en = 0;
wait(.01);
}
void lcdWriteText(char *line1,char *line2=""){
lcdCommand(0x80);
while(*line1)
lcdData(*line1++);
lcdCommand(0xc0);
while(*line2)
lcdData(*line2++);
}
void lcdInit(){
lcdCommand(0x38);
lcdCommand(0x0e);
lcdCommand(0x01);
lcdCommand(0x80);
}
int main()
{
lcdInit();
lcdWriteText(ECE, DEPT);
}

RESULT
Thus the interfacing of LCD with ARM processor is done successfully.

9. Interfacing EPROM and interrupt

10.FLASHING OF MULTIPLE LEDS IN ARM PROCESSOR


AIM
To interface real time clock with ARM processor .
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. RTC-DS1307 IC
4. general purpose board.
5. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .
4. Bin file is transferred to ARM M0 board.
5. PWM pulse width modulation is the technique behind signal generation PWM will be used in the
application of waveform generation by changing the width of the waveform the intensity of the LED
is controlled. observe the LED ON and OFF with varying intensity level.

// Toggle a Multiple LED`s


#include "mbed.h"
// Header file
// DigitalOut Function Name; //led1 variable Name; //LED1 - PinNo
DigitalOut led1(LED1); // Initialization LED1 first led
DigitalOut led2(LED2); // Initialization LED2 second led
DigitalOut led3(LED3); // Initialization LED3 third led
DigitalOut led4(LED4); // Initialization LED4 fourth led
int main()
// Program start
{
while(1)
{
led1 = !led1; // NOT Function, 1 ON , 0 - OFF
wait(0.2); // 200ms delay
led2 = !led2;
wait(0.2);
led3 = !led3;
wait(0.2);
led4 = !led4;
wait(0.2);
}

11.Interfacing stepper motor with arm processor.


AIM
To interface real time clock with ARM processor .
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.
3. RTC-DS1307 IC
4. general purpose board.
5. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .
4. Bin file is transferred to ARM M0 board.
5. PWM pulse width modulation is the technique behind signal generation PWM will be used in the
application of waveform generation by changing the width of the waveform the intensity of the LED
is controlled. observe the LED ON and OFF with varying intensity level.
PROGRAM
#include <lpc21xx.h>
#include <stdio.h>
void delay(int n)
{
int i,j;
for(i=0;i<n;i++)
{

for(j=0;j<0x3FF0;j++)
{;}
}
}
int main(void)
{
unsigned int i=0;
IODIR1 = 0x0000F0000;

//Configure P1.16 - P1.19 as Output Pins

while(1)
// Loop forever..............
{
if(i<1000)
{
IOPIN1=0x99;
delay(1);
IOPIN1=0xcc;
delay(1);
IOPIN1=0x66;
delay(1);
IOPIN1=0x33;
delay(1);
i++;
}
else if(i>=1000 && i<2000)
{
IOPIN1=0x33;
delay(1);
IOPIN1=0x66;
delay(1);
IOPIN1=0xcc;
delay(1);
IOPIN1=0x99;
delay(1);
i++;
}
else if(i==2000) i=0;
}

//Stepper Squence 1001,1100,0110,0011

}
RESULT
Thus the interfacing of stepper motor with ARM processor is done successfully.

12.INTERFACING TEMPERATURE SENSOR WITH ARM PROCESSOR.


AIM
To interface real time clock with ARM processor .
APPARATUS REQUIED
1. NXP LPC11U24
2. Computer with keil uvision4 software.

3. RTC-DS1307 IC
4. general purpose board.
5. jumper wires.

PROCEDURE
1. NXP LPC11U24 ARM Cortex-M0 board is placed in the general purpose board .
2. LED is connected to the digital pin of ARM M0 Board.
3.Using keil uvision LED c program was compiled and .bin file is generated .
4. Bin file is transferred to ARM M0 board.
5. PWM pulse width modulation is the technique behind signal generation PWM will be used in the
application of waveform generation by changing the width of the waveform the intensity of the LED
is controlled. observe the LED ON and OFF with varying intensity level.

PROGRAM
//Connect p20 through p27 lpc11u24 with DB0 through DB7 of lcd display
//Enable pin of lcd to pin 30
//RS pin of lcd to pin 29
//R/W pin of lcd to GROUND
//Potentiometer to pin 19
#include "mbed.h"
AnalogIn pot(p19);
DigitalOut en(p30);
DigitalOut rs(p29);
BusOut data(p20,p21,p22,p23,p24,p25,p26,p27);
void lcdCommand(int cmd){
rs = 0;
data = cmd;
en = 1;
en = 0;
wait(.01);
}
void lcdData(int character){
rs = 1;
data = character;
en = 1;
en = 0;
wait(.01);
}
void lcdWriteText(char *line1,char *line2=""){
lcdCommand(0x80);
while(*line1)
lcdData(*line1++);
lcdCommand(0xc0);
while(*line2)
lcdData(*line2++);
}
void lcdWrite4Digit(int digit){
lcdData(digit/1000+48);
lcdData(digit/100%10+48);
lcdData(digit/10%10+48);
lcdData(digit%10+48);

}
void lcdInit(){
lcdCommand(0x38);
lcdCommand(0x0e);
lcdCommand(0x01);
lcdCommand(0x80);
}
int main(){
lcdInit();
lcdWriteText("Temperature sensor:");
while(1){
lcdWrite4Digit(1024*pot.read());
lcdCommand(0xc0);
wait(.1)
}
}

13. IMPLEMENTING ZIGBEE PROTOCOL WITH ARM.

You might also like