2017 Reg - Embedded Lab Manual
2017 Reg - Embedded Lab Manual
DATE:
AIM:
To Study about ARM 7 Development Board Nvis 5004B and its various operations.
APPARATUS REQUIRED:
THEORY:
(a) INTRODUCTION
ARM 7 Development Board Nvis 5004B is a 32 bit development platform and provides means
for code development. It is based on LPC2148 Philips microcontroller and provides the understanding of
all the fundamentals of 32 bit microcontrollers. It helps the user to gain knowledge regarding arithmetic,
logical, single bit programming and interfacing of peripherals. It provides a platform on which to design
and implement extensive embedded system based design. A microcontroller is a single chip
microcomputer with on board program ROM and I/O that can be programmed for various control
functions. Unlike a general purpose computer, which also includes all of these components, a
microcontroller is designed for a very specific task to control a particular system. The ARM 7 TDMI-S is
a general purpose 32-bit microprocessor, which offers high performance and very low power
consumption. The ARM architecture is based on RISC principles and the instruction set and related
decode mechanism are much simpler than those of micro programmed CISC. This simplicity results in a
high instruction throughput and impressive real-time interrupt response from a small and cost-effective
processor core.
Pipeline techniques are employed so that all parts of the processing and memory systems can
operate continuously. Typically, while one instruction is being executed, its successor is being decoded,
and a third instruction is being fetched from memory. The ARM 7 TDMI-S processor also employs a
unique architectural strategy known as Thumb, which makes it ideally suited to high-volume applications
with memory restrictions or applications where code density is an issue.
The key idea behind Thumb is that of a super-reduced instruction set. Essentially, the ARM 7
TDMI-S processor has two instruction sets: · The standard 32-bit ARM set · A 16-bit Thumb set The
Thumb set’s 16-bit instruction length allows it to approach twice the density of standard ARM code while
retaining most of the ARM’s performance advantage over a traditional 16-bit processor using 16-bit
registers. This is possible because Thumb code operates on the same 32-bit register set as ARM code.
Nvis 5004B 8 LPC2148: The LPC2141/42/44/46/48 microcontrollers are based on a 16-bit/32-bit
ARM7TDMI-S CPU with real-time emulation and embedded trace support, that ash memory ranging
from 32combine microcontrollers with embedded high-speed kB to 512 kB. A 128-bit wide memory
interface and a unique accelerator architecture enable 32-bit code execution at the maximum clock rate.
For critical code size applications, the alternative 16-bit Thumb mode reduces code by more than 30 %
with minimal performance penalty. Due to their tiny size and low power consumption, LPC2148 are ideal
for applications where miniaturization is a key requirement, such as access control and point-of-sale.
Serial communications interfaces ranging from a USB 2.0 Full-speed device, multiple UARTs, SPI, SSP
to I2C-bus and on-chip SRAM of 8 kB up to 40 kB, make these devices very well suited for
communication gateways and protocol converters, soft modems, voice recognition and low end imaging,
providing both large buffer size and high processing power. Various 32-bit timers, single or dual 10-bit
ADCs, 10-bit DAC, PWM channels and 45 fast GPIO lines with up to nine edge or level sensitive
external interrupt pins make these microcontrollers suitable for industrial control and medical systems.
The LPC2148 consists of an ARM7TDMI-S CPU with emulation support, the ARM7 Local Bus for
interface to on-chip memory controllers, the AMBA Advanced Highperformance Bus (AHB) for
interface to the interrupt controller, and the VLSI Peripheral Bus (VPB, a compatible superset of ARM’s
AMBA Advanced Peripheral Bus) for connection to on-chip peripheral functions.
The LPC2148 configures the ARM7TDMI-S processor in little-endian byte order. AHB
peripherals are allocated a 2 megabyte range of addresses at the very top of the 4 gigabyte ARM memory
space. Each AHB peripheral is allocated a 16 kB address space within the AHB address space. LPC2148
peripheral functions (other than the interrupt controller) are connected to the VPB bus. The AHB to VPB
bridge interfaces the VPB bus to the AHB bus. VPB peripherals are also allocated a 2 megabyte range of
addresses, beginning at the 3.5 gigabyte address point. Each VPB peripheral is allocated a 16 kB address
space within the VPB address space. The connection of on-chip peripherals to device pins is controlled by
a Pin Connect Block. This must be configured by software to fit specific application requirements for the
use of peripheral functions and pins. The LPC2148 incorporate a 32 kB, 64 kB, 128 kB, 256 kB, and 512
Programming of the Flash memory may be accomplished in several ways: over the serial built-in JTAG
interface, using In System Programming (ISP) and UART0, or by means of In Application Programming
(IAP) capabilities. The application program, using the IAP functions, may also erase and/or program the
Flash while the application is running, allowing a great degree of flexibility for data storage field firmware
upgrades, etc. When the LPC2148 on-chip bootloader is used, 32 kB, 64 kB, 128 kB, 256 kB, and 500 kB
of Flash memory is available for user code. Nvis 5004B 9 On-chip Static RAM (SRAM) may be used for
code and/or data storage. The on-chip SRAM may be accessed as 8-bits, 16-bits, and 32-bits. The
LPC2148 provide 8/16/32 kB of static RAM respectively. The LPC2148 SRAM is designed to be
accessed as a byte-addressed memory. kB Flash memory system respectively. This memory may be used
for both code and data storage.
Word and halfword accesses to the memory ignore the alignment of the address and access the
naturally-aligned value that is addressed (so a memory access ignores address bits 0 and 1 for word
accesses, and ignores bit 0 for halfword accesses). Therefore valid reads and writes require data accessed
as halfwords to originate from addresses with address line 0 being 0 (addresses ending with 0, 2, 4, 6, 8,
A, C, and E in hexadecimal notation) and data accessed as words to originate from addresses with address
lines 0 and 1 being 0 (addresses ending with 0, 4, 8, and C in hexadecimal notation). This rule applies to
both off and on-chip memory usage. The SRAM controller incorporates a write-back buffer in order to
prevent CPU stalls during back-to-back writes. The write-back buffer always holds the last data sent by
software to the SRAM. This data is only written to the SRAM when another write is requested by
software (the data is only written to the SRAM when software does another write). If a chip reset occurs,
actual SRAM contents will not reflect the most recent write request (i.e. after a "warm" chip reset, the
SRAM does not reflect the last write operation). Any software that checks SRAM contents after reset
must take this into account. Two identical writes to a location guarantee that the data will be present after a
Reset. Alternatively, a dummy write operation before entering idle or powerdown mode will similarly
guarantee that the last data written will be present in SRAM after a subsequent Reset.
The development Platform consists of various peripherals like LED, ADC, DAC,PWM,Interrupt,keypad,
LCD,
Motor drive,sensor,and EEPROM IC and many more. The connections of peripherals with microcontroller are
given in following tables
UART0(B Type USB): A USB port can be connected to the host PC using the USB cable. The following table lists out
the details related to the Nvis 5004B . This is the UART0 of the LPC2148 chip.
The UART can be programmed to operate at speed ranging from 300 to 115,000 bps
1.Reset Switch: This switch is used for resetting the controller.
2.Run/ISP Switch: This switch is used for enabling and disabling the in system programmer mode or Run mode. If it is
on left side, it enables the Run mode and if it is on right side, enables the ISP mode.
3.Run or Boot Mode (Runs the Application): In this mode the application can be executed directly after ‘Power On’.
This is possible only when the application has been initially downloaded on to the board. In order to download the
application uses the Run/ISP switch. ·
4.ISP Mode (In System Programming): ISP mode is used to enable the chip to do programming. In this mode, the user
can download the application on to the board. In order to download the application selects the Run/ISP switch into ISP
mode.
RESULT:
Thus study about ARM 7 Development Board Nvis 5004B and its various operations are done.
DATE:
AIM:
APPARATUS REQUIRED:
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 LCD.
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).
8. Switch ‘OFF’ the power supply and change the position of Run/ISP switch placed in “PC
Interface & ISP Section” block on the RUN mode.
9. Put 4 Dip switches provided in the ‘ADC Interface’ block in the ON position
10. Switch ‘On’ the supply, then press reset switch. 10. Observe Signal on “Aout” with
DSO/Oscilloscope.
PROGRAM
for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
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 */
}
void LCD_Cmd(unsigned long Cmd)
{
unsigned long Shifted_Cmd;
Shifted_Cmd = Cmd << 16;
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 */
}
void LCD_Data(unsigned long Data)
{
for(i=0;i<=Time;i++)
for(j=0;j<110;j++);
}
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;
}
void ADC_Init()
{
PINSEL0 = 0x00030000; /* channel AD1.1 */
AD1CR = 0x01210402; /* Setup A/D: 10-bit AIN1 @ 3MHz */
}
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;
}
int main (void) /* program exec. starts here */
{
#include<LPC214x.H>
void msdelay(unsigned long);
int main(void)
{
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);
}
}
void msdelay (unsigned long a) // DELAY ROUTINE
{
while(--a!=0);
}
RESULT:
Thus Interfacing ADC and DAC with ARM 7 Development Board Nvis 5004B were
performed.
EXPT NO :3 Interfacing LED and PWM.
DATE:
AIM:
To Interface LED and PWM with ARM 7 Development Board Nvis 5004B
APPARATUS REQUIRED:
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.
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>
void MSdelay(unsigned int rTime)
{
unsigned int i,j;
for(i=0;i<=rTime;i++)
for(j=0;j<4867;j++);
}
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 */
}
}
#include <lpc214x.h>
void PWM_Init(unsigned int cycle)
{
PINSEL0 = 0x000A800A; /* set GPIOs for all PWMs */
PINSEL1 = 0x00000400;
PWMTCR = 0x00000002; /* Counter Reset */
PWMPR = 0x00000000; /* count frequency:Fpclk */
DATE:
AIM:
To Interface Real time Clock and UART with ARM 7 Development Board Nvis 5004B
APPARATUS REQUIRED:
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\ 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.
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 “UART0 Interface .hex” (CD-drive\ Onboard Program\ UART0 Interface
\UART0 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" and "Press a Key-" show on hyperterminal press key on
keyboard same character display on hyperterminal
PROGRAM:
for(i=0;i<=Time;i++)
for(j=0;j<110;j++);
}
RTC_Value = Dec2Hex(RTC_Value);
for(i=0;i<=rTime;i++)
for(j=0;j<1275;j++);
}
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;
}
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;
}
unsigned char Get_Char(void)
{
while (!(U0LSR&0x01));
return U0RBR;
}
unsigned char Send_Char(unsigned char ch)
{
if (ch == '\n')
{
while(!(U0LSR & 0x20));
U0THR = CR; /* output CR */
}
while(!(U0LSR & 0x20));
DATE:
AIM:
To Interface Keyboard and LCD with ARM 7 Development Board Nvis 5004B
APPARATUS REQUIRED:
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.
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
#include<lpc214x.h>
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 */
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;
#define EN_Set IO0SET = 0x00800000;
#define EN_Clr IO0CLR = 0x00800000;
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;
for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
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 */
}
void LCD_Cmd(unsigned long Cmd)
{
unsigned long Shifted_Cmd;
for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
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 */
}
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);
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)
{
IO1SET = 0x01000000; /* Set Row 1 */
{
if((IO1PIN & 0x10000000) == 0x10000000) /*Row1,
Column1*/
{
LCD_Disp(0xC8,"2"); /* Set Curser at '0xC6' */
IOCLR1 = 0x10000000; /* Clear pins */
}
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*/
{
LCD_Disp(0xC8,"3"); /* Set Curser at '0xC6' */
IOCLR1 = 0x10000000; /* Clear pins */
}
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;
}
LCD_Delay (100);
}
IO1CLR = 0x04000000; /* Clear Row 1 */
IO1SET = 0x08000000; /* Set Row 1 */
if((IO1PIN & 0xF0000000)!= 0xF0000000)
{
if((IO1PIN & 0x10000000) == 0x10000000) /*Row1,
Column1*/
{
LCD_Disp(0xC8,"F"); /* Set Curser at '0xC6' */
IOCLR1 = 0x10000000; /* Clear pins */
}
else if((IO1PIN&0x20000000) == 0x20000000) /*Row1, Column2*/
{
LCD_Disp(0xC8,"E");
IOCLR1 = 0x20000000;
}
else if((IO1PIN&0x40000000) == 0x40000000) /*Row1, Column3*/
{
LCD_Disp(0xC8,"D");
IOCLR1 = 0x40000000;
}
else if((IO1PIN&0x80000000) == 0x80000000) /*Row1, Column4*/
{
LCD_Disp(0xC8,"C");
IOCLR1 = 0x80000000;
}
LCD_Delay (100);
}
IO1CLR = 0x08000000; /* Clear Row 1 */ }
}
RESULT
Thus LCD and Keyboard are interfaced with ARM 7 Development Board Nvis 5004B.
EXPT NO :6 Interfacing EPROM and interrupt
DATE:
AIM:
To Interface EPROM and interrupt with ARM 7 Development Board Nvis 5004B
APPARATUS REQUIRED:
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.I2C
EEPROM\ 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
(a) EPROM Interface
#include "lpc214x.h"
#include "i2c.h"
#include "i2cDevice.h"
#define Dev_Add 0xA0
#define Dev_MemLoc 0x40
#define Data_Value 'S' //user can change value
#define LED1_ON IO0SET = 0x01
#define LED1_OFF IO0CLR = 0x01
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 */
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;
#define EN_Set IO0SET = 0x00800000;
#define EN_Clr IO0CLR = 0x00800000;
for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
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 */
}
IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(20); /* LCD_Delay for enable Clock*/
int main(void)
{
unsigned char RData; /* To received data */
}
(b) Interrupt Interface
Interrupt0
#include <LPC214x.H>
#define CR 0x0D
unsigned int Cnt;
void Send_Char(unsigned char ch);
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*/
void InitExtInt0(void)
{
VICVectCntl0 = 0x20 | 0x0E; /* use it for External Interrupt 1 */
VICIntEnable = 0x00004000; /* Enable External Interrupt 1*/
VICVectAddr0 = (unsigned long)ExtInterrupt0_ISR;/* set interrupt vector in 0
*/
VICDefVectAddr = (unsigned long) DefISR; /* un-assigned VIC nterrupts
*/
}
int main(void)
{
PLLInit(); /* Init PLL */
PINSEL0 = 0x2000000C; /*Enable the EXTINT1 interrupt */
PINSEL2 = 0x00000000; /* Select pin for Timer*/
IO1DIR = 0x00FF0000; /* Set direction for Pin P1.16 to Pin
P1.23 as output */
InitExtInt0(); /* Init Extenal Interrupt 1*/
while(1)
{
IO1CLR = 0x00FF0000; /* Clear All LED*/
}
}
Interrupt1
#include <LPC214x.H>
#define CR 0x0D
unsigned int Cnt;
void Send_Char(unsigned char ch);
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*/
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 */
}
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');
}
}
RESULT
Thus EPROM and Interrupt are interfaced with ARM 7 Development Board Nvis 5004B.
EXPT NO :7 OS Real Time Mailbox
DATE:
AIM:
APPARATUS REQUIRED:
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)
EXPT NO :8 Flashing of LEDS
DATE:
AIM:
APPARATUS REQUIRED:
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 “Blinky Task.hex” (CD-drive\ RTOS Program\1.Blinky\ Blinky
Task.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. Switch ‘On’ the supply, then press reset switch. 10. Observe simultaneously
glowing of two LED’s.
EXPT NO :09 Interfacing stepper motor and temperature sensor
DATE:
AIM:
APPARATUS REQUIRED:
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\ 6.Stepper Motor
Interface \ Stepper Motor 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 1,2,3,4,5, Dip switches provided in the ‘Motor Module’ block in the ON position
9. Connect a patch cord from+5volt to Vcc in Motor Drive block
10. Connect Stepper Motor wire connection according to read me file.
11. Switch ‘On’ the supply, then press reset switch.
12. Observe rotation of Stepper motor .
PROGRAM
#include <LPC214x.H>
void MSdelay(unsigned int rTime)
{
unsigned int i,j;
for(i=0;i<=rTime;i++)
for(j=0;j<1275;j++);
}
int main(void)
{
IO0DIR = 0x001F0000;
IO0SET = 0x00010000;
while (1)
{
IO0SET = 0x00020000;
MSdelay(150);
IO0CLR = 0x00020000;
IO0SET = 0x00040000;
MSdelay(150);
IO0CLR = 0x00040000;
IO0SET = 0x00080000;
MSdelay(150);
IO0CLR = 0x00080000;
IO0SET = 0x00100000;
MSdelay(150);
IO0CLR = 0x00100000;
}
}
#define CR 0x0D
#define PLOCK 0x400
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;
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
*/
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;
#define EN_Set IO0SET = 0x00800000;
#define EN_Clr IO0CLR = 0x00800000;
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;
for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
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 */
}
for(i=0;i<=Time;i++)
for(j=0;j<110;j++);
}
static void feed(void)
{
PLL0FEED = 0xAA;
PLL0FEED = 0x55;
}
void PLL_Init()
{
PLL0CFG = 0x24;
feed(); /* Enabling the PLL*/
PLL0CON = 0x01;
feed(); /* Wait for the PLL to lock set
frequency */
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);
}
}
RESULT
Thus stepper motor and temperature sensor are interfaced with ARM
7 Development Board Nvis 5004B.
EXPT NO :10 Implementing zigbee protocol with ARM
DATE:
AIM:
APPARATUS REQUIRED:
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
#define RS_Set IO0SET = 0x00200000;
#define RS_Clr IO0CLR = 0x00200000;
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))
{
IO1SET = 0x04000000;
if((IO1PIN & 0xF0000000)!= 0xF0000000)
{
IO1SET = 0x08000000;
if((IO1PIN&0xF0000000)!= 0xF0000000)
{
if((IO1PIN&0x10000000)==0x10000000)
{
LCD_Disp(0x8E,"F");
Send_String("F");
IOCLR1 = 0x10000000;
}
else if((IO1PIN&0x20000000)== 0x20000000)
{
LCD_Disp(0x8E,"E");
Send_String("E");
IOCLR1 = 0x20000000;
}
else if((IO1PIN&0x40000000)== 0x40000000)
{
LCD_Disp(0x8E,"D");
Send_String("B");
IOCLR1 = 0x40000000;
}
else if((IO1PIN&0x80000000)== 0x80000000)
{
LCD_Disp(0x8E,"C");
Send_String("C");
IOCLR1 = 0x80000000;
}
LCD_Delay (300);
}
IO1CLR = 0x08000000;
}
getvalue = U1RBR;
LCD_Cmd(0xCE);
LCD_Data(getvalue);
}
}
void LCD_Delay(unsigned int Time)
{
unsigned int i,j;
for(i=0;i<=Time;i++)
for(j=0;j<1275;j++);
}
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 */
}
IO1SET = Data << 16; /* Write Command Value to LCD Data Pin */
LCD_Delay(30); /* LCD_Delay for enable Clock*/