Embedded Laboratory

Download as pdf or txt
Download as pdf or txt
You are on page 1of 95

SNS COLLEGE OF ENGINEERING

Kurumbapalayam (Po), Coimbatore – 641 107

AN AUTONOMOUS INSTITUTION
Accredited by NBA – AICTE and Accredited by NAAC – UGC with ‘A’ Grade
Approved by AICTE, New Delhi & Affiliated to Anna University, Chennai

DEPARTMENT OF
ELECTRONICS AND COMMUNICATION ENGINEERING

EC8711 - EMBEDDED LABORATORY


VII SEMESTER
2020-2021
SNS COLLEGE OF ENGINEERING
Kurumbapalayam (Po), Coimbatore – 641 107
AN AUTONOMOUS INSTITUTION

NAME : ……………………………………………………………….

COURSE : ……………………………………………………………….

REGISTER NO.

Certified that this is the bonafide record of work done by above student

of the …………………………………………………………………..…. Laboratory

during the year ……………………..… to ……………………..…

Staff- in –Charge Head of the Department

Submitted for the End Semester Practical Examination on ______________ at

SNS COLLEGE OF ENGINEERING, Coimbatore-641107

INTERNAL EXAMINER EXTERNAL EXAMINER


TABLE OF INDEX
S.No Date Name of the Experiment Page No. Marks Signature
Nvis 5004B
Features

· ARM7 Controller based on LPC 2148


· Expansion connectors for plug in modules and prototyping area
· On board Flash download utility (programmer)
· USB interface given for programming
· USB 2.0 Full-speed compliant device controller with 2 kB of endpoint
RAM
· Master Reset/Restart Key for hardware reset
· RTOS supported (RTX, mC/OS-II )
· On board USB (UART0) and UART1 Interface
· Temperature Sensor on board
· 16X2 LCD Display on board Interface
- On 10-bit DAC provides variable analog output
· On PWM Interface
· On facility to connect JTAG Programming and debugging
· All GPIO’s are provided on 6 connectors (10X2)
· Wireless module adapter for optional - 2.4GHz ZigBee (Xbee) / Bluetooth /
WiFi connectivity
· Stepper motor driver
· I2C and SPI Interface connector
· Controller module is detachable, you can use other controller as user
· CD with sample project code, Programmer software & useful documents
· Exhaustive course & reference material
Nvis 5004B

Technical Specifications

MCU : LPC2148
Crystal Frequency : 12 MHz
LED’s : 8 nos
ADC : 2 nos Internal 10 bit ADC
DAC : 10 Bit internal DAC
Interrupts : 2 nos External Interrupts on Board
RTC : 3.3 Volt CMOS Battery
PWM : 2 nos on Board
GPIO’s : All GPIO Pins on Board
Display : 16x2 LCD Display
Hex Keypad : 4x4 Hex Keypad
Motor drive : L293D 600mA(5-12V)
Variable Supply : 0-3.3 Volt
Sensor : LM35
External memory : EEPROM
Communication interfaces : USB 2.0 Full speed device control
Programmer : USB
Programmer Mode Selection : Run/ISP Switch selection
Baud Rate : 9600 bps (Default)
Interconnections : 2 mm Patch Chords with FRC Cables
General:
Power supply : Adapter 5volt/1Amp
Power consumption : 2.0 VA (approximately)
Dimension (mm) : W 326 ´ D 252 ´ H 52
Weight : 1.5Kg (approximately)
Nvis 5004B
Pin out and description
EC6711 EMBEDDED LABORATORY LTPC0032

OBJECTIVES: The student should be made to:

• Learn the working of ARM processor


• Understand the Building Blocks of Embedded Systems
• Learn the concept of memory map and memory interface
• Know the characteristics of Real Time Systems
• Write programs to interface memory, I/Os with processor
• Study the interrupt performance

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.

OUTCOMES: At the end of the course, the student should be able to:

• Write programs in ARM for a specific Application


• Interface memory and Write programs related to memory operations
• Interface A/D and D/A convertors with ARM system
• Analyse the performance of interrupt
• Write programmes for interfacing keyboard, display, motor and sensor.
• Formulate a mini project using embedded system
Ex. No: 1
STUDY OF ARM EVALUATION SYSTEM

AIM:
To study about the ARM Evaluation system.

THEORY:

ARM7 based LPC2148 Microcontroller

The full form of an ARM is an advanced reduced instruction set computer (risc)machine and it is a
32-bit processor architecture expanded by ARM holdings. The applications of an ARM processor
include several microcontrollers as well as processors. The architecture of an ARM processor was
licensed by many corporations for designing ARM processor-based SoC products and CPUs. This
allows the corporations to manufacture their products using ARM architecture. Likewise, all main
semiconductor companies will make ARM-based SOCs such as Samsung, Atmel, TI etc.

ARM7 Processor

ARM7 processor is commonly used in embedded system applications. Also, it is a balance among
classic as well as new-Cortex sequence. This processor is tremendous in finding the resources
existing on the internet with excellence documentation offered by NXP Semiconductors. It suits
completely for an apprentice to obtain in detail hardware & software design implementation.

LPC2148 Microcontroller

The LPC2148 microcontroller is designed by Philips (NXP Semiconductor) with several in-built
features & peripherals. Due to these reasons, it will make more reliable as well as the efficient option
for an application developer. LPC2148 is a 16-bit or 32-bit microcontroller based on ARM7 family.

Features of LPC2148

The main features of LPC2148 include the following.

• The LPC2148 is a 16 bit or 32 bit ARM7 family based microcontroller and available in a
small LQFP64 package.
• ISP (in system programming) or IAP (in application programming) using on-chip boot
loader software.
• On-chip static RAM is 8 kB-40 kB, on-chip flash memory is 32 kB-512 kB, the wide
interface is 128 bit, or accelerator allows 60 MHz high-speed operation.
• It takes 400 milliseconds time for erasing the data in full chip and 1 millisecond time for
256 bytes of programming.
• Embedded Trace interfaces and Embedded ICE RT offers real-time debugging with high-
speed tracing of instruction execution and on-chip Real Monitor software.
• It has 2 kB of endpoint RAM and USB 2.0 full speed device controller. Furthermore, this
microcontroller offers 8kB on-chip RAM nearby to USB with DMA.
• One or two 10-bit ADCs offer 6 or 14 analogs i/ps with low conversion time as 2.44 μs/
channel.
• Only 10 bit DAC offers changeable analog o/p.
• External event counter/32 bit timers-2, PWM unit, & watchdog.
• Low power RTC (real time clock) & 32 kHz clock input.
• Several serial interfaces like two 16C550 UARTs, two I2C-buses with 400 kbit/s speed.
• 5 volts tolerant quick general purpose Input/output pins in a small LQFP64 package.
• Outside interrupt pins-21.
• 60 MHz of utmost CPU CLK-clock obtainable from the programmable-on-chip phase
locked loop by resolving time is 100 μs.
• The incorporated oscillator on the chip will work by an exterior crystal that ranges from 1
MHz-25 MHz
• The modes for power-conserving mainly comprise idle & power down.
• For extra power optimization, there are individual enable or disable of peripheral functions
and peripheral CLK scaling.

Advantages of ARM Processor

1. Affordable to create
ARM Processor is very affordable as it does not need expensive equipment’s for its creation.
When compare to other processors, it is created at much lesser price. This is why they are apt
for making of low cost Mobile phones and other electronic devices.

2. Low Power Consumption


AMP Processors have lesser power consumption. They were initially designed for performing
at lesser power. They even have lesser transistors in their architecture. They have various other
features that allow for this.

Disadvantages of ARM Processor

1. It is not compatible with X86 hence it cannot be used in Windows.


2. The speeds are limited in some processors which might create problems.
3. Scheduling instructions is difficult in case of ARM processors.
4. There must be proper execution of instructions by programmer. This is because entire
performance of ARM processors depend upon their execution.
5. ARM Processor needs very highly skilled programmers. This is because of importance and
complexity of execution (processor shows lesser performance when not executed properly.).

RESULT:

Thus the ARM Evaluation system was studied and analyzed.


Ex. No: 2 a
INTERFACING ADC

AIM

To write a program to interface Analog to Digital Conversion (On chip ADC).

EQUIPMENT NEEDED
1. Nvis 5004B board
2. Adapter 5volt/1Amp
3. USB Cable
4. Multi-Meter
5. 2mm Patch Chord

PROCEDURE
1. Connect the USB cable to USB port of your PC and UART0( B Type USB) port of the
board (in PC interface & ISP section) provided on the board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the ISP
mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “ADC_Interfacing.hex” (CD-drive\ Onboard Program\ 5. ADC Interfacing\
ADC_Interfacing.hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Put all the switches provided in the ‘LED Interface’ block in the OFF position.
9. Put all the switches provided in the ‘LCD Interface’ block in the ON position.
10. Put 6,7,8 switches provided in the ‘Motor Module’ block in the ON position
11. Put 6,7 Dip switches provided in the ‘ADC Interface’ block in the ON position
12. Connect the DC Voltage potentiometer provided in the ‘ADC Interface’ block with the AIN1
pin using a patch chord.
13. Turn ON the switch no 5 of the switch provided in the ‘ADC Interface’
14. Switch ‘On’ the supply, then press reset switch.
15. Rotating the potentiometer will provide the analog input to the controller and its digitally
converted values could be seen on LC
PROGRAM

#include <LPC214x.H> /* LPC214x definitions */


#define CR 0x0D #define PLOCK 0x400
/***************************
* Function Prototypes
***********************************/
void ADC_Init(void); /* ADC Init Function */
void ADC_Convert(unsigned int); /* ADC Display Function */

unsigned int ADC_Val; /* ADC Result (HEX) */


unsigned int FirstBit,SecondBit,ThrdBit,FourthBit;

//************************
* Function Prototypes
*
**************************/
void LCD_Init(void); /* LCD Init Function */
void LCD_Delay(unsigned int); /* LCD LCD_Delay Function */
void LCD_Cmd(unsigned long); /* LCD Command Function */
void LCD_Data(unsigned long); /* LCD Data Function */
void LCD_Disp(unsigned char,unsigned char *); /* LCD Display Function */

/****************************
* LCD Pin Out Discription

***************************/ #define RS_Set IO0SET = 0x00200000; #define RS_Clr IO0CLR


= 0x00200000;

#define EN_Set IO0SET = 0x00800000; #define EN_Clr IO0CLR = 0x00800000;


/****************************
* LCD_Delay
* Description : This function provide LCD_Delay in Mili Sec.
***************************/
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;

for(i=0;i<=Time;i++) for(j=0;j<1275;j++);
}
/*****************************
LCD initialization
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set 8bit : 2 Line 5x7 Dots (0x38)
* 2. Display On curser Off (0x0C)
* 3. Clear Display (0x01)
* 4. Entry Mode (0x06)
* Note : This function should be called once before any of the other functions
****************************/
void LCD_Init(void)
{
LCD_Cmd(0x38); /* Function Set 8bit : 2 Line 5x7 Dots */
LCD_Cmd(0x0C); /* Display On curser Off */
LCD_Cmd(0x01); /* Clear Display */
LCD_Cmd(0X06); /* Entry Mode */
}

