Embedded Laboratory
Embedded Laboratory
Embedded Laboratory
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
NAME : ……………………………………………………………….
COURSE : ……………………………………………………………….
REGISTER NO.
Certified that this is the bonafide record of work done by above student
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
LIST OF EXPERIMENTS
OUTCOMES: At the end of the course, the student should be able to:
AIM:
To study about the ARM Evaluation system.
THEORY:
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 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.
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.
RESULT:
AIM
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
//************************
* 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
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
*/
/****************************
* 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)
{
IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/
/*****************************
* 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 */
2.
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;
/****************************
* 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)
{
IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/
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
EQUIPMENT NEEDED
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>
/****************************
MAIN ROUTINE
************************/
int main(void)
{
IO1DIR = 0xFFFF0040;
IO0SET = 0x00000000;
VPBDIV = 0x01;
PINSEL0 = 0x00030000; //channel AD1.1
PINSEL1 = 0x00080000; //ENABLE DAC PIN
/**************************
FUNCTION ENDS
HERE
************************/
2. Squarewave
#include<LPC214x.H>
/***************************
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 */
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
EQUIPMENT NEEDED
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
EQUIPMENT NEEDED
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;
RESULT
Thus the interfacing of PWM with ARM DEVELOPMENT KIT was done by using embedded C
program.
Ex. No: 4 a
INTERFACING PWM
AIM
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
/********************************
* 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 */
RTC_Value = Dec2Hex(RTC_Value);
/*********************************
* 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(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));
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
EQUIPMENT NEEDED
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
/***************************
* 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.
****************************/
/***************************
* 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.
*****************************/
IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/
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
EQUIPMENT NEEDED
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;
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;
/********************************************************************
*************************************
* 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
IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(30); /* LCD_Delay for enable
Clock*/
/********************************************************************
**********************************
* Main:
*********************************************************************
*********************************/
int main(void)
{
IO0DIR = 0x00E00000; /* defined as
Outputs for LCD P0.21,22,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 & 0x10000000) == 0x10000000) /*Row1, Column1*/
{Curser at '0xC6' */ pins */
}
LCD_Disp(0xC8,"2"); /*
Set
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
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*/
loop_ctr = 10000; /* Wait for the PLL to lock into the new frequency */
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*/
loop_ctr = 10000; /* Wait for the PLL to lock into the new frequency */
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.
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
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;
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 */
/****************************
* 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)
{
IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/
/********************************
* Main Function
*******************************/
int main(void)
{
unsigned char RData; /* To received
data */
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);
}
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
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 */
/*----------------------------------------------------------------------------
* 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 */
/*
* 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 */
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
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
DelayMs(500);
printf("INT1 Generated : %d | INT2 Generated : %d \r", EINT1, EINT2);
DelayMs(500);
}}
void ExtInt_Init2(void)
{
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
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
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
*************************/
void ADC_Init(void); /* ADC Init Function */
void ADC_Convert(unsigned int); /* ADC Display Function */
/**************************
* LCD Pin Out Discription
***************************/
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;
/*************************
* 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;
IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/
/*****************************
* 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 */
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
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.