ESLab File
ESLab File
Submitted By:
ECE- 1, 7thSemester
Enrollment No. -
Submitted To:
Introduction:
Easy8051B development system is a full - featured development board for Atmel 8051
microcontroller. It is designed to allow students and engineers to easily test and explore the
capabilities of the 8051 microcontroller. It allows 8051 microcontroller to be interfaced with
external circuits and a broad range of peripheral d ices, making it possible for the user to
concentrate on software development.
Figurel illustrates the development board. There are identification marks beside each
component on a silkscreen. These marks describe connections to the microcontroller, operation
modes and provide additional information. Since all relevant information is provided on the
board there is almost no need for additional schematics.
1
Key Features:
1. External power supply 8-16 V AC/DC.
2. Choice between external and USB power supply.
3. Very fast and flexible USB programmer on board. The key feature is expandability.
4. DS 1820 temperature sensor allows to measure temperature with 0.50C accuracy.
5. One - RS232 port for communication with PC or another microcontroller.
6. 4-channel 12-Bit ADC (Analog to Digital Converter) with SPI interface.
7. 12-Bit DAC (Digital to Analog Convertor) with SPI interface.
8. By setting jumper in the upper position the pins of the appropriate port are set to logical
one (pull-up). By setting the jumper in the lower position, the pins are set to logical zero (pull
-down). Select pull up to provide logical zero on pin's input. Select pull down to provide
logical one on pin's input.
9. LCD connector allows easy connection of LCD in 4-bit mode.
10. Graphic LCD connector allows easy connection of GLCD or LCD in 8-bit mode.
11. Easy8051B supports microcontroller in DIP14, DIP16, DIP20, DIP40, PLCC44 and
PLCC32 package.
12. 32 buttons allow control of every pin on the microcontroller.
13. By pressing the button select high/low state of the pin.
14. See all the signals - each pin has an LED.
15. 4.096V voltage reference is used for working with A/D and D/A converter.
16. Upper four switches on the SW2 turns on/off the LEDs on PORTO, PORT l, PORT 2
and PORT 3. Select port to connect the LEDs to it. By using lower four switches select which
digit on the seven segment display are to be turned on.
17. Set LCD contrast accordingly to display characteristics.
18. Set GLCS contrast accordingly to display characteristics.
19. On-Board peripherals are connected to the microcontroller via switches on the SWI.
20. Seven segment displays multiplex mode for displaying values.
21. Reset circuit - if the reset button is pressed MCU will start executing from the beginning.
22. On-Board oscillator circuit for generating microcontrollers clock input.
2
8051 Pin Diagram:
3
Experiment-02
Output:
A = 30H (0b00110000)
Output:
A = 10H(Ob00010000)
Output:
A = 09H(0b0000l001) (Quotient)
B = 05H(0b00000l0l) (Remainder)
4
D. Write a program to multiply two numbers.
Program:
MOV A, #25H
MOV B, #65H
MUL A,B
MOV P3,A
Output:
A = 99H(0b10011001)
B = 0EH(0b0000l110)
5
Experiment-03
Output:
A = 06H(0b00000l10)
Output:
R1 = 04H(0b00000l00)
R2 = 01H(0b0000000l)
6
MOV A, #00H ;
MOV R2, #10H
MOV R0, #00H
AGAIN: INC R0
ADD A, R0
DJNZ R2, AGAIN
MOV P3, A
END
SYSTEM TABLE
L1 0006
Output:
37 H
7
Experiment-04
C. Write a program to toggle all the bits of Pl, P2 every 1/4 of a second.
Program:
BACK: MOV A, #55H
MOV PO, A
8
MOV P1, A
MOV P2, A
LCALL DELAY
MOV A, #AAH
MOV P0, A
MOV P1, A
MOV P2, A
LCALL DELAY
SJMP BACK
DELAY: MOV R1, #255
LOOP3: MOV R2, #255
LOOP2: MOV R3, #255
LOOP1: DJNZ R3, LOOP1
DJNZ R2, LOOP2
DJNZ RI, LOOP3
RET
9
Experiment-05
10
B. Write a program to display data 0-99 on seven segment display.
Program:
ORG 0100H
MOV A, #OOH
MOV P1, A
LOOP4: CLR A
MOV DPTR, 1000H
LOOP3: MOV R1, #10
LOOP2: MOV R2, #255
LOOP l: CLR P1.1
SETB PI.0
MOV A, R1
MOVC A, @A+DPTR
MOV PO,A
ACALL DELAY
CLR P1.0
SETB P1.1
MOV A, R0
MOVC A, @A+DPTR
MOV P0,A
ACALL DELAY
DJNZ R2, LOOP1
DJNZ RI, LOOP2
DJNZ RO, LOOP3
SJMP LOOP4
DELAY: MOV R3, #255
HERE: NOP
DJNZ R3, HERE
RET
ORG 1001H
DB 098H, 080H, 0F8H, 092H, 099H, 0B0H, 0A4H, 0F9H, 0C0H
11
Experiment-06
PIC is the name for the microchip microcontroller (MCU) family, consisting of a
microprocessor, I/O ports, timer and other internal, integrated hardware. The main advantages
of using the PIC are low external part count, a wide range of chip sizes (now from 5-pin up)
available, nice choice of compilers (assembly, C, Basic, etc) good wealth of example/tutorial
source code and easy programming. Once bought, the PIC's program memory is empty, and
needs to be programmed with code (usually HEX files) to be usuable in a circuit. For the
purpose, a wide range of simple programmer hardware docs and software
is downloadable from the net.
If you are a beginner with pics, a pic 16F628 or 16F877 device is a good choice to start with.
The PIC microcontroller development platform Nvis 5002 is a very useful kit for the student.
It can be used as a teaching tool as well as a learning tool. Nvis 5002 is a single board
microcontroller training development platform configured around the most popular microchip
PIC16F877A; 8 bit single chip microcontroller. Nvis 5002 is about the architecture, instruction
set and capabilities of PIC16F877A. PIC 16F877A provides up to 8k * 14 words of flash
program memory, up to 368*8 bytes of data memory(RAM), up to 256*8 bytes of
EEPROM data memory.
The input/output structure of Nvis 5002 provides 33 I/O lines. It has 16 bit timer/counter. The
kit has onboard PIC JDM programmer to burn hex file into controller.
12
The development platform is used with different modules of interfacing given with this kit and
also used for own applications
Features:
13
Technical Specifications
14
The first pin is the master clear pin of this IC. It resets the microcontroller and is active low,
meaning that it should constantly be given a voltage of 5 V and if 0 V are given then the
controller is reset. Resetting the controller will bring it back to the first line of the program
that has been burned into the IC.
A push button and a resistor is connected to the pin. The pin is already being supplied by
constant 5V. When we want to reset the IC we just have to push the button which will bring
the MCLR pin to 0 potential thereby resetting the controller.
PIN 2: RAO/ANO
PORTA consists of 6 pins, from pin 2 to pin 7, all of these are bidirectional input/output pins.
Pin 2 is the first pin of this port. This pin can also be used as an analog pin ANO. It is built in
analog to digital converter.
PIN 3: RAI/ANI
PIN 4: RA2/AN2/Vref-
It can also act as the analog input2. Or negative analog reference voltage can be given to it.
PIN 5: RA3/AN3/Vref+
It can act as the analog input 3. Or can act as the analog positive reference voltage.
PIN 6: RAO/TOCKI
To timer0 this pin can act as the clock input pin, the type of output is open drain.
15
PIN 7: RA5/SS/AN4
This can be the analog input 4. There is synchronous serial port in the controller also and this
pin can be used as the slave select for that port.
PIN 8: REO/RD/AN5
PORTE starts from pin 8 to pin 10 and this is also a bidirectional input output port. It can be
the analog input 5 or for parallel slave port it can act as a 'read control' pin which will be
active low.
PIN 9: REI/WR/AN6
It can be the analog input 6. And for the parallel slave port it can act as the 'write control'
which will be active low.
It can be the analog input 7, or for the parallel slave port it can act as the 'control select' which
will also be active low just like read and write control pins.
These two pins are the positive supply for the input/output and logic pins. Both of them
should be connected to 5V.
These pins are the ground reference for input/output and logic pins. They should be
connected to 0 potential.
16
This is the oscillator input or the external clock input bin.
This is the oscillator output pin. A crystal resonator is connected between pin 13 and 14 to
provide external clock to the microcontroller. 1/4 of the frequency of OSCI is outputted by
OSC2 in case of RC mode. This indicates the instruction cycle rate, crystal interfacing with
PIC 16F877A
PORTC consists of 8 pins. It is also a bidirectional input output port. Of them, pin 15 is the
first.
It can be the output for SPI or 12C modes and' can be the input/output for synchronous serial
clock.
It can be the SPI data in pin. Or in 12C mode it can be data input/output pin.
17
PIN 24: RC5/SDO
All of these pins belong to PORTD which is again a bidirectional input and output port.
When the microprocessor bus is to be interfaced, it can act as the parallel slave port.
All these pins belong to PORT B. Out of which RBO can be used as the external interrupt pin
and RB6 and RB7 can be used as in-circuit debugger pins.
18
Experiment-07
Program:
#include <PIC.h>
// CONFIG(WDTDIS & LVPDIS & PWRTEN & XT);
CONFIG(FOSC HS & PWRTE ON & WDTE OFF & CP_OFF & LVP_OFF);
/ * LED Bar Graph data and clock pin define at PORT C*/
#define ROW data RC0
#define ROW Clock RCO
#define COL data RC2
#define COL Clock RC3
#define Enable RC4
/***************************FUNCTION PROTOTYPE*********************/
void row_Clock();
void col_Clock();
void out_enable();
void N_data();
void DelayMs(unsigned int count);
/***************************MAIN PROGRAM***************************/
void main ( )
{
unsigned int k;
TRISC = 0X00;
PORTC = 0X00;
19
Enable = 0;
while(l)
{
N_data();
}
}
/****************************SUBROUTINES***************************/
void N_data()
{
//first column
COL_data = 1;Clock(); COL_data=1;col_Clock; COL_data=1;
Col_Clock(); COL_data=1; Col_Clock(); COL_data=0; col_Clock();
ROW_data = 0; row_Clock(); ROW_data = l; row_Clock();
ROW_data = l; row_Clock(); ROW_data = l; row_Clock();
ROW data = l; row _ Clock(); ROW_data = l; row_Clock();
ROW_data = 0; row _ Clock();
out_enable();
//second column
COL data = 1; l; col_Clock();COL_data = l;col_Clock(); COL_data = 1;
col_Clock(); COL_data 0; col_Clock(); COL_data = 1 ; col_Clock();
ROW_data = 0; row_Clock();ROW_data = 0; row_Clock();
ROW_data = 0; row_Clock(); ROW_data = 0; row _ Clock();
ROW data = l; ROW_data = 0; ROW_data = 0; row_Clock();
ROW_data = 0; row_Clock();
out_enable();
//third column
COL_data = 1;col_Clock();COL_data = 1;col_Clock();COL_data=0;
col_Clock();COL_data = 1;col_Clock();COL_data = 1;col_Clock();
ROW data = 0; row Clock();ROW data = l; row Clock();
ROW_data = l; row_Clock(); ROW data = l; row Clock();
20
ROW_data = l; row_Clock(); ROW data = l; row Clock();
ROW_data = 0; row_Clock();
out_enable();
//fourth column
COL_data = l; col_Clock(); COL_data = 0; col_Clock(); COL_data 1 ;
col_Clock(); COL_data = l;col_Clock();COL_data 1 ; col_Clock();
ROW data = 0; row Clock(); ROW data = 0; row _ Clock();
ROW data = l; row Clock(); ROW data = 0; row _ Clock();
ROW data = 0; row Clock(); ROW data = 0; row _ Clock();
ROW data = 0; row Clock();
out_enable();
//fifth column
COL _ data = 1; col_Clock(); COL_data = l; col_Clock();COL_data = l;
col_Clock(); COL _ data = 1; col_Clock(); COL_data = l; col_Clock();
ROW_data = 0; row _ Clock(); ROW data = l; row _ Clock();
ROW_data = l; row _ Clock(); ROW data = l; row _ Clock();
ROW_data = l; row _ Clock(); ROW data = l; row _ Clock();
ROW_data = 0; row _ Clock();
out_enable();
/******************************Row Clock******************************/
void row_Clock()
{
ROW_Clock = 0;
ROW_Clock = l;
}
/******************************Column Clock******************************/
void col_Clock()
{
21
COL Clock = 0;
COL Clock = l;
}
/******************************Enable Pin******************************/
void out_enable()
{
Enable = 0;
DelayMs( l);
Enable = l;
DelayMs(35):
}
/******************************End******************************/
Result Analysis:
Step l:-
• Switch ON Nvis 5002
• Burn program LED Bar Graph Interface.hex file in PIC 16F877A
22
Microcontroller using Nvis 5002
Step 3:-
• Place Microcontroller on ZIF Socket.
• Switch on the power supply.
Press Reset Switch.
Step 4:-
Output:
"N" will display on LED Bar Graph.
23
Experiment-08
Program:
#include<pic.h>
_CONFIG(FOSC & PWRTE_ON & WDTE OFF & cp OFF & LVP_OFF);
#define LCD Port PORTD /*LCD data pin(DO-D7 to PortD*/
#define LCD rs RB5 /*LCD RS(Register select) pin RB5*/
#define LCD RB6 /*LCD R/.W(Read/Write) pin RB6*/
#define LCD en RB7 /*LCD Enable pin RB7*/
/******************************FUNCTION
PROTOTYPE*************************/
void LCD init();
void LCD Cmd(unsigned char);
void LCD Data(unSigned char ASCII);
void LCD Disp(unsigned char Loc, unsigned char *string);
/*****************************COMPANY
NAME********************************/
void Display_CompanyName()
{
LCD_Disp(0x80, “ Nvis”);
LCD_Disp(0x0C, “ Technologies”);
}
/*****************************DELAY********************************/
24
unsigned int x,y;
for(x = 0; x<=rTime; x44);
for(y = 0;y+=500; y++);
}
/*****************************MAIN FUNCTION*************************/
void main()
{
TRISB = 0x00; /*PORTB initialised as output Port*/
TRISD = 0x00; /*PORTD initialised as Output Port*/
LCD_Init(); /* LCD Control command initialized*/
LCD_Cmd(0x01); /* Clear Display*/
Display_CompanyName(); /* Display Company Name*/
while(l);
}
/*****************************SUBROUTINES*************************/
void LCD_Init()
{
LCD_Cmd(0x38); /*Function Set 8bit:2 Line 5*7 Dots*/
Delay(2);
LCD Cmd(0x0E); /*Display On Cursor Off*/
Delay(2);
LCD Cmd(0x01); /*Clear Display*/
Delay(2);
LCD Cmd(0x06); /*Entry Mode*/
Delay(2);
}
26
/*********************************End********************************/
Result Analysis:
Step l:-
• Switch ON Nvis 5002
• Burn program LED Bar Graph Interface.hex file in PIC16F877A Microcontroller
using Nvis 5002
Step 2:- Connections
• Connect FRC cable Nvis 5002 Port RD to LCD Data(MC04).
• Connect FRC cable Nvis 5002 Port RB to LCD Control(MC04).
Step 3:-
• Place Microcontroller on ZIF Socket.
• Switch on the power supply.
• Press Reset Switch.
Step 4:-
Output:
A message "Nvis Technologies" will display on LCD Screen.
27
Experiment-09
Objective - Write a program to interface seven segment display with PIC Microcontroller
Program:
#include <pic.h>
void DELAY ms(unsigned int ms_Count)
{
unsigned int i,j;
for(i=0;i<ms_Count;i4+)
{
for(j=0;j<1000;j++);
}
}
int main()
{
char seg_code[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
int i;
while (l)
{
for (i = 0; i <= 9; i++) // loop to display 0-9
{
PORTD = seg_code[i];
_delay_ms(1000);
}
}
}
28
Output Analysis:
Step l: Switch ON N Vis 5002 and burn program Seven Segment Interface, hex file in PIC
16F877A microcontroller.
Step 2: Connect an FRC cable from N Vis 5002 Port RC to data pins of segment (MC04).
Also connect FRC cable from N Vis 5002 Port RD to the transistor input of the Segments
(MC04).
Step 3: Place Microcontroller on ZIF Socket, switch on the Power Supply and press Reset
button
29
Experiment-10
Objective - Write a program to interfacing of hex keypad with PIC Microcontroller and
Output display on LCD
Program:
#include<pic.h>
#define _XTAL FREQUENCY 4000000
30
LCD_rw = 0; //Clear bit P 3.7
LCD_en = 1; //Set bit P3.7
delay(2);
LCD en = 0;
}
void LCD_Init()
{
LCD_Cmd(0x38); //Functions set 8bit: 2 lines 5X7 Dots
delay(5);
LCD Cmd(0x0C); //Display ON Cursor OFF
delay(5);
LCD Cmd(0x0l); //Clear Display
delay(5);
LCD Cmd(0x06); //Entry Mode
delay(5);
31
/**************Write character to LCD****************/
/*******************Keypad subroutine******************/
//Row1 scan
ROW1 = l;
if(COL0 != l)
{
KeyVal = ‘0’;
return KeyVal;
}
if(COLl != l)
{
KeyVal = ‘A’;
return KeyVal•,
}
if(COL2 != 1)
{
KeyVal = 'B’;
return KeyVal;
}
if(COL3 != l)
{
KeyVa1 = ‘C’;
return KeyVal;
}
ROW1 = 0;
33
//Row2 scan
ROW2 = l;
if(COL0 != l)
{
KeyVal = ‘7’;
return Key Val;
}
if(COL1 != 1)
{
KeyVal = ‘8’;
return KeyVal;
}
if(COL2 != 1)
{
KeyVal = ‘9’;
return KeyVal;
}
if(COL3 1)
{
KeyVal = ‘D’;
return KeyVal;
}
ROW2 = 0;
//Row3 scan
ROW3 = l;
if(COL0 != 1)
{
KeyVal = ‘4’;
return KeyVal;
}
if(COLl != l)
{
34
KeyVal = '5';
return KeyVal;
}
if(COL2 != l)
{
KeyVal = ‘6’;
retum KeyVal;
}
if(COL3 != l)
{
KeyVal = ‘E’;
return KeyVal;
}
ROW3 = 0;
}
return KeyVal;
}
void main()
{
OPTION REG = 0x00;
TRISC = 0x00;
TRISB = 0x0F;
TRISD = 0x00;
ADCONI = 0x06;
buzzer = 0;
led = 0;
35
while(l)
{
scan_keypad(); //Keypad Sense
LCD_Cmd(0xC8); //if Key is presses select LCD Location
LCD_data(KeyVal); //Display Key value
}
}
Output Analysis:
Step 1: Switch ON N Vis 5002 and bum program Seven Segment Interface,hex file in
6F877A microcontroller.
step 2: Connect FRC cable from NVis 5002 Port RC with "LCD_Control" Connector of
MCIO.
Connect FRC cable from NVis 5002 Port RD with "LCD _ Data" Connector of MC10.
Connect FRC cable from NVis 5002 Port RB with "Keypad" Connector of MC10.
Output:
Initially on LCD "Key pressed" is showing. Now whenever you will press any key the same
character will display on LCD second row.
36
Experiment-11
Nvis Technologies ARM 7 Development Board (Nvis 5004A) serves as a 32 bit development
platform and provides means for code development. This trainer designed for students to
explore ARM architecture and on board supporting peripherals provide an ideal platform for
extensive embedded development. The trainer provides serial and USB connection both that
can be used to download and run code on any standard IDE. This trainer allows users to
evaluate, prototype and create application specific designs.
Features:
37
• USB 2.0 Full-speed compliant device controller with 2 KB of endpoint RAM. In addition,
the LPC2146/48 provides 8 KB of on-chip RAM accessible to USB by DMA
• Every pin is marked in order to make work easier
• Master Reset/Restart Key for hardware reset
• On board UART I Interface
• On board ADC (10 Bit ) Interface
• On board 10-bit DAC provides variable analog output
• On board P WM Interface
• On board facility to connect J TAG debugger
• On board GPIO Connectors
• 60MHz maximum CPU clock available from programmable on-chip P LL with settling
time of loops
• On-chip integrated oscillator operates with an external crystal from I MHz to 25 MHz
• Power saving modes include Idle and Power-down
• Input/ Output & test points provided on board
• On board four external interrupts interface
• Self contained trainer with On board DC Power Supply
• CD with sample project code, Programmer software & useful documents
• Learning Material
Technical Specifications:
• MCU : LPC2148
• Crystal Frequency : 12 MHz
• LED's : 8
• ADC : Two Internal 10 bit C(14 Channel)
• DAC : Single 10 Bit Internal DAC
• Interrupts : Four External interrupts on Board
• RTC : 3.3 Volt CMOS Battery
• PWM : Three No's on Board
• GPIOs : All GPIO Pins on Board
• Communication Interfaces : USB 2.0 Full speed device control
38
• Serial Communication : RS 232 Port
• Programmer : USB
• Programmer Mode Selection : Run/ISP Switch
• Baud Rate : 9600 bps (for both USB/Serial Ports)
• Interconnections : 2 mm Patch Chords & FRC Cables
• Main Supply : 230 V ±10%, 50Hz
Block Diagram:
39
General procedure to operate ARM7 Controller Board
Equipments needed:
1. SMPS supply
2. USB cable
3. Mains Cord
Procedure:
l. Connect the USB cable (supplied along with the board) to any functional USB port of your
PC and ISP (USB) port provided on the right side of the board (in PC interface & ISP
section).
2. Change the position of Run/ISP switch placed in "PC Interface & ISP Section" block on
the ISP mode.
40
3. Turn ON switch no l, 2 placed in "PC Interface & ISP Section" block.
4. Connect the SMPS Supply to the trainer and switch 'ON' the supply.
5. Start the Philips flash utility (available in the all programs on the Start menu of Windows
OS: Start menu/A11 programs/Philips semiconductor/Flash utility/ Launch LPC210x
ISP.exe.) & select the appropriate port settings (use baud rate 9600).
6. Program LED Interface.hex files (CD-drive\On Board Experiments\LED
Interface\LED_lntarfc 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 and then press reset switch.
10. Observe the result/ blinking of LED's according to program.
41
Experiment-12
Program:
/*LED Bar Graph data and clock pin define at port B*/
#define ROW_data_Clr IO1CLR = 0x000l0000;
#define ROW_Clock_Clr IO1CLR = 0x00020000;
#define COL_data_Clr IO1CLR = 0x00040000;
#define COL_Clock_Clr IO1CLR = 0x00080000;
#define ROW_data_Set IO1SET = 0x000l0000;
#define Row_Clock_Set IO1SET = 0x00020000;
#define COL_data_Set IO1SET = 0x00040000;
#define COL_Clock_Set IO1SET = 0x00080000;
#define Enable_Clr IO1CLR = 0x00l00000;
#define Enable_Set IO1SET = 0x00l00000;
/*************************FUNCTION PROTOTYPE************************/
void row_Clock();
void col_Clock();
void out_enable();
void Display_Char N();
void DelayMs(unsigned int count);
/*************************MAIN PROGRAM************************/
int main()
{
I01DIR = 0x001F0000;
I01SET = 0x00100000;
while(l) // Loop will work for Infinite times
{
Display_Char_N();
42
}
}
/**************************SUBROUTINES***************************/
/**************************N character display***************************/
/******************Row Clock*******************/
Void row_Clock()
{
ROW_Clock_Clr;
Row_Clock_Set;
}
/******************Column Clock*******************/
void col_Clock()
{
COL_Clock_Clr;
COL_Clock_Set;
}
/******************Enable pin*******************/
Void out_enable()
{
Enable_Clr;
DelayMs(200);
Enable_Set;
44
DelayMs(50);
}
Result Analysis:
Step 1:-
• Switch ON Nvis 5004A
• Turn the toggle switch in ISP Mode
• Bum program LED Bar Graph Interface.hex file in LPC2148 Microcontroller
• Turn the toggle switch in RUN Mode
Step 2:-
Connections:
Connect FRC cable Nvis 5004A Pl.16-PI.l.23 LED Bar Graph Interface
Block Socket(MC04)
Step 3:-
Turn on the supply
Press Reset Switch
step 4:-
OUTPUT
"N" will display on LED Bar Graph
45
Experiment-13
Program:
#include<lpc214x.h>
/********************FUNCTION PROTOTYPES************************/
/*******************************DELAY*******************************/
46
/********************************************************************
*LCD initialization
*Description: This function initialises the LCD module by the following steps:
* l. Set 8BIT: 2 Line 5x7 Dots (0x38)
* 2. Display On curser Off (0x0C)
* 3. Clear Display (0x0l)
* 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(0x0l); /*Clear Display*/
LCD_Cmd(0x06); /*Entry Mode*/
}
/********************************************************************
*LCD Command (Shifting is done here)
*Description: This function initialises the LCD Module by the following steps:
*Note: Here we have selected Pin P1.16 to P1.23 as LCD data line,
*that's why we need to shift data by 16
********************************************************************/
47
LCD_Delay(10);
IO1SET = Shifted_Cmd; /*Write Command Value to LCD Data Pin*/
LCD_Delay(20); /*LCD_Delay for enable Clock*/
EN_Clr; /*Enable Pin Clear*/
LCD_Delay(10);
IO1CLR = 0x00FF0000; /*Clear All pins of LCD*/
}
/********************************************************************
*
*LCD Data
*
*Description: This function initialises 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
********************************************************************/
/********************************************************************
48
***LCD Display
*Description: This function initialises the LCD module by the following steps:
* l. Send Loc from where data needs to write
* 2. Display string on LCD
********************************************************************/
/*****************************MAIN ROUTINE******************************/
int main(void)
{
IO1DIR = 0xFFFF0000; /*Set LCD pin as output*/
LCD_Init(); /*Initialise LCD*/
while(l)
{
LCD_Disp(0x80,‘ Nvis ‘); /*Display "NVIS"*/
LCD_Disp(0xC0, ‘ Technologies ‘ ); /*Display "Technologies’’*/
}
}
/************************************END*********************************/
49
Result Analysis:
Step l:-
• Switch ON Nvis 5004a
• Turn the toggle switch in ISP Mode
• Burn Program "LCD Interface.hex" file in LPC2148 Microcontroller
using Nvis 5004A
• Turn the toggle switch in RUN Mode
Step 2:-
Connection:
• Connect P1,24-P1.31 of " Nvis 5004A board" to "LCD_Control"
connector present on the board "MC04 Display Module" Module.
• Connect Pl.16-Pl.23 of "Nvis 5004A board" to "LCD_Data"-connector
present on the board "MC04 Display Module" Module.
step 3:-
OUTPUT:
"Nvis Technologies" Display on 16x2 LCD Display.
50
Experiment-14
Objective- Study and analysis of Seven Segment Display Interface with ARM 7
Controller.
Program:
#include<lpc214x.h>
/*****************************Main Function*****************************/
int main(void)
{
IO0DIR = 0x00000FFF; /*Define Port as Output*/
IO0SET = 0x00000F00; /*Set all Control Pins*/
while(l)
{
IO0SET = 0x3F; /*Display '0' on Seven Segment*/
MSdelay(2000); /*Delay — A small pause to display*/
IO0CLR = 0x3F; /*Clear '0' on Seven Segment*/
IO0SET = 0x06;
MSdelay(2000);
IO0CLR = 0x06;
IO0SET = 0x5B;
MSdelay(2000);
IO0CLR = 0x5B;
51
IO0SET = 0x4F;
MSdelay(2000);
IO0CLR = 0x4F;
IO0SET = 0x66;
MSdelay(2000);
IO0CLR = 0x66;
IO0SET = 0x6D; /*Display '5' on Seven Segment*/
MSdelay(2000); /*Delay — A small pause to display*/
IO0CLR = 0x6D; /*Clear '5' on Seven Segment*/
IO0SET = 0x7D;
MSdelay(2000);
IO0CLR = 0x7D;
IO0SET = 0x07;
MSdelay(2000);
IO0CLR = 0x07;
IO0SET = 0x7F;
MSdelay(2000);
IO0CLR = 0x7F;
IO0SET = 0x6F;
MSdelay(2000);
IO0CLR = 0x6F;
}
}
/***********************************End*********************************/
Result Analysis:
Step l:-
Switch ON Nvis 5004A
Turn the toggle switch in ISP Mode
Burn Program "LCD Interface.hex" file in LPC2148 Microcontroller
using Flash Utility
Turn the toggle switch in RUN Mode
52
Step 2:-
Connection:
Connect an FRC cable from Nvis 5004A port P0.0-P0.7 to (7-Seg_Data)
MC04
Connect another FRC cable from Nvis 5004A port P0.8-P0.15 to (7-
Seg_Control) MC04
Step 3:-
OUTPUT: 0000 to 9999 all four seven segment display.
53