/****************************
* LCD Command (Shifting is Done here)
*
* Description : This function initializes the LCD module by the following steps:
* Note : Here we have selected Pin P1.16 to P1.23 as LCD data line,
* thats why we need to shift data by 16.
****************************/
void LCD_Cmd(unsigned long Cmd)
{
unsigned long Shifted_Cmd;

Shifted_Cmd = Cmd << 16; /* because We have selected P1.16 to P1.23 as LCD data line
*/

RS_Clr; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET=Shifted_Cmd; /* Write Command Value to LCD Data Pin */


LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}

/****************************
* LCD Data
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set Register select(RS) to High
* 2. Set enable pin high to low
* 3. Send data to LCd data pin
* Note : Here we have selected Port 1 Pin P1.16 to P1.23 as LCD data
line thats
* why we need to shift data by 16.
*****************************/
void LCD_Data(unsigned long Data)
{

RS_Set; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}
/******************************
LCD Display
*
* Description : This function initializes the LCD module by the following steps:
* 1. Send Loc from where data needs to write
* 2. Display string on LCD
*****************************/
void LCD_Disp(unsigned char Loc, unsigned char *String)
{
LCD_Cmd(Loc); /* Send Command to LCd */
while(*String) /* Wait untill Null char come */
{
LCD_Data(*String++); /* Write data to LCD */
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}
}

/*****************************
* Delay
* Description : This function provide Delay in Mili Sec.
************************************/
void Delay(unsigned int Time)
{
unsigned int i,j;

for(i=0;i<=Time;i++)
for(j=0;j<110;j++);
}
/*********************************
Feed Init function
*************/
static void feed(void)
{
PLL0FEED = 0xAA;
PLL0FEED = 0x55;
}
/*****************************
* PLL Init function
*************/
void PLL_Init()
{
PLL0CFG = 0x24;
feed(); /* Enabling the PLL */
PLL0CON = 0x01;
feed(); /* Wait for the PLL to lock set frequency */
while(!(PLL0STAT & PLOCK)); /* Connect the PLL as the clock source */
PLL0CON = 0x3;
feed(); /* Enabling MAM and setting number of clocks used for Flash
memory fetch (4 cclks in this case) */
MAMTIM = 0x04;
MAMCR = 0x02; /* Setting peripheral Clock (pclk) to System Clock (cclk)*/
VPBDIV = 0x01;
}
/*******************************
* ADC initialization
*
* Description : This function initializes the ADC by the following steps:
* 1. Select ADC Channel
* 2. Set A/D: 10-bit AIN1 @ 12MHz
* Note : This function should be called once before any of the other
functions of ADC.
************************************/
void ADC_Init()
{
PINSEL0 = 0x00030000; /* channel AD1.1 */
AD1CR = 0x01210402; /* Setup A/D: 10-bit AIN1 @ 3MHz */
}
/***************************
* ADC Conversion
*
* Description : This function convert ADC data into ASCII by the following steps:
* 1. Conver each byte into ASCII
* 2. Each Value will be used for LCD Display
* Arguments : 'RADC_Value' is the Value which needs to convert in ASCII.
************************************/
void ADC_Convert(unsigned int ADC_Value)
{
unsigned int X,Y,Z; /* Intermidiate Variables */

FirstBit=0,SecondBit=0,ThrdBit=0,FourthBit=0; X
= ADC_Value/10;
FirstBit = ADC_Value%10;
FirstBit = 0x30|FirstBit; /* First Byte(LSB) */

Y = X/10;
SecondBit = X % 10;
SecondBit = 0x30|SecondBit; /* Second Byte */

Z = Y/10;
ThrdBit = Y % 10;
ThrdBit = 0x30|ThrdBit; /* Third Byte */

FourthBit = Z; /* Last Byte(MSB) */


FourthBit=0x30|FourthBit;
}
/********************************* Main
* Description : This function Initialize the UART0and ADC
*********************************/
int main (void)
/* program exec. starts here */
{

IO1DIR = 0x00FF0000; /* Set LCD_DATA pin as out put */


IO0DIR = 0x00E00000; /* Set LCD_Control pin as out put */
LCD_Init(); /* Initialize LCD */
Delay(100);
LCD_Disp(0x80, " NVIS "); /* Display "NVIS" */
LCD_Disp(0xC0, " Technologies "); /* Display "Technologies" */
Delay(5000);
LCD_Cmd(0x01);
ADC_Init();
/* ADC Initialize */
while(1)
{
AD1CR |= 0x01000000; /* start of ADC conversion */
do
{
ADC_Val = AD1DR1; /* 10 bit value */
Complete */
while ((ADC_Val & 0x80000000) == 0);
/* Wait ADC Conversion

AD1CR &= ~0x01000000;


/* Again start ADC */
ADC_Val = (ADC_Val >> 6) & 0x03FF;
ADC_Convert(ADC_Val);
/* Convert ADC value into ASCII for LCD Display */
LCD_Disp(0x83, "ADC Value");
LCD_Cmd(0xC5);
LCD_Data(FourthBit);
LCD_Cmd(0xC6);
LCD_Data(ThrdBit)
;
LCD_Cmd(0xC7);
LCD_Data(SecondBit);
LCD_Cmd(0xC8);
LCD_Data(FirstBit);
Delay(40000);
}
}

2.

#include <LPC214x.H> /* LPC214x definitions */

#define CR 0x0D #define


PLOCK 0x400
/***************
* Function Prototypes
*********/
void ADC_Init(void); /* ADC Init Function */
void ADC_Convert(unsigned int); /* ADC Display Function */
unsigned int ADC_Val; /* ADC Result (HEX) */
unsigned int FirstBit,SecondBit,ThrdBit,FourthBit;
//********************
* Function Prototypes
*
**************************/
void LCD_Init(void); /* LCD Init Function */
void LCD_Delay(unsigned int); /* LCD LCD_Delay Function */
void LCD_Cmd(unsigned long); /* LCD Command Function */
void LCD_Data(unsigned long); /* LCD Data Function */
void LCD_Disp(unsigned char,unsigned char *); /* LCD Display Function */
/***************************
* LCD Pin Out Discription
*
***************************/
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;

#define EN_Set IO0SET = 0x00800000;


#define EN_Clr IO0CLR = 0x00800000;
/*****************************
* LCD_Delay
* Description : This function provide LCD_Delay in Mili Sec.
***************************/
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;

for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
/****************************
* LCD initialization
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set 8bit : 2 Line 5x7 Dots (0x38)
* 2. Display On curser Off (0x0C)
* 3. Clear Display (0x01)
* 4. Entry Mode (0x06)
* Note : This function should be called once before any of the other
functions
****************************/
void LCD_Init(void)
{
LCD_Cmd(0x38); /* Function Set 8bit : 2 Line 5x7 Dots */
LCD_Cmd(0x0C); /* Display On curser Off */
LCD_Cmd(0x01); /* Clear Display */
LCD_Cmd(0X06); /* Entry Mode */
}

/*****************************
* LCD Command (Shifting is Done here)
*
* Description : This function initializes the LCD module by the following steps:

* Note : Here we have selected Pin P1.16 to P1.23 as LCD data line,
* thats why we need to shift data by 16.
****************************/
void LCD_Cmd(unsigned long Cmd)
{
unsigned long Shifted_Cmd;

Shifted_Cmd = Cmd << 16; /* because We have selected P1.16 to P1.23 as


LCD data line */

RS_Clr; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET = Shifted_Cmd; /* Write Command Value to LCD Data Pin */


LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}

/****************************
* LCD Data
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set Register select(RS) to High
* 2. Set enable pin high to low
* 3. Send data to LCd data pin
* Note : Here we have selected Port 1 Pin P1.16 to P1.23 as LCD data
line thats
* why we need to shift data by 16.
*****************************/
void LCD_Data(unsigned long Data)
{

RS_Set; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}
/*****************************
* LCD Display
*
* Description : This function initializes the LCD module by the following steps:
* 1. Send Loc from where data needs to write
* 2. Display string on LCD
*****************************/
void LCD_Disp(unsigned char Loc, unsigned char *String)
{
LCD_Cmd(Loc); /* Send Command to LCd */
while(*String) /* Wait untill Null char come */
{
LCD_Data(*String++); /* Write data to LCD */
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}
OUTPUT

RESULT

Thus the interfacing of ADC (In-built) with ARM processor has been verified and observed
the output successfully.
Ex. No: 2 b
INTERFACING DAC

AIM

Write a program to interface DAC (On chip DAC).

EQUIPMENT NEEDED

1. Nvis 5004B board


2. Adapter 5volt/1Amp
3. USB Cable
4. DSO/Oscilloscope
5. 2mm Patch Chord

PROCEDURE

1. Connect the USB cable to USB port of your PC and UART0( B Type USB) port of the
board (in PC interface & ISP section) provided on the board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the
ISP mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “DAC Square generation .hex” (CD-drive\ Onboard Program\ 7. DAC Interfacing\
DAC Square generation .hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Put 4 Dip switches provided in the ‘ADC Interface’ block in the ON position
9. Switch ‘On’ the supply, then press reset switch.
10. Observe Signal on “Aout” with DSO/Oscilloscope .
PROGRAM

1. Sawtooth

#include<LPC214x.H>

void msdelay(unsigned long);

/****************************
MAIN ROUTINE

************************/
int main(void)
{

unsigned int DAC_Val;

IO1DIR = 0xFFFF0040;
IO0SET = 0x00000000;
VPBDIV = 0x01;
PINSEL0 = 0x00030000; //channel AD1.1
PINSEL1 = 0x00080000; //ENABLE DAC PIN

while (1) /*START FIRST WHILE*/


{
for(DAC_Val=0;DAC_Val<=0x3FF;DAC_Val++)
{
IO1SET = DAC_Val;
DACR = DAC_Val<<6;
msdelay(100);
}
}
}
/***********************
FUNCTION FOR DELAY GENERATION
************************/
void msdelay (unsigned long a) // DELAY ROUTINE
{
while(--a!=0);
}

/**************************
FUNCTION ENDS
HERE
************************/

2. Squarewave
#include<LPC214x.H>

void msdelay(unsigned long);

/***************************
MAIN ROUTINE
**************************************/
int main(void)
{
unsigned int DAC_Val;

IO1DIR = 0xFFFF0040;
IO0SET = 0x00000000;
VPBDIV = 0x01;
PINSEL0 = 0x00030000; //channel AD1.1
PINSEL1 = 0x00080000; //ENABLE DAC PIN
AD1CR = 0x01210402 ; /* Setup A/D: 10-bit AIN0 @ 3MHz */

while (1) /*START FIRST WHILE*/


{
DAC_Val = 0x03FF;
DACR=DAC_Val<<6;
msdelay(200);

DAC_Val = 0x00;
DACR =DAC_Val<<6;
msdelay(200);
}
}
/**********************
FUNCTION FOR DELAY GENERATION
************************/
void msdelay (unsigned long a) // DELAY ROUTINE
{
while(--a!=0);
}

/**************************
FUNCTION ENDS HERE
************************/
OUTPUT

RESULT

Thus the interfacing of DAC (In-built) with ARM processor has been verified and observed the
output successfully.
Ex. No: 3 a
INTERFACING LED

AIM

To write a program for LED Interface.

EQUIPMENT NEEDED

1. Nvis 5004B board


2. Adapter 5volt/1Amp
3. USB Cable

PROCEDURE
1. Connect the USB cable (supplied along with the board) to USB port of your PC and
UART0( B Type USB) port of the board (in PC interface & ISP section) provided on the
board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the
ISP mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “LED_Interface.hex” (CD-drive\ Onboard Program\ 2..LED Interface\
LED_Interface.hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Put all the switches provided in the ‘LED Interface’ block in the ON position.
9. Put all the switches provided in the ‘LCD Interface’ block in the OFF position.
10. Switch ‘On’ the supply, then press reset switch.
11. Observe the LED glowing according to program.

PROGRAM

#include <LPC214x.H>
/******************** Delay
* Description : This function provide Delay in Mili Sec.
***********/
void MSdelay(unsigned int rTime)
{
unsigned int i,j;for(i=0;i<=rTime;i++)
for(j=0;j<4867;j++);
}
/**********************
* Main:
* Description : This function used to interface 8 LEDs.
*********************************/
int main(void)
{
IO1DIR = 0x00FF0000; /* Define Port1 pin P1.16 to P1.23 as output */
while (1)
{
IO1SET = 0x00FF0000; /* Glow All LEDs */
MSdelay (100); /* Delay */
IO1CLR = 0x00FF0000;
MSdelay (100); /* Delay */

}
}
OUTPUT

RESULT

Thus the interfacing of LED with ARM DEVELOPMENT KIT was done by using embedded C
program.
Ex. No: 3 b
INTERFACING PWM

AIM

To write a program PWM Interface(On chip).

EQUIPMENT NEEDED

1. Nvis 5004B board


2. Adapter 5volt/1Amp
3. USB Cable
4. DSO/Oscilloscope
5. 2mm Patch Chord

PROCEDURE
1. Connect the USB cable to USB port of your PC and UART0( B Type USB) port of the
board (in PC interface & ISP section) provided on the board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the
ISP mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “PWM Interface .hex” (CD-drive\ Onboard Program\ 10.PWM Interface \RTC
Interface .hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Switch ‘On’ the supply, then press reset switch.
9. Put 1,2, Dip switches provided in the ‘ADC Interface’ block in the ON position
10. Observe Signal on “PWM1 & PWM2” with DSO/Oscilloscope .

PROGRAM

#include <lpc214x.h>
/*****************************
** Function name: PWM_Init
**
** Descriptions: PWM initialization, setup all GPIOs to PWM0~6,
** reset counter, all latches are enabled.
*********/
void PWM_Init(unsigned int cycle)
{ PINSEL0 = 0x000A800A /* set GPIOs for all PWMs *
PINSEL1 = 0x00000400;

PWMTCR = 0x00000002; /* Counter Reset */


PWMPR = 0x00000000; /* count frequency:Fpclk */

PWMMR0 = cycle; /* set PWM cycle */


PWMMR1 = cycle * 5/6;
PWMMR2 = cycle * 2/3;
PWMMR3 = cycle * 1/2;
PWMMR4 = cycle * 1/3;
PWMMR5 = cycle * 1/6;

PWMLER = 0x0000007F; /* all PWM latch enabled */


}
/********************************************************************
**********
** Function name: PWM_Set
**
** Descriptions: PWM cycle setup
*********************************************************************
*********/
void PWM_Set( unsigned long cycle, unsigned long offset )
{
PWMMR0 = cycle; /* set PWM cycle */
PWMMR1 = cycle * 5/6 + offset;
PWMMR2 = cycle * 2/3 + offset;
PWMMR3 = cycle * 1/2 + offset;
PWMMR4 = cycle * 1/3 + offset;
PWMMR5 = cycle * 1/6 + offset;
}
/***********************
** Function name: PWM_Start
**
** Descriptions: Enable PWM by setting the PCR, PTCR registers
*********/
void PWM_Start( void )
{
PWMPCR = 0x00007E00; /* All single edge, all enable */
PWMTCR=0x09; /* counter enable, PWM enable */
}
/*******************************
* Main Routine
*****************************/
int main(void)
{
unsigned long cycle = 2000, Offset = 100;

PWM_Init(0); /* PWM Init */


PWM_Set(cycle,Offset); /* Set PWM : Cycle and offset*/
PWM_Start(); /* Start PWM genration */

while(1); /* Loop forever */


}
OUTPUT

RESULT

Thus the interfacing of PWM with ARM DEVELOPMENT KIT was done by using embedded C
program.
Ex. No: 4 a
INTERFACING PWM

AIM

To write a program Real Time Clock Interface(On chip).

EQUIPMENT NEEDED
1. Nvis 5004B board
2. Adapter 5volt/1Amp
3. USB Cable

PROCEDURE
1. Connect the USB cable to USB port of your PC and UART0( B Type USB) port of the
board (in PC interface & ISP section) provided on the board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the ISP
mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “RTC Interface .hex” (CD-drive\ Onboard Program\ 9. RTC Interface
\RTC Interface .hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Switch ‘On’ the supply, then press reset switch.
9. Close Flash utility and open Hypertermianal select comport and restore default
configuration(Baud rate 9600bps).
10. "Nvis Technologies" after "Time:10:10:10 Date:10:01:10" display on hyperterminal.

PROGRAM

#include <LPC214x.H> /* LPC214x definitions */

#define CR 0x0D #define


PLOCK 0x400
/*********************************
* Function Prototypes
*
*********/
extern void RTC_Init(void); /* RTC Init Function */
extern void RTC_Disp(unsigned char); /* RTC Display Function */
extern unsigned char Dec2Hex(unsigned char); /* Dec to Hex Converter */

unsigned char Get_Char(void);


unsigned char Send_Char(unsigned char ch);
void Send_String(unsigned char *ch);

/********************************
* Delay
* Description : This function provide Delay in Mili Sec.
************************************/
extern void Delay(unsigned int Time)
{
unsigned int i,j;

for(i=0;i<=Time;i++)
for(j=0;j<110;j++);
}
/******************
* Feed Init function
*************/
static void feed(void)
{
PLL0FEED = 0xAA;
PLL0FEED = 0x55;
}
/***************************
* PLL Init function
*************/
void PLL_Init()
{
PLL0CFG = 0x24;
feed(); /* Enabling the PLL */
PLL0CON = 0x01;
feed(); /* Wait for the PLL to lock set frequency */
while(!(PLL0STAT & PLOCK)); /*
Connect the PLL as the clock source */ PLL0CON = 0x3;
feed(); /* Enabling MAM and setting number of clocks
used for Flash memory fetch (4 cclks in this case) */
MAMTIM = 0x04;
MAMCR = 0x02; /* Setting peripheral Clock (pclk) to System Clock (cclk)*/
VPBDIV = 0x01;
}
/*****************************
* UART0 Initialization
*
* Description : This function Initializes the UART0.
* Note : This function should be called once before any of the other
functions of UART0.
****************************/

void UART0_Init()
{
PINSEL0 = 0x05; /* Enable RxD0 and TxD0 */
U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U0DLL = 0x86; /* 9600 Baud Rate @60MHz VPB Clock */
U0DLM = 0x01;
U0LCR = 0x03; /* DLAB = 0 */
VPBDIV = 0x01;
}
/***********************************
* RTC initialization
*
* Description : This function initializes the RTC Clock by the following steps:
* 1. Define Prescaler value for RTC
* 2. configure clock control register
* 3. Enable Clock and Intterupt for every one
second
* 4. clear the display by writing 0 to the whole
screen
* 5. Initialize values of RTC registers
* Note : This function should be called once before any of the other
functions of RTC.
************************************/
extern void RTC_Init()
{
PREINT = 0x00000392; /* RTC - Prescaler value, integer portion */
PREFRAC = 0x00004380; /* RTC - Prescaler value, integer portion */

CCR= 0x11; /* Clock Control Register. Controls the function of the


clock divider */
/* Clock enable + 32'767Hz quartz enable */
CIIR = 0x01; /* Interupt every second */
PCONP =0x1517BE; /* Power Control for Peripherals */
SEC = 10; /* Init RTC Registers for Default Values */
MIN = 50; /* Minute Register */
HOUR = 12; /* Hours Register */
DOM = 24; /* Day of Month Register */
MONTH =02; /* Month Register */
YEAR = 16; /* Year Register */
}
/*********************************
* RTC Display Value on LCD
* Description : This function initializes the LCD module by the following steps:
* 1. Convert RTC Value from decimal to hex
* 2. Conver each byte into ASCII
* 3. Send data to LCD
* Arguments : 'RTC_Value' is the Value which is write to the display in a repetitive
manner.
************************************/
extern void RTC_Disp(unsigned char RTC_Value)
{
unsigned char buf = 0;

RTC_Value = Dec2Hex(RTC_Value);

buf = RTC_Value & 0xF0; /* Filter for high byte */


buf = (buf >> 4)|(0x30); /* Convert to ascii code */
Send_Char(buf); /* Show on LCD */
buf = RTC_Value & 0x0F; /* Filter for low byte */
buf = buf | 0x30; /* Convert to ascii code */
Send_Char(buf); /* Show on LCD */
}
/**********************************
* Decimal To Hex Conversion
* Description : This function is provide delay in mili second
* Arguments : 'DEc' is the Value which needs to convert in hexadecimal.
*********************************************************************
************************************/
extern unsigned char Dec2Hex(unsigned char Dec)
{
return((Dec/0xA)*0x10+(Dec%0xA));
}

/*********************************
* Main
* Description : This function Initialize the LCD and RTC.
*********************************/
int main (void) /* program exec. starts here */
{
RTC_Init(); /* RTC Initialize */
UART0_Init(); /* Init UART 0 */
Delay(100);
Send_String("Nvis Technologies\n");
Delay(3000);
while(1)
{
Send_String("Time:"); /* Display "Time:" on LCD */

RTC_Disp(HOUR); /* Display HOUR Value (HOUR - RTC Register) */


Send_String(":");
RTC_Disp(MIN); /* Display Minute Value (MIN - RTC Register) */
Send_String(":");
RTC_Disp(SEC); /* Display Second Value (SEC - RTC Register) */
Send_String(" Date:"); /* Display "Time:" on LCD
*/ RTC_Disp(DOM); /* Display ADC Value on LCD
*/
Send_String(":");

RTC_Disp(MONTH);
Send_String(":");

RTC_Disp(YEAR);
Send_String("\n");
}
}

/*************************
* Get_Char
* Description : Read a character from Serial Port
****************************/
unsigned char Get_Char(void)
{
while (!(U0LSR&0x01));
return U0RBR;
}
/**************************
* Send_Char
* Description : Write a character from Serial Port
****************************/
unsigned char Send_Char(unsigned char ch)
{
if (ch == '\n')
{
while(!(U0LSR & 0x20));
U0THR = CR; /* output CR */
}
while(!(U0LSR & 0x20));

return (U0THR = ch);


}
/****************************Send_String

* Description : Write a string from Serial Port


****************************/
void Send_String(unsigned char *ch)
{
while(*ch != '\0')
{
Send_Char(*ch++);
}
}
OUTPUT

RESULT

Thus the real time clock and serial port interfacing with ARM DEVELOPMENT KIT processor
has been executed successfully.
Ex. No: 45 b
a
LCD DISPLAY INTERFACE

AIM

To write a program for 16x2 LCD Display Interface.

EQUIPMENT NEEDED

1. Nvis 5004B board


2. Adapter 5volt/1Amp
3. USB Cable

PROCEDURE
1. Connect the USB cable (supplied along with the board) to USB port of your PC and
UART0( B Type USB) port of the board (in PC interface & ISP section) provided on the
board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the
ISP mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “LCD_Interface.hex” (CD-drive\ Onboard Program\ 1..LCD Interface\
LCD_Interface.hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Put all the switches provided in the ‘LED Interface’ block in the OFF position.
9. Put all the switches provided in the ‘LCD Interface’ block in the ON position.
10. Put 6,7,8 switches provided in the ‘Motor Drive ’ block in the ON position.
11. Switch ‘On’ the supply, then press reset switch.
12. Observe the LCD Display according to program.

PROGRAM

#include<lpc214x.h> * Function Prototypes *


void LCD_Init(void); /* LCD Init Function */
void LCD_Delay(unsigned int); /* LCD LCD_Delay Function */
void LCD_Cmd(unsigned long); /* LCD Command Function */
void LCD_Data(unsigned long); /* LCD Data Function */
void LCD_Disp(unsigned char,unsigned char *); /* LCD Display Function */
/************************
* LCD Pin Out Discription
**************************/

#define RS_Set IO0SET = 0x00200000;


#define RS_Clr IO0CLR = 0x00200000;

#define EN_Set IO0SET = 0x00800000;


#define EN_Clr IO0CLR = 0x00800000;

/***************************
* LCD_Delay
* Description : This function provide LCD_Delay in Mili Sec.
***************************/
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;

for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}

/***************************
* LCD initialization
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set 8bit : 2 Line 5x7 Dots (0x38)
* 2. Display On curser Off (0x0C)
* 3. Clear Display (0x01)
* 4. Entry Mode (0x06)
* Note : This function should be called once before any of the other
functions
****************************/
void LCD_Init(void)
{
LCD_Cmd(0x38); /* Function Set 8bit : 2 Line 5x7 Dots */
LCD_Cmd(0x0C); /* Display On curser Off */
LCD_Cmd(0x01); /* Clear Display */
LCD_Cmd(0X06); /* Entry Mode */
}

/******************************
* LCD Command (Shifting is Done here)
* Description : This function initializes the LCD module by the following steps:
* Note : Here we have selected Pin P1.16 to P1.23 as LCD data line,
thats why we need to shift data by 16.
****************************/

void LCD_Cmd(unsigned long Cmd)


{
unsigned long Shifted_Cmd;
Shifted_Cmd = Cmd << 16; /* because We have selected P1.16 to P1.23 as
LCD data line */

RS_Clr; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET=Shifted_Cmd; /* Write Command Value to LCD Data Pin */


LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}

/***************************
* LCD Data
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set Register select(RS) to High
* 2. Set enable pin high to low
* 3. Send data to LCd data pin
* Note : Here we have selected Port 1 Pin P1.16 to P1.23 as LCD data
line thats
* why we need to shift data by 16.
*****************************/

void LCD_Data(unsigned long Data)


{

RS_Set; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}
/****************************
* LCD Display
* Description : This function initializes the LCD module by the following steps:
* 1. Send Loc from where data needs to write
* 2. Display string on LCD
*****************************/
void LCD_Disp(unsigned char Loc, unsigned char *String)
{
LCD_Cmd(Loc); /* Send Command to LCd
*/
while(*String) /* Wait untill Null char
come */ /****************************
* Main Routine
*****************************/
int main(void)
} {
IO1DIR = 0x00FF0000; /* Set LCD_DATA pin as out
put */
IO0DIR = 0x00FF0000; /* Set LCD_Control pin as out
put */
LCD_Init(); /*
Initialize LCD */
while(1)
{
LCD_Disp(0x80, " NVIS "); /* Display "NVIS" */
LCD_Disp(0xC0, " Technologies "); /* Display "Technologies" */
}
}
{
LCD_Data(*String++); /* Write data to LCD */
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}
OUTPUT

RESULT

Thus the interfacing of LCD with ARM DEVELOPMENT KIT microcontroller using embedded C
program has been verified successfully.
Ex. No: 5 b
KEYBOARD INTERFACE

AIM

To write a program for 4x4 Hex Keypad Interface.

EQUIPMENT NEEDED

1. Nvis 5004B board


2. Adapter 5volt/1Amp
3. USB Cable

PROCEDURE

1. Connect the USB cable (supplied along with the board) to USB port of your PC and
UART0( B Type USB) port of the board (in PC interface & ISP section) provided on the
board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the
ISP mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “LED_Interface.hex” (CD-drive\ Onboard Program\ 3..4x4 Hex Keypad Interface \
4x4 Hex Keypad Interface.hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Put all the switches provided in the ‘LED Interface’ block in the OFF position.
9. Put all the switches provided in the ‘LCD Interface’ block in the ON position.
10. Put 6,7,8 switches provided in the ‘Motor Module’ block in the ON position
11. Put all the switches provided in the ‘4x4 Hex Keypad’ block in the ON position
12. Switch ‘On’ the supply, then press reset switch.
13. Observe the Character display on LCD when user press Keypad according to program.
PROGRAM

/********************************************************************
**************************
* FileName: main.c
* Processor: LPC2148
* Complier: Keil
* Keil IDE 4
* Company: Nvis Technologies Pvt. Ltd.
*
*********************************************************************
***************************
* File Description: 4x4 Hex Keypad Interface with Nvis 5004B
* Required Module: Nvis 5004B
*
* Steps for Operation
* Step 1:
* Switch ON Nvis 5004B
* Turn the toggle switch in ISP Mode
* Burn Program 4x4 Hex keypad Interface.hex file in LPC2148
Microcontroller using Flash Utility
* Turn the toggle switch in RUN mode and press reset switch
* Refer manual for more details
* Step 2:
* Connections:
* Switch ON all DIP switch into LCD Interface Block and close all DIP
Switch in LED Inteface Block
* Switch ON 6,7,8 DIP switch into Motor Driver Block
* Switch ON all DIP switch into 4x4
hex keypad Interface Block
* Connect Jumper into LCD Interface Block
* Step 3:-
* OutPut:
* Firstly on LCD "Nvis Technologies" will display, then On
LCD "Key Pressed" will display.
* But whenever you will press any key the same character will
display on LCD second row.
*
*
* Change History:
* Name Date Changes
* Rajkumar Singh 15/01/16 Modified Version
*********************************************************************
***************************/
#include <LPC214x.H> /* LPC214x
definitions */
/********************************************************************
********************
* LCD Pin Out Discription
*********************************************************************
*******************/
#define RS_Set IO0SET =
0x00200000; #define RS_Clr
IO0CLR = 0x00200000;

#define EN_Set IO0SET =


0x00800000; #define EN_Clr
IO0CLR = 0x00800000;
/********************************************************************
*********
* Function Prototypes *
*********************************************************************
*********/
void LCD_Init(void); /* LCD Init
Function */
void LCD_Delay(unsigned int); /* LCD
LCD_Delay Function */
void LCD_Cmd(unsigned long); /* LCD
Command Function */
void LCD_Data(unsigned long); /* LCD
Data Function */
void LCD_Disp(unsigned char,unsigned char *); /* LCD Display Function */
/********************************************************************
*************************************
* LCD_Delay
* Description : This function provide LCD_Delay in Mili Sec.
*********************************************************************
************************************/
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;

for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
/********************************************************************
*************************************
* LCD initialization
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set 8bit : 2 Line 5x7 Dots (0x38)
* 2. Display On curser Off (0x0C)
* 3. Clear Display (0x01)
* 4. Entry Mode (0x06)
* Note : This function should be called once before any of the other
functions
*********************************************************************
************************************/
void LCD_Init(void)
{
LCD_Cmd(0x38); /* Function Set 8bit : 2 Line 5x7 Dots
*/ LCD_Cmd(0x0C); /* Display On curser Off */
LCD_Cmd(0x01); /* Clear Display */
LCD_Cmd(0X06); /* Entry Mode */
}

/********************************************************************
*************************************
* LCD Command (Shifting is Done here)
*
* Description : This function initializes the LCD module by the following steps:
* Note : Here we have selected Pin P1.16 to P1.23 as LCD data line thats
why we need to shift data by 16.
*********************************************************************
************************************/
void LCD_Cmd(unsigned long Cmd)
{
unsigned long Shifted_Cmd;

Shifted_Cmd = Cmd << 16; /* because We have selected P1.16 to P1.23 as


LCD data line */

RS_Clr; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);
Pin */
}IO1SET = Shifted_Cmd; /*
Write Command Value to LCD Data LCD_Delay(30); /*
LCD_Delay for enable Clock*/
EN_Clr; /* Enable Pin Clear */
LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */

/********************************************************************
*************************************
* LCD Data
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set Register select(RS) to High
* 2. Set enable pin high to low

3. Send data to LCd data pin


* Note : Here we have selected Port 1 Pin P1.16 to P1.23 as LCD data
line thats why we need to shift data by 16.
*********************************************************************
************************************/
void LCD_Data(unsigned long Data)
{
RS_Set; /* RS Pin Clear */
LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(30); /* LCD_Delay for enable
Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}
/********************************************************************
*************************************
* LCD Display
*
* Description : This function initializes the LCD module by the following steps:
* 1. Send Loc from where data needs to write
* 2. Display string on LCD
*********************************************************************

void LCD_Disp(unsigned char Loc, unsigned char *String)


{
LCD_Cmd(Loc); /* Send Command to LCd
*/
while(*String) /* Wait untill Null char come */
{
LCD_Data(*String++); /* Write data to LCD */
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}
}

/********************************************************************
**********************************
* Main:
*********************************************************************
*********************************/
int main(void)

{
IO0DIR = 0x00E00000; /* defined as
Outputs for LCD P0.21,22,23*/

IO1DIR = 0x0FFF0000; /* defined as Outputs for


keypad P1.23 to P1.17 Outputs for LCD P1.16 TO P1.23 */

LCD_Init();
LCD_Disp(0x80, " Nvis "); /* Display "NVIS" */
LCD_Disp(0xC0, " Technologies "); /* Display "Technologies"
*/;
LCD_Delay(5000);
LCD_Cmd(0x01); /* Clear
Display */
LCD_Disp(0x82," Key Pressed");

while(1)
{
/********************************************************************
*******************/
/* Check For ROW 1, All Column */
/********************************************************************
*******************/
IO1SET = 0x01000000; /* Set Row
1 */

if((IO1PIN & 0xF0000000)!= 0xF0000000)


_Disp(0xC8,"0");
IOCLR1 =
0x80000000;
}
LCD_Delay (100);
}
IO1CLR = 0x01000000; /* Clear
Row 1 */
/********************************************************************
*******************/
/* Check For ROW 2,All Column */
/********************************************************************
*******************/
IO1SET = 0x02000000; /* Set Row 1
*/
if((IO1PIN & 0xF0000000)!= 0xF0000000)

{
if((IO1PIN & 0x10000000) == 0x10000000) /*Row1, Column1*/
{Curser at '0xC6' */ pins */
}
LCD_Disp(0xC8,"2"); /*
Set

IOCLR1 = 0x10000000; /* Clear

else if((IO1PIN&0x20000000) == 0x20000000) /*Row1, Column2*/


{
LCD_Disp(0xC8,"5");
IOCLR1 =
0x20000000;
}
else if((IO1PIN&0x40000000) == 0x40000000) /*Row1, Column3*/
{
LCD_Disp(0xC8,"8");
IOCLR1 =
0x40000000;
}
else if((IO1PIN&0x80000000) == 0x80000000) /*Row1, Column4*/
{
LCD_Disp(0xC8,"A")
; IOCLR1 =
0x80000000;
}
LCD_Delay (100);
}
IO1CLR = 0x02000000; /* Clear
Row 1 */
//********************************************************************
*******************/
///*******************************************************************
********************/
IO1SET = 0x04000000; /* Set Row 1
*/
if((IO1PIN & 0xF0000000)!= 0xF0000000)
{
if((IO1PIN & 0x10000000) == 0x10000000) /*Row1, Column1*/
{
Curser at '0xC6' */ LCD_Disp(0xC8,"3"); /* Set
pins */
} IOCLR1 = 0x10000000; /* Clear

else if((IO1PIN&0x20000000) == 0x20000000) /*Row1, Column2*/


{
LCD_Disp(0xC8,"6");

IOCLR1 = 0x20000000;
}
else if((IO1PIN&0x40000000) == 0x40000000) /*Row1, Column3*/
{
LCD_Disp(0xC8,"9");
IOCLR1 =
0x40000000;
}
else if((IO1PIN&0x80000000) == 0x80000000) /*Row1, Column4*/
{
LCD_Disp(0xC8,"B")
; IOCLR1 =
0x80000000;
}

}
OUTPUT

RESULT

Thus the interfacing of keyboard with ARM DEVELOPMENT KIT microcontroller using
embedded C program has been verified successfully.
Ex. No: 6 a
INTERRUPT INTERFACE

AIM
To write a program for Interrupt Interface(On chip).

EQUIPMENT NEEDED

1. Nvis 5004B board


2. Adapter 5volt/1Amp
3. USB Cable
4. 2mm Patch Chord

PROCEDURE
1. Connect the USB cable to USB port of your PC and UART0( B Type USB) port of the
board (in PC interface & ISP section) provided on the board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the ISP
mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “Interrupt Interface .hex” (CD-drive\ Onboard Program\ 11. Interrupt0\ External
Interrupt .hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Put 1,2, Dip switches provided in the ‘ADC Interface’ block in the ON position
9. Put all Dip switches provided in the ‘LED Interface’ block in the ON position
10. Connect Patch card from INT0 to PB1.
11. Switch ‘On’ the supply, then press reset switch.
12. By default all LED will off. Now connect patch cord from "INT0" on Interrupt block to
"PB1" banana socket. When PB1 switch press then all LED will on.
PROGRAM

1. Interrupt 0

#include <LPC214x.H>

#defineCR 0x0D
unsigned int Cnt;
void Send_Char(unsigned char ch);

s/***********************************
PLLInit
* Description : PLL Settings for Clock
************************************/
void PLLInit(void)
{
unsigned long loop_ctr;
/* Configure PLL0, which determines the CPU clock */
PLL1CFG = 0x00000024; /* Use PLL values of M = 4 and P = 2 */
PLL1CON = 0x01; /* Set the PLL Enable bit*/

PLL1FEED = 0xAA; /* Write to the PLL Feed register*/


PLL1FEED = 0x55;

loop_ctr = 10000; /* Wait for the PLL to lock into the new frequency */

while (((PLL1STAT<<10) == 0) && (loop_ctr > 0))


{
loop_ctr--;
}
PLL1CON = 0x02; /* Connect the PLL*/
PLL1FEED = 0xA0; /* Write to the PLL Feed register*/
PLL1FEED = 0x55;
VPBDIV =0x00000001; /* Set the VPB frequency to one- half of
the CPU clock */
}

/* Default Interrupt Function: may be called when timer ISR is disabled */

2. INTERRUPT
1 #include
<LPC214x.H>
#defineCR 0x0D
unsigned int Cnt;
void Send_Char(unsigned char ch);
/********************************
* PLLInit
* Description : PLL Settings for Clock
************************************/
void PLLInit(void)
{
unsigned long loop_ctr;
/* Configure PLL0, which determines the CPU clock*/
PLL1CFG = 0x00000024; /* Use PLL values of M = 4 and P = 2 */
PLL1CON = 0x01; /* Set the PLL Enable bit*/

PLL1FEED = 0xAA; /* Write to the PLL Feed register*/


PLL1FEED = 0x55;

loop_ctr = 10000; /* Wait for the PLL to lock into the new frequency */

while (((PLL1STAT<<10) == 0) && (loop_ctr > 0))


{
loop_ctr--;
}
PLL1CON = 0x02; /* Connect the PLL */
PLL1FEED = 0xA0; /* Write to the PLL Feed register*/
PLL1FEED = 0x55;
VPBDIV =0x00000001; /* Set the VPB frequency to one- half of
the CPU clock */
}

/* Default Interrupt Function: may be called when timer ISR is disabled */


void DefISR (void) irq {
;
}
irq void ExtInterrupt1_ISR (void)
{
//Clear the peripheral interrupt flag
EXTINT = 0x00000002;
IO1SET = 0x00FF0000; /* All LED Glow*/

Send_Char('E'); /* Send Ext. Int1 to Serial Port */


Send_Char('X');
Send_Char('T');
Send_Char('.');
Send_Char(' ');
Send_Char('I');
Send_Char('N');
Send_Char('T');
Send_Char('1');
Send_Char('\n'); /* New Line */

//Dummy writetosignal end ofinterrupt


VICVectAddr =0x00000000;
}
/************************************
* InitExtInt1

* Description : Init External Interrupt 1


*********************************************************************
************************************/
void InitExtInt1(void)
{
VICVectCntl0 = 0x20 | 0x0F; /* use it for External Interrupt 1 */
VICIntEnable = 0x00008000; /* Enable External Interrupt 1*/
VICVectAddr0 = (unsigned long)ExtInterrupt1_ISR;
/* set interrupt vector in 0 */
VICDefVectAddr = (unsigned long) DefISR;
/* un-assigned VIC interrupts */
}
/****************************
* UART1 Initialization
*
* Description : This function Initializes the UART1.
* Note : This function should be called once before any of the other
functions of UART1.
****************************/
void UART0_Init()
{
PINSEL0 |= 0x0005; /* Enable RxD1 and TxD1 */
U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U0DLL = 0x86; /* 9600 Baud Rate @ 15MHz VPB Clock */
U0DLM = 0x01; /* 9600 Baud Rate @ 15MHz VPB Clock */
U0LCR = 0x03; /* DLAB = 0 */
}
/*************************
* Get_Char
* Description : Read a character from Serial Port
****************************/
unsigned char Get_Char(void)
{
while(!(U0LSR & 0x01)); /* RDR */
return U0RBR;
}
/*************************
* Send_Char
* Description : Write a character to Serial Port
****************************/
void Send_Char(unsigned char ch)
{
if(ch == '\n') {
while (!(U0LSR & 0x20));
U0THR = CR; /* output CR */
}
while(!(U0LSR & 0x20));

U0THR = ch;
}

/************************************
* main
* Description : Main funtion of the program
************************************/
int main(void)
{
PLLInit(); /* Init PLL */
PINSEL0 = 0x200000C0; /*Enable the EXTINT1 interrupt */
PINSEL2 = 0x00000000; /* Select pin for Timer*/
IO1DIR= 0x00FF0000; /* Set direction for Pin P1.16 to Pin P1.23
as output */
InitExtInt1(); /* Init Extenal Interrupt 1 */
UART0_Init(); /* Init UART 1 */
Send_Char('N');
Send_Char('v');
Send_Char('i');
Send_Char('s');
Send_Char('\n');

while(1)
{
IO1CLR = 0x00FF0000; /* Clear All LED*/
Send_Char('M');
Send_Char('a');
Send_Char('i');
Send_Char('n');
Send_Char(' ');
Send_Char('L');
Send_Char('o');
Send_Char('o');
Send_Char('p');
Send_Char('\n');

}
}
OUTPUT

RESULT

Thus the circuit is designed and programmed to develop and verify Embedded C program for
Interrupt Interfacing using ARM DEVELOPMENT KIT.
Ex. No: 6 b
EEPROM INTERFACE

AIM
Write a program for I2C Device Interface Serial EEPROM.

EQUIPMENT NEEDED
1. Nvis 5004B board
2. Adapter 5volt/1Amp
3. USB Cable

PROCEDURE
1. Connect the USB cable to USB port of your PC and UART0( B Type USB) port of the board
(in PC interface & ISP section) provided on the board.

2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the ISP
mode.

3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.

4. Connect the power cable to the board and switch ‘ON’ the power switch.

5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch LPC210x_ISP.exe .)
and select the appropriate port settings (use baud rate 9600).

6. Program “ I2C EEPROM Interface .hex” (CD-drive\ Onboard Program\ 12.I2CEEPROM\ I2C
EEPROM.hex).

7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC Interface &
ISP Section” block on the RUN mode.

8. Put 3,4, Dip switches provided in the“I2C & SPI ” block. in the ON position

9. Put all Dip switches provided in the ‘LCD Interface’ block in the ON position

10. Put 6,7,8 Dip switches provided in the ‘Motor Module’ block in the ON position

11. Switch ‘On’ the supply, then press reset switch.

12. LCD Display show reading, writing and data matching and not matching
PROGRAM

**********************/
#include "lpc214x.h"
#include "i2c.h"
#include "i2cDevice.h"
/*********************************
* I2C Device Definition
*******************************/
#define Dev_Add 0xA0
#define Dev_MemLoc 0x40
#define Data_Value 'E' //user can change value
#define LED1_ON IO0SET = 0x01
#define LED1_OFF IO0CLR = 0x01
/***********************
* Function Prototypes *
**********************/
void LCD_Init(void); /* LCD Init Function */
void LCD_Delay(unsigned int); /* LCD LCD_Delay Function */
void LCD_Cmd(unsigned long); /* LCD Command Function */
void LCD_Data(unsigned long); /* LCD Data Function */
void LCD_Disp(unsigned char,unsigned char *); /* LCD Display Function */
/*************************************************************************
**********************
* LCD Pin Out Discription
*
*************************************************************************
***********************/
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;

#define EN_Set IO0SET = 0x00800000;


#define EN_Clr IO0CLR = 0x00800000;
/************************
* LCD_Delay
* Description : This function provide LCD_Delay in Mili Sec.
***********************/
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;

for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
/***********************
* LCD initialization
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set 8bit : 2 Line 5x7 Dots (0x38)
* 2. Display On curser Off (0x0C)
* 3. Clear Display (0x01)
* 4. Entry Mode (0x06)
* Note : This function should be called once before any of the other functions
*************************************************************************
************************/
void LCD_Init(void)
{
LCD_Cmd(0x38); /* Function Set 8bit : 2 Line 5x7 Dots */
LCD_Cmd(0x0C); /* Display On curser Off */
LCD_Cmd(0x01); /* Clear Display */
LCD_Cmd(0X06); /* Entry Mode */
}

/******************************
LCD Command (Shifting is Done here)
*
* Description : This function initializes the LCD module by the following steps:
* Note : Here we have selected Pin P1.16 to P1.23 as LCD data line,
* thats why we need to shift data by 16.
*************************************************************************
************************/
void LCD_Cmd(unsigned long Cmd)
{
unsigned long Shifted_Cmd;

Shifted_Cmd = Cmd << 16; /* because We have selected P1.16 to P1.23 as LCD
data line */

RS_Clr; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET = Shifted_Cmd; /* Write Command Value to LCD Data Pin */


LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}

/****************************
* LCD Data
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set Register select(RS) to High
* 2. Set enable pin high to low
* 3. Send data to LCd data pin
* Note : Here we have selected Port 1 Pin P1.16 to P1.23 as LCD data line thats
* why we need to shift data by 16.
*************************/
void LCD_Data(unsigned long Data)
{

RS_Set; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}
/*************************************************************************
************************
* LCD Display
*
* Description : This function initializes the LCD module by the following steps:
* 1. Send Loc from where data needs to write
* 2. Display string on LCD
*************************************************************************
*************************/
void LCD_Disp(unsigned char Loc, unsigned char *String)
{
LCD_Cmd(Loc); /* Send Command to LCd */
while(*String) /* Wait untill Null char come
*/
{
LCD_Data(*String++); /* Write data to LCD */
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}
}

/********************************
* Main Function
*******************************/
int main(void)
{
unsigned char RData; /* To received
data */

IO1DIR = 0x00FF0000; /* Set LCD_DATA pin as out put */


IO0DIR = 0x00FF0000; /* Set LCD_Control pin as out put */

LCD_Init();
I2C_EEPROM_Init(); /* Init I2C Com for 24LCxx EEPROM */
I2C_EEPROM_WriteByte(Dev_Add, Dev_MemLoc,Data_Value); /* Write data to I2C
EEPROM */
LCD_Disp(0x81,"Writing Data...");
LCD_Delay(5000);
RData = 0;
RData = I2C_EEPROM_ReadByte(Dev_Add,Dev_MemLoc); /* read data
From I2C EEPROM */
LCD_Disp(0x81,"Reading Data...");
LCD_Delay(5000);

if(RData == Data_Value) /* Compare to Received data to same data


which we wrote */
{
LCD_Disp(0x81," Data Match "); /* LED glow if
data matched */
LCD_Disp(0xC6,&RData);
}
else
{ LCD_Disp(0x81," Data Unmatch ");

while(1); /* Infinite loop */

}
OUTPUT

RESULT

Thus the program for I2C Device Interface Serial EEPROM is completed successfully.
Ex. No: 7
MAILBOX

AIM
To study and implement OS Real Time Mailbox.

EQUIPMENTS NEEDED
1. Nvis 5004B board
2. Adapter 5volt/1Amp
3. USB Cable

PROCEDURE
1. Connect the USB cable to USB port of your PC and UART0( B Type USB) port of the
board (in PC interface & ISP section) provided on the board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the
ISP mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of
Windows OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “mailbox .hex” (CD-drive\ RTOS Program\4.mailbox\ mailbox .hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Put 6,7,8 switches provided in the ‘LED Interface’ block in the ON position.
9. Switch ‘On’ the supply, then press reset switch.
10. Start the Hyper Terminal (start\ all program\ Accessories\ Communication\ Hyper
Terminal)

PROGRAM

#include <RTL.h> /* RTX kernel functions & defines */


//#include <LPC214x.H>
#include <LPC21xx.H> /* LPC21xx definitions */
#include <stdio.h>

#define CR 0x0D #define


PLOCK 0x400

OS_TID tsk1; /* assigned identification for task 1 */


OS_TID tsk2; /* assigned identification for task 2 */

typedef struct
{ /* Message object
structure */
float /* AD result of measured voltage */
voltage;
float /* AD result of measured current */
current;
} U32
T_MEAS; /* A counter value */
counter;
os_mbx_declare (MsgBox,16); /* Declare an RTX mailbox */
_declare_box (mpool,sizeof(T_MEAS),16); /* Dynamic memory pool */

task void send_task (void);


task void rec_task (void);
/*************************************************************************
********
* Feed Init function
*************************************************************************
*********/
//static void feed(void)
//{
// PLL0FEED = 0xAA;
// PLL0FEED = 0x55;
//}
/**********************
* PLL Init function
*********/
void PLL_Init()
{
// PLL0CFG = 0x24;
// feed(); /* Enabling the PLL
*/
// PLL0CON = 0x01;
// feed(); /* Wait for the PLL to lock set
frequency */
// while(!(PLL0STAT & PLOCK)); /* Connect the PLL as the clock source
*/
// PLL0CON = 0x3;
// feed(); /* Enabling MAM and setting
number of clocks used for Flash memory fetch (4 cclks in this case) */
MAMTIM = 0x04;
MAMCR = 0x02; /* Setting peripheral Clock
(pclk) to System Clock (cclk)
*/
VPBDIV = 0x01;
}

/*----------------------------------------------------------------------------
* Initialize serial interface
*---------------------------------------------------------------------------*/
void init_serial () {
// PINSEL0 = 0x00050000; /* Enable RxD1 and TxD1 */
// U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
// U1DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
// U1LCR = 0x03; /* DLAB = 0 */

PINSEL0 = 0x05; /* Enable RxD0 and TxD0 */


U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U0DLL = 0x86; /* 9600 Baud Rate @60MHz VPB Clock */
U0DLM = 0x01;
U0LCR =0x03; /* DLAB = 0 */
VPBDIV = 0x01;
}
/*
* Task 1: RTX Kernel starts this task with os_sys_init (send_task)
* */
task void send_task (void) {
T_MEAS *mptr;

tsk1 = os_tsk_self (); /* get own task identification number */ tsk2


= os_tsk_create (rec_task, 0); /* start task 2 */
os_mbx_init (MsgBox, sizeof(MsgBox));/* initialize the mailbox */
os_dly_wait (5); /* Startup delay for MCB21xx */

mptr = _alloc_box (mpool); /* Allocate a memory for the message */


mptr->voltage = 223.72; /* Set the message content */
mptr->current = 17.54;
mptr->counter = 120786;
os_mbx_send (MsgBox, mptr, 0xffff); /* Send the message to the mailbox */
IOSET1 = 0x10000;
os_dly_wait (100);

mptr = _alloc_box (mpool);


mptr->voltage = 227.23; /* Prepare a 2nd message */
mptr->current = 12.41;
mptr->counter = 170823;
os_mbx_send (MsgBox, mptr, 0xffff); /* And send it. */
os_tsk_pass (); /* Cooperative multitasking */
IOSET1 = 0x20000;
os_dly_wait (100);

mptr = _alloc_box (mpool);


mptr->voltage = 229.44; /* Prepare a 3rd message */
mptr->current = 11.89;
mptr->counter = 237178;
os_mbx_send (MsgBox, mptr, 0xffff); /* And send it. */
IOSET1 = 0x40000;
os_dly_wait (100);

os_tsk_delete_self (); /* We are done here, delete this task */


}

/*
* Task 2: RTX Kernel starts this task with os_tsk_create (rec_task, 0)
* */
task void rec_task (void) {
T_MEAS *rptr;

for (;;) {
os_mbx_wait (MsgBox, (void **)&rptr, 0xffff); /* wait for the message */
printf ("\nVoltage: %.2f V\n",rptr->voltage);
printf ("Current: %.2f A\n",rptr->current);
printf ("Number of cycles: %d\n",rptr->counter);
_free_box (mpool, rptr); /* free memory allocated for message */
}
}
/*
* Main: Initialize and start RTX Kernel
* */
int main(void) { /*programexecution startshere */

IODIR1 = 0xFF0000; /* P1.16..22 defined as Outputs */


init_serial (); /* initialize the serial interface */
_init_box (mpool, sizeof(mpool), /* initialize the 'mpool' memory for */
sizeof(T_MEAS)); /* the membox dynamic allocation */
os_sys_init (send_task); /* initialize and start task 1 */
}
/*
* end of file
* */
OUTPUT

RESULT

Thus the concept of Mailbox with ARM DEVELOPMENT KIT processor using embedded C
program was done and verified the message successfully.
Ex. No: 8 INTERRUPT PERFORMANCE CHARACTERISTICS OF ARM
AND FPGA

AIM
To verify the Interrupt performance characteristics of ARM and FPGA by using embedded C
program.

APPARATUS REQUIRED

1. ARM Development Kit LPC2148


2. Keil µVision3 IDE 1

PROCEDURE
Step 1: Give a double click on µvision 4 icon on the desk top, it will generate a window as shown
below
Step 2: To create new project go to project select new micro vision project.
Step 3: select a drive where you would like to create your project.
Step 4: Create a new folder and name it with your project name.
Step 5: Open that project folder and give a name of your project executable and save it.
Step 6: After saving it will show some window there you select your microcontroller company i.e
NXP from Phillips
Step 7: Select your chip as ARM DEVELOPMENT KIT
Step 8: After selecting chip click on OK then it will display some window asking to add
STARTUP. Select YES.
Step 9: A target is created and startup is added to your project targetand is shown below.
Step 10: To write your project code select a new from menu bar.
Step 11: It will display some text editor, to save that select SAVE option from menu bar.
Step 12: By giving a name with extension .C for c s and save it
Step 13: Write the code of your project and save it.
Step 14: To add c file to target give a right click on Source Group, choose “ADD s to Group”
option. Step 15: It will display some window there select the file and click on ADD option.
Step 16:It will be added to our target and it shows in the project window.
Step 17: Now give a right click on target in the project window and select “Options for Target”
Step 18: Find a window and go to output option and choose Create Hex option by selecting that
box. Step 19: In the same window go to Linker option and choose Use Memory Layout from
Target Dialog by selecting the box, and click OK.
Step 20: Compile the project and select Build Target option .

PROGRAM

#include// Define ARM DEVELOPMENT KIT Header


#include<stdio.h>
#include int volatile EINT1 = 0;
int volatile EINT2 = 0;
void ExtInt_Serve1(void)__irq;
void ExtInt_Serve1(void)__irq;
{
++EINT1;
EXTINT |= 2;
VICVectAddr = 1;
}
void ExtInt_Serve2(void)__irq
{
++EINT2;
EXTINT |= 4;
VICVectAddr = 0;
}
void main(void)
{
Serial_Init();
ExtInt_Init1(); //Initialize Interrupt 1
ExtInt_Init2(); //Initialize Interrupt 2
putchar(0x0C);
printf ("*External Interrupt Demo ***\n\n\r");
DelayMs(100);
printf (">>> Press Interrupt Keys SW2(INT1) and SW3(INT2) for Output... \n\n\n\r");
DelayMs(100);
while(1)
{

DelayMs(500);
printf("INT1 Generated : %d | INT2 Generated : %d \r", EINT1, EINT2);
DelayMs(500);
}}
void ExtInt_Init2(void)
{

EXTMODE |= 4; //Edge sensitive mode on EINT2


EXTPOLAR = 0; //Falling Edge Sensitive
PINSEL0 |= 0x80000000; //Enable EINT2 on P0.15
{
VICVectCntl1 = 0x20 | 16; // 16 is index of EINT2
VICVectAddr1 = (unsigned long) ExtInt_Serve2;
VICIntEnable |= 1<<16; //Enable EINT2
}
}
void ExtInt_Init1(void)
{
EXTMODE |= 2; //Edge sensitive mode on EINT1
EXTPOLAR = 0; //Falling Edge Sensitive
{
PINSEL0 |= 0x20000000; //Enable EINT2 on P0.14
VICVectCntl0 = 0x20 | 15; //15 is index of EINT1
}
VICVectAddr0 = (unsigned long) ExtInt_Serve1;
VICIntEnable |= 1<<15; //Enable EINT1
}
}
void Serial_Init(void)
{
PINSEL0 |= 0X00000005; //Enable Txd0 and Rxd0
U0LCR = 0x00000083; //8-bit data,1-stop bit
}
U0DLL = 0x00000061; //XTAL = 12MHz
U0LCR = 0x00000003; //DLAB = 0;
}
void DelayMs(unsigned int count)
{
unsigned int i,j;
for(i=0;i<count;i+1)
{
for(j=0;j<1000;j++);
}}
OUTPUT

RESULT

Thus the Interrupt performance characteristics of ARM processor and FPGA has been done using
embedded C program.
Ex. No: 9
FLASHING OF LEDS

AIM

To verify the flashing of LEDS in ARM DEVELOPMENT KIT microcontroller board using
embedded C program.

APPARATUS REQUIRED

1. ARM DEVELOPMENT KIT LPC2148


2. Keil µVision3 IDE 1

PROCEDURE:
Step 1: Open the µvision 4 icon on the desk top, it will generate a window as shown below
Step 2: To create new project go to project select new micro vision project.
Step 3: select a drive where you would like to create your project.
Step 4: Create a new folder and name it with your project name.
Step 5: Open that project folder and give a name of your project executable and save it.
Step 6: After saving it will show some window there you select your microcontroller company i.e
NXP from Phillips
Step 7: Select your chip as ARM DEVELOPMENT KIT
Step 8: After selecting chip click on OK then it will display some window asking to add STARTUP.
Select YES.
Step 9: A target is created and startup is added to your project target and is shown below.
Step 10: To write your project code select a new from menu bar.
Step 11: It will display some text editor, to save that select SAVE option from menu bar.
Step 12: By giving a name l with extension .C and save it
Step 13: Write the code of your project and save it
Step 14: To add our c to target give a right click on Source Group, choose “ADD s to Group”
option. Step 15:It will display some window there select the you have to add and click on ADD
option.
Step 16: It will be added to our target and it shows in the project window.
Step 17: Right click on target in the project window and select “Options for Target”
Step 18: It will show some window, in that go to output option and choose Create Hex option by
selecting that box
Step 19: In the same window go to Linker option and choose Memory Layout from Target Dialog
by selecting the box, and click OK.
Step 20: Compile your project go to Project select Build Target option or press F7.
Step 21: observe the flashing of LED’s in the ARM board.
PROGRAM
#include <lpc214x.h>
Unsigned int delay;
Int main(void)
{
IO0DIR=(1<<10); //Configuration p0.10 as Output
While(1)
{
IO0CLR=(1<<10); //CLEAR (0)P0.10toturn LED ON
For(delay=0; delay<500000;delay++); //delay
IO0SET=(1<<10); //SET(1) P0.10 To turn

LEDs OFF
for(delay=0delay<500000;delay++); //delay
}
}
OUTPUT

IO0SET =ox00 (OFF)


IO0CLR =oxFF (ON)
Delay =2

RESULT

Thus the Flashing of LEDS using ARM DEVELOPMENT KIT board was observed by using
embedded C program successfully.
Ex. No: 10
TEMPERATURE SENSOR INTERFACE

AIM
To write a program for Temperature Sensor Interface.

EQUIPMENT NEEDED
1. Nvis 5004B board
2. Adapter 5volt/1Amp
3. USB Cable

PROCEDURE

1. Connect the USB cable (supplied along with the board) to USB port of your PC and
UART0( B Type USB) port of the board (in PC interface & ISP section) provided on the
board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the
ISP mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “Temperature Sensor Interface .hex” (CD-drive\ Onboard Program\ 4. Temperature
Sensor Interface \ Temperature Sensor Interface.hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Put all the switches provided in the ‘LED Interface’ block in the OFF position.
9. Put all the switches provided in the ‘LCD Interface’ block in the ON position.
10. Put 6,7,8 switches provided in the ‘Motor Module’ block in the ON position
11. Put 5 Dip switches provided in the ‘ADC Interface’ block in the ON position
12. Switch ‘On’ the supply, then press reset switch.
13. Observe the Temperature Value display on LCD according to program.
PROGRAM

#include <LPC214x.H> /* LPC214x definitions */

#define CR 0x0D #define


PLOCK 0x400
/********************************
* Function Prototypes

*************************/
void ADC_Init(void); /* ADC Init Function */
void ADC_Convert(unsigned int); /* ADC Display Function */

unsigned char Get_Char(void);


unsigned char Send_Char(unsigned char ch);
void Send_String(unsigned char *ch);

unsigned int ADC_Val; /* ADC Result (HEX) */


unsigned int FirstBit,SecondBit,ThrdBit,FourthBit;
/***************************
* Function Prototypes
**************************/
void LCD_Init(void); /* LCD Init Function */
void LCD_Delay(unsigned int); /* LCD LCD_Delay Function */
void LCD_Cmd(unsigned long); /* LCD Command Function */
void LCD_Data(unsigned long); /* LCD Data Function */
void LCD_Disp(unsigned char,unsigned char *); /* LCD Display Function */

/**************************
* LCD Pin Out Discription

***************************/
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;

#define EN_Set IO0SET = 0x00800000;


#define EN_Clr IO0CLR = 0x00800000;

/*************************
* LCD_Delay
* Description : This function provide LCD_Delay in Mili Sec.
***************************/
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;

for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
/*************************
* LCD initialization
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set 8bit : 2 Line 5x7 Dots (0x38)
* 2. Display On curser Off (0x0C)
* 3. Clear Display (0x01)
* 4. Entry Mode (0x06)
* Note : This function should be called once before any of the other
functions
****************************/
void LCD_Init(void)
{
LCD_Cmd(0x38); /* Function Set 8bit : 2 Line 5x7 Dots */
LCD_Cmd(0x0C); /* Display On curser Off */
LCD_Cmd(0x01); /* Clear Display */
LCD_Cmd(0X06); /* Entry Mode */
}

/****************************
* LCD Command (Shifting is Done here)
*
* Description : This function initializes the LCD module by the following steps:
* Note : Here we have selected Pin P1.16 to P1.23 as LCD data line,
* thats why we need to shift data by 16.
****************************/
void LCD_Cmd(unsigned long Cmd)
{
unsigned long Shifted_Cmd;

Shifted_Cmd = Cmd << 16; /* because We have selected P1.16 to P1.23 as


LCD data line */

RS_Clr; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);
IO1SET = Shifted_Cmd; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}
/****************************
* LCD Data
*
* Description : This function initializes the LCD module by the following steps:
* 1. Set Register select(RS) to High
* 2. Set enable pin high to low
* 3. Send data to LCd data pin
* Note : Here we have selected Port 1 Pin P1.16 to P1.23 as LCD data
line thats
* why we need to shift data by 16.
*****************************/
void LCD_Data(unsigned long Data)
{

RS_Set; /* RS Pin Clear */


LCD_Delay(10); /* LCD_Delay for Clock*/

EN_Set; /* Enable Pin SET */


LCD_Delay(10);

IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/

EN_Clr; /* Enable Pin Clear */


LCD_Delay(10);

IO1CLR = 0x00FF0000; /* Clear All pins of LCD */


}
/***************************
* LCD Display
*
* Description : This function initializes the LCD module by the following steps:
* 1. Send Loc from where data needs to write
* 2. Display string on LCD
*****************************/
void LCD_Disp(unsigned char Loc, unsigned char *String)
{
LCD_Cmd(Loc); /* Send Command to LCd */
while(*String) /* Wait untill Null char come */
{
LCD_Data(*String++); /* Write data to LCD */
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}
}

/*****************************
* Delay
* Description : This function provide Delay in Mili Sec.
************************************/
void Delay(unsigned int Time)
{
unsigned int i,j;
for(i=0;i<=Time;i++)
for(j=0;j<110;j++);
}
/***************************
* Feed Init function
*************/
static void feed(void)
{
PLL0FEED = 0xAA;
PLL0FEED = 0x55;
}
/*********************************
PLL Init function
*********************************/
void PLL_Init()
{
PLL0CFG = 0x24;
feed(); /* Enabling the PLL */
PLL0CON = 0x01;
feed(); /* Wait for the PLL to lock set frequency*/
while(!(PLL0STAT &
PLOCK)); /* Connect the PLL as the clock source
*/ PLL0CON = 0x3;
feed(); /* Enabling MAM and setting number of clocks
used for Flash memory fetch (4 clks in this case) */
MAMTIM = 0x04;
MAMCR = 0x02; /* Setting peripheral Clock (pclk) to System Clock (cclk) */
VPBDIV = 0x01;
}
/************************************
* ADC initialization
*
* Description : This function initializes the ADC by the following steps:
* 1. Select ADC Channel
* 2. Set A/D: 10-bit AIN1 @ 12MHz
* Note : This function should be called once before any of the other
functions of ADC.
************************************/
void ADC_Init()
{
PINSEL0 |= 0x00003000; /* channel AD1.0 */
AD1CR =0x01210400; /* Setup A/D: 10-bit AIN1 @ 3MHz */
}
/*********************************
ADC Conversion
*
* Description : This function convert ADC data into ASCII by the following steps:
* 1. Conver each byte into ASCII
* 2. Each Value will be used for LCD Display
* Arguments : 'RADC_Value' is the Value which needs to convert in ASCII.
************************************/
void ADC_Convert(unsigned int ADC_Value)
{
unsigned int X,Y,Z; /* Intermidiate Variables */

FirstBit=0,SecondBit=0,ThrdBit=0,FourthBit=0; X
= ADC_Value/10;
FirstBit = ADC_Value%10;
FirstBit = 0x30|FirstBit; /* First Byte(LSB) */

Y = X/10;
SecondBit = X % 10;
SecondBit = 0x30|SecondBit; /* Second Byte */

Z = Y/10;
ThrdBit = Y % 10;
ThrdBit = 0x30|ThrdBit; /* Third Byte */

FourthBit = Z; /* Last Byte(MSB) */


FourthBit=0x30|FourthBit;
}
/*********************************
* Main
* Description : This function Initialize the UART0and ADC
*********************************/
int main (void)
/* program exec. starts here */
{

IO1DIR = 0x00FF0000; /* Set LCD_DATA pin as out put */


IO0DIR = 0x00FF0000; /* Set LCD_Control pin as out put */
LCD_Init(); /* Initialize LCD */
Delay(100);
LCD_Disp(0x80, " NVIS "); /* Display "NVIS" */
LCD_Disp(0xC0, " Technologies "); /* Display "Technologies" */
Delay(3000);
LCD_Cmd(0x01);
ADC_Init();
/* ADC Initialize */
while(1)
{
AD1CR |= 0x01000000; /* start of ADC conversion */
do
{
ADC_Val = AD1DR0; /* 10 bit value */
}

Complete */while ((ADC_Val & 0x80000000) == 0); /*


Wait ADC Conversion

AD1CR &= ~0x01000000;


/* Again start ADC */
ADC_Val = (ADC_Val >> 6) & 0x03FF;
ADC_Val = (((ADC_Val * 3.3) / 1023.0)*100);//-5; // Volt = ADC Result x [3.3V /
1024]

ADC_Convert(ADC_Val);
/* Convert ADC value into ASCII for LCD Display */
LCD_Disp(0x83, "Temperature");
LCD_Cmd(0xC6);
LCD_Data(ThrdBit)
;
LCD_Cmd(0xC7);
LCD_Data(SecondBit);
LCD_Cmd(0xC8);
LCD_Data(FirstBit);
LCD_Cmd(0xC9);
LCD_Data(0xDF);
LCD_Cmd(0xCA);
LCD_Data('C') ;
Delay(40000);
}
}
/*
* end of file
* */
OUTPUT

RESULT

Thus, the interfacing of temperature sensor with ARM DEVELOPMENT KIT processor has
been done and executed the temperature value.
Ex. No: 11
ZIGBEE MODULE

AIM
To write a program for interface Zigbee Module.

EQUIPMENT NEEDED
1. Nvis 5004B board 2- Nos
2. Adapter 5volt/1Amp
3. USB Cable
4. Zigbee Module 2- Nos

PROCEDURE
1. Connect the USB cable to USB port of your PC and UART0( B Type USB) port of the
board (in PC interface & ISP section) provided on the board.
2. Change the position of Run/ISP switch placed in “PC Interface & ISP Section” block on the
ISP mode.
3. Turn ON switch no 1, 2 placed in “I2C & SPI ” block.
4. Connect the power cable to the board and switch ‘ON’ the power switch.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/All programs/Philips semiconductor/Flash utility/Launch
LPC210x_ISP.exe.) and select the appropriate port settings (use baud rate 9600).
6. Program “Zigbee Interface .hex” (CD-drive\ Onboard Program\ 13. Zigbee Interface \
Zigbee Interface.hex).
7. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
8. Connect both jumper in Zigbee/UART1 block.
9. Put all Dip switches provided in the ‘LCD Interface’ block in the ON position
10. Put 6,7,8 Dip switches provided in the ‘Motor Module’ block in the ON position
11. Put all Dip switches provided in the ‘Hex keypad Interface’ block in the ON position
12. Switch ‘On’ the supply, then press reset switch.
13. Take all 1 to 12 step in 2nd Nvis 5004B
14. Firstly on LCD screen "Nvis Technologies" will display, then On LCD 1st Row "Key
Pressed " and 2nd Row Key Recieved will display. whenever you will press any key the
same character will display on LCD 1st row and send to other another Nvis 5004B its
display on 2nd row on Key Received.
PROGRAM

#include <LPC214x.H> /* LPC214x


definitions */
#define CR 0x0D
/*********************
* LCD Pin Out Discription
*
*******************/
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;

#define EN_Set IO0SET = 0x00800000;


#define EN_Clr IO0CLR = 0x00800000;
/**********************************
* Function Prototypes
*
*********/
void LCD_Init(void); /* LCD Init Function */
void LCD_Delay(unsigned int); /* LCD LCD_Delay Function */
void LCD_Cmd(unsigned long); /* LCD Command Function */
void LCD_Data(unsigned long); /* LCD Data Function */
void LCD_Disp(unsigned char,unsigned char *); /* LCD Display Function */
/***************************
* UART1 Initialization
*
* Description : This function Initializes the UART1.
* Note : This function should be called once before any of the other
functions of UART1.
****************************/
void UART1_Init()
{
PINSEL0 = 0x00050000; /* Enable RxD1 and TxD1 */
U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U1DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
U1LCR = 0x03; /* DLAB = 0 */
}
/**************************
* Get_Char
* Description : Read a character from Serial Port
****************************/
unsigned char Get_Char(void)
{
while(!(U1LSR & 0x01)); /* RDR */
return U1RBR;
}
/**************************
* Get_Char
* Description : Write a character from Serial Port
****************************/
void Send_Char(unsigned char ch)
{
if(ch == '\n') { U1THR = CR;
while (!(U1LSR & 0x20));
}

U1THR = ch;
while(!(U1LSR & 0x20));
}
/****************************
* Send_String
* Description : Write a string from Serial Port
****************************/
void Send_String(unsigned char *ch)
{
while(*ch != '\0')
{
Send_Char(*ch++);
}
}
/*********************************
* Main:
*********************************/
int main(void)
{
unsigned char getvalue;
IO0DIR = 0x00E00000; /* defined as Outputs for LCD P0.21,22,23*/
IO1DIR = 0x0FFF0000; /* defined as Outputs for keypad P1.23 to P1.17
Outputs for LCD P1.16 TO P1.23 */
LCD_Init();
UART1_Init(); /* Init UART 1 */

LCD_Delay(500);
LCD_Disp(0x80, " Nvis "); /* Display "NVIS" */
LCD_Disp(0xC0, " Technologies "); /* Display "Technologies" */;
LCD_Delay(5000);
LCD_Cmd(0x01); /* Clear Display
*/ LCD_Disp(0x81,"Key Pressed");
LCD_Disp(0xC1,"Key Recieved");
while(1)
{
while(!(U1LSR & 0x01))
{
/********************************************************************
*******************/
/* Check For ROW 1, All Column */

/********************************************************************
*******************/
IO1SET = 0x01000000; /* Set Row 1 */
if((IO1PIN & 0xF0000000)!= 0xF0000000)
{
if((IO1PIN & 0x10000000) == 0x10000000) /*Row1, Column1*/
{
LCD_Disp(0x8E,"1"); /* Set Curser at '0xC6' */
Send_String("1");
IOCLR1 = 0x10000000; /* Clear pins */
}
else if((IO1PIN&0x20000000) == 0x20000000) /*Row1, Column2*/
{
LCD_Disp(0x8E,"4");
Send_String("4");
IOCLR1 = 0x20000000;
}
else if((IO1PIN&0x40000000) == 0x40000000) /*Row1, Column3*/
{
LCD_Disp(0x8E,"7");
Send_String("7");
IOCLR1 = 0x40000000;
}
else if((IO1PIN&0x80000000) == 0x80000000) /*Row1, Column4*/
{
LCD_Disp(0x8E,"0");
Send_String("0");
IOCLR1 = 0x80000000;
}
LCD_Delay (300);
}
IO1CLR = 0x01000000; /*
Clear Row 1*/
/**************************************************************
*************************/
/* Check For ROW 2,All Column */
/********************************************************************
*******************/
IO1SET = 0x02000000; /* Set Row 2 */
if((IO1PIN&0xF0000000)!= 0xF0000000)
{
if((IO1PIN&0x10000000)==0x10000000) /*Row2, Column1*/
{
LCD_Disp(0x8E,"2");
Send_String("2");
IOCLR1 = 0x10000000;
}
else if((IO1PIN&0x20000000)== 0x20000000) /*Row2, Column2*/
{
LCD_Disp(0x8E,"5"); //
Send_String("5");
IOCLR1 = 0x20000000;
}
else if((IO1PIN&0x40000000)==0x40000000) /*Row2, Column3*/
{
LCD_Disp(0x8E,"8"); //
Send_String("8");
IOCLR1 = 0x40000000;
}
else if((IO1PIN&0x80000000)== 0x80000000) /*Row2, Column4*/
{
LCD_Disp(0x8E,"A"); //
Send_String("A");
IOCLR1 = 0x80000000;
}
LCD_Delay (300);
}
IO1CLR = 0x02000000; /* Clear Row 2 */
/********************************************************************
*******************/
/* Check For ROW 3,All Column */
/********************************************************************
*******************/
IO1SET = 0x04000000;
if((IO1PIN & 0xF0000000)!= 0xF0000000)
{

if((IO1PIN &0x01000000)==0x01000000)
{
LCD_Disp(0x8E,"3");
Send_String("3");
IOCLR1 = 0x10000000; // CLEAR ROW 0
}
else if((IO1PIN&0x20000000)== 0x20000000)
{
LCD_Disp(0x8E,"6");
Send_String("6");
IOCLR1 = 0x20000000;
}
else if((IO1PIN&0x40000000)== 0x40000000)
{
LCD_Disp(0x8E,"9");
Send_String("9");
IOCLR1 = 0x40000000;
/********************************************************************
*************************************
* LCD Display
*
* Description : This function initializes the LCD module by the following steps:
* 1. Send Loc from where data needs to write
* 2. Display string on LCD
*********************************************************************
************************************/
void LCD_Disp(unsigned char Loc, unsigned char *String)
{
LCD_Cmd(Loc); /* Send Command to LCd */
while(*String) /* Wait untill Null char come */
{
LCD_Data(*String++); /* Write data to LCD */
IO1CLR = 0x00FF0000; /* Clear All pins of LCD */
}
}
OUTPUT

RESULT

Thus the implementation of ZigBee protocol with ARM DEVELOPMENT KIT processor
board using embedded C program has been done.

You might also like