Digital Clock
Digital Clock
Digital Clock
On
Apart from the efforts of me, the success of this project depends largely on
the encouragement and guidance of many others. I take this opportunity to
express my gratitude to the people who have been instrumental in the
successful completion of this project.
I would like to show my greatest appreciation to Er.Vishu Grover from
Innovation Research and Development. I can’t say thank you enough for
their tremendous support and help. I feel motivated and encouraged every
time. Without their Encouragement and Guidance this project would not
have materialized.
The guidance and support received from my friend (name) who contributed
and are contributing to this project, was vital for the success of the project. I
am grateful for their constant support and help.
DECLARATION
Name of Student:
Registration Number
ABSTRACT:
This project incorporates the functionality of a digital clock and a digital thermometer.
The digital clock works in 12 hour mode and is configured by programming the 8051
microcontroller (AT89C51). The program uses a delay function for producing a delay of
1 second. The clock and alarm times can be set through a set of external tactile switches.
The digital thermometer employs a temperature sensor LM35. The sensor responds to the
temperature change by giving varying output. These analog signals of LM35 are
converted to digital equivalent by ADC0804. The reference voltage (Vref) should be set
properly corresponding to the desired temperature range. The data bits are taken as input
by the microcontroller at port P0. The microcontroller AT89C51 also gives control
signals to ADC0804.
This project is a clock that displays the time and date on seven segment led displays. Two
buttons are used to set the time and date. The program takes care of changing the date and
keeping track of leap years. In this project, we have built a digital clock with 12 hour
count time. The clock runs from 00:00 to 11:59 and then back to 00:00. Our display has
four digits, two digits for minutes and two for hour. The specialty of this clock is that it
has very low power consumption and condensed layout.
SUMMARY:
This project works as a digital clock wherein a user can also set alarm. Additionally, it
also works as a digital thermometer to specify the ambient temperature. Both, the clock
and temperature are displayed on a 16x2 LCD screen using the 8051 microcontroller
(AT89C51). AT89C51 is an eight bit controller which belongs to the 8051 family of
microcontrolers.
On reset, the LCD prompts the user to set time. Only the hour and
minute components can be set by pressing the corresponding
switches, repeatedly. These switches are made active low and so they
provide ground to the corresponding input pins of the controller. The
AM/PM mode is set by toggling the switch between ground and Vcc.
Ground would set the clock in AM mode while Vcc would set it in PM
mode. The clock starts when start pin is connected to Vcc by pressing
the switch. The set time is displayed on LCD screen and changes as
the time passes on. Seconds are increased after every one second by
making use of delay function. As second reaches 59, minute is
incremented by one and second is reset to 0. Similarly, as minute
reaches 59, hour is increased by one and minute is set to 0. After hour
reaches 11, minute reaches 59 and second reaches 59, all of them are
set to 0 and the AM/PM mode is changed accordingly.
Circuit description
Components used
Preset
A preset is a three legged electronic component which
can be made to offer varying resistance in a circuit. The
resistance is varied by adjusting the rotary control over
it. The adjustment can be done by using a small screw
driver or a similar tool. The resistance does not vary
linearly but rather varies in exponential or logarithm...
•
LCD
The most commonly used Character based LCDs are based on Hitachi's
HD44780 controller or other which are compatible with HD44580. In
this tutorial, we will discuss about character based LCDs, their
interfacing with various microcontrollers, various interfaces (8-bit/4-
bit), programming, special stuff and tricks you can do with these
simple looking LCDs which can give a new look to your application.
Pin Description
The most commonly used LCDs found in the market today are 1 Line, 2
Line or 4 Line LCDs which have only 1 controller and support at most of
80 charachers, whereas LCDs supporting more than 80 characters
make use of 2 HD44780 controllers.
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has
16 Pins (two pins are extra in both for back-light LED connections). Pin
description is shown in the table below.
Usually these days you will find single controller LCD modules are used
more in the market. So in the tutorial we will discuss more about the
single controller LCD, the operation and everything else is same for the
double controller too. Lets take a look at the basic information which is
there in every LCD.
Figures below will show you the DDRAM addresses of 1 Line, 2 Line and
4 Line LCDs.
Now you might be thinking that when you send an ascii value to
DDRAM, how the character is displayed on LCD? so the answer is
CGROM. The character generator ROM generates 5 x 8 dot or 5 x 10
dot character patterns from 8-bit character codes (see Figure 5 and
Figure 6 for more details). It can generate 208 5 x 8 dot character
patterns and 32 5 x 10 dot character patterns. Userdefined character
patterns are also available by mask-programmed ROM.
As you can see in both the code maps, the character code from 0x00
to 0x07 is occupied by the CGRAM characters or the user defined
characters. If user want to display the fourth custom character then
the code to display it is 0x03 i.e. when user send 0x03 code to the LCD
DDRAM then the fourth user created charater or patteren will be
displayed on the LCD.
To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and
The MSB of the LCD data bus (D7) act as busy flag. When BF = 1
means LCD is busy and will not accept next command or data and BF
= 0 means LCD is ready for the next command or data to process.
Only the instruction register (IR) and the data register (DR) of the LCD
can be controlled by the MCU. Before starting the internal operation of
the LCD, control information is temporarily stored into these registers
to allow interfacing with various MCUs, which operate at different
speeds, or various peripheral control devices. The internal operation of
the LCD is determined by signals sent from the MCU. These signals,
which include register selection signal (RS), read/write signal (R/W),
and the data bus (DB0 to DB7), make up the LCD instructions (Table
3). There are four categories of instructions that:
Although looking at the table you can make your own commands and
test them. Below is a breif list of useful commands which are used
frequently while working on the LCD.
The table above will help you while writing programs for LCD. But after
you are done testing with the table 4, i recommend you to use table 3
to get more grip on working with LCD and trying your own commands.
In the next section of the tutorial we will see the initialization with
some of the coding examples in C as well as assembly.
Keeping these steps in mind we can write LCD command routine as.
CODE:
;Ports used are same as the previous example
;Routine to send command to LCD
LCD_command:
mov LCD_data,A ;Move the command to LCD port
clr LCD_rs ;Selected command register
clr LCD_rw ;We are writing in instruction register
setb LCD_en ;Enable H->L
clr LCD_en
acall LCD_busy ;Wait for LCD to process the command
ret ;Return from busy routine
The equivalent C code Keil C compiler. Similar code can be written for SDCC.
CODE:
void LCD_command(unsigned char var)
{
LCD_data = var; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in instruction register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
}
// Using the above function is really simple
// var will carry the command for LCD
// e.g.
//
// LCD_command(0x01);
The seventh bit is always 1, and bit 0 to 7 are DDRAM address (See the
introduction section of LCD). so if you want to put the cursor on first
position the address will be '0000000B' in binary and 7th bit is 1. so
address will be 0x80, so for DDRAM all address starts from 0x80.
For 2 line and 16 character LCD. The adress from 0x80 to 0x8F are
visible on first line and 0xC0 to 0xCF is visible on second line, rest of
the DDRAM area is still available but is not visible on the LCD, if you
want to check this thing, then simply put a long sting greater than 16
character and shift the entire display, you will see all the missing
character coming from the back.. this way you can make scrolling line
on LCD (see more on shifting display in commands section).
Below is an example for setting cursor position on LCD.
CODE:
;We are placing the cursor on the 4th position
;so the DDRAM address will be 0x03
;and the command will be 0x80+0x03 = 0x83
mov a,#83H ;load the command
acall LCD_command ;send command to LCD
CODE:
// to do the same thing is C
// as we done before
LCD_command(0x83);
Keeping these steps in mind we can write LCD command routine as.
CODE:
;Ports used are same as the previous example
;Routine to send data (single character) to LCD
LCD_senddata:
mov LCD_data,A ;Move the command to LCD port
setb LCD_rs ;Selected data register
clr LCD_rw ;We are writing
setb LCD_en ;Enable H->L
clr LCD_en
acall LCD_busy ;Wait for LCD to process the data
ret ;Return from busy routine
CODE:
void LCD_senddata(unsigned char var)
{
LCD_data = var; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 1; //Selected data register
LCD_rw = 0; //We are writing
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
}
// Using the above function is really simple
// we will pass the character to display as argument to function
// e.g.
//
// LCD_senddata('A');
Now you have seen that its really easy to send command and data to
LCD. Now what if we have a string to send to LCD? how we are going to
do that?
Is simple, we will store the LCD string in the ROM of controller and call
the string character by character. A simple exmple is shown below.
CODE:
;Sending string to LCD Example
LCD_sendstring:
clr a ;clear Accumulator for any previous
data
movc a,@a+dptr ;load the first character in
accumulator
jz exit ;go to exit if zero
acall lcd_senddata ;send first char
inc dptr ;increment data pointer
sjmp LCD_sendstring ;jump back to send the next character
exit:
ret ;End of routine
CODE:
void LCD_sendstring(unsigned char *var)
{
while(*var) //till string ends
LCD_senddata(*var++); //send characters one by one
}
// Using the above function is really simple
// we will pass the string directly to the function
// e.g.
//
// LCD_sendstring("LCD Tutorial");
Now we are ready with sending data and sending command to LCD.
Now the last and final section which is creating custom characters or
patterns to display on LCD. Please proceed to the next section to read
more.
4-bit Initialization
►Assembly Program
CODE:
;In this whole 4-bit tutorial LCD is connected to
;my controller in following way...
;D4 - P3.0
;D5 - P3.1
;D6 - P3.2
;D7 - P3.3
;EN - P3.7
;RS - P3.5
lcd_init:
acall lcd_reset ;Call LCD Reset sequence
mov a,#28H ;4-bit, 2 line, 5x7 dots
acall lcd_cmd ;Call LCD command
mov a,#0CH ;Display ON cursor OFF
acall lcd_cmd ;Call LCD command
mov a,#06H ;Set entry mode (Auto increment)
acall lcd_cmd ;Call LCD command
mov a,#80H ;Bring cursor to line 1
acall lcd_cmd ;Call LCD command
ret
►C Program
CODE:
//The pins used are same as explained earlier
#define lcd_port P3
void lcd_reset()
{
lcd_port = 0xFF;
delayms(20);
lcd_port = 0x03+LCD_EN;
lcd_port = 0x03;
delayms(10);
lcd_port = 0x03+LCD_EN;
lcd_port = 0x03;
delayms(1);
lcd_port = 0x03+LCD_EN;
lcd_port = 0x03;
delayms(1);
lcd_port = 0x02+LCD_EN;
lcd_port = 0x02;
delayms(1);
}
void lcd_init ()
{
lcd_reset(); // Call LCD reset
lcd_cmd(0x28); // 4-bit mode - 2 line - 5x7 font.
lcd_cmd(0x0C); // Display no cursor - no blink.
lcd_cmd(0x06); // Automatic Increment - No Display shift.
lcd_cmd(0x80); // Address DDRAM with 0 offset 80h.
}
CODE:
lcd_cmd: ;LCD command Routine
mov temp,a ;Save a copy of command to temp
swap a ;Swap to use higher nibble
anl a,#0FH ;Mask the first four bits
add a,#80H ;Enable = 1, RS = 0
mov lcd_port,a ;Move it to lcd port
anl a,#0FH ;Enable = 0, RS = 0
mov lcd_port,a ;Move to lcd port
►C Program
CODE:
void lcd_cmd (char cmd)
{
lcd_port = ((cmd >> 4) & 0x0F)|LCD_EN;
lcd_port = ((cmd >> 4) & 0x0F);
delayus(200);
delayus(200);
}
delayus(200);
delayus(200);
Reset - RST
Crystal - XTAL[1,2]
I/O Port
– P0[7;0], P1[7:0], P2[7:0], P3
EA/VP Pin
The EA on pin 31 is tied high to make the 8051 executes program from Internal ROM
Reset Circuit
RESET is an active High input When RESET is set to High, 8051 goes back to the power on
state.
The 8051 is reset by holding the RST high for at least two machine cycles and then returning it
low.
Power-On Reset
Manual reset
-closing the switch momentarily will make RST High.
After a reset, the program counter is loaded with 0000H but the content of on-chip RAM is not affected.
Oscillator Circuit
The 8051 uses the crystal for precisely that: to synchronize it’s operation. Effectively, the 8051
operates using what are called "machine cycles." A single machine cycle is the minimum amount
of time in which a single 8051 instruction can be executed. although many instructions take
multiple cycles.
8051 has an on-chip oscillator. It needs an external crystal thats decides the operating
frequency of the 8051.
The oscillator can also be a TTL clock source connected with a NOT gate as shown
A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes one machine
cycle to execute, it will take 12 pulses of the crystal to execute. Since we know the crystal is
pulsing 11,059,000 times per second and that one machine cycle is 12 pulses, we can calculate
how many instruction cycles the 8051 can execute per second:
11,059,000 / 12 = 921,583
Why is such an oddball crystal frequency?
11.0592 MHz crystals are often used because it can be divided to give you exact clock rates for
most of the common baud rates for the UART, especially for the higher speeds (9600, 19200). Despite the "oddball"
value, these crystals are readily available and commonly used.
Power Supply
C1-1000 mf ,C2-
100 mf
The 78L05 is a 5V
regulator. The input
voltage ranges
from 7V to 35V and the output voltage is about 5V.
8051 is TTL logic device. TTL logic has two levels: Logic "High" (1) and logic "Low" (0). The voltage and current involved for the
two levels are as follows:
Leve Voltag
Current
l e
High Above Virtually no current flow
2.4V
1.6mA Sinking current
Below
Low from TTL input to ground
0.9V
(Depends on logic family)
Port functions
Ports
Function
(Pin Dedicated I/O port – Used solely for interfacing to external devices
1-8) Internal pull-ups
Port
2
Port
3
Dual-purpose port- 1. general purpose I/O port.
2. pins have alternate purpose related to special features of the 8051
(Pin Internal pull-ups
10-
17)
The 8051 internal ports are partly bi-directional (Quasi-bi-directional). The following is the internal circuitry for the 8051 port
pins:
P0 is open drain.
– Has to be pulled high by external 10K resistors.
– Not needed if P0 is used for address lines
Writing to a port pin loads data into a port latch that drives a FET connected to the port pin.
P0: Note that the pull-up is absent on Port 0 except when functioning as the external
address/data bus. When a "0" is written to a bit in port 0, the pin is pulled low. But when a "1"
is written to it, it is in high impedance (disconnected) state. So when using port 0 for output, an
external pull-up resistor is needed, depending on the input characteristics of the device driven
by the port pin
P1, P2, P3 have internal pull-ups: When a "0" is written to a bit in these port , the pin is
pulled low ( FET-ON) ,also when 1 is written to a bit in these port pin becomes high (FET-OFF)
thus using port P1,P2,P3 is simple.
You can used a port for output any time. But for input, the FET must be off. Otherwise, you will
be reading your own latch rather than the signal coming from the outside. Therefore, a "1"
should be written to the pin if you want to use it as input, especially when you have used it for
output before. If you don't do this input high voltage will get grounded through FET so you will
read pin as low and not as high. An external device cannot easily drive it high
so, you should not tide a port high directly without any resistor. Otherwise, the FET would burn.
Be Careful :
Some port pins serve multiple functions. Be careful writing to such ports. For example, P3.0 is
the UART RXD (serial input), and P3.1 is the UART TXD (serial output). If you set P3.0 to a '0',
an external buffer (such as an RS232 level translator) cannot drive it high. Therefore you have
prevented receiving any serial input.
If an external interrupt such as EX1 on P3.3 is enabled, and set to be level sensitive, and you
clear this pin's output latch to a zero, guess what? You've just caused a perpetual interrupt 1.
The pin's input buffer will read the output of it's latch as always low. Your controller will spend
all of its time in the interrupt handler code and will appear to have crashed, since it will have
very little time for other tasks. In fact, it will get to execute a single instruction before re-
entering the interrupt handler, so the rest of your program will execute very, very slowly.
Program code
#include<reg51.h>
#define cont_port P3
#define port P1
#define m_sec 10
sbit rs = cont_port^0;
sbit rw = cont_port^1;
sbit en = cont_port^6;
sbit dig_hr1=port^0;
sbit dig_min1=port^1;
sbit start=port^2;
sbit am_pm=port^3;
int hr ,hr1=0;
int min,min1=0;
int sec,sec1=0,dig_am_pm=0;
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void lcd_cmd(unsigned char item) // Function to send command on LCD
dataport = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;
dataport = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
int i=0;
while(str[i]!='\0')
lcd_data(str[i]);
i++;
delay(1);
return;
}
lcd_data_int(int time_val) // Function to send number on LCD
int int_amt;
int_amt=time_val/10;
lcd_data(int_amt+48);
int_amt=time_val%10;
lcd_data(int_amt+48);
delay(m_sec);
lcd_data_string(str1);
hr1++;
if(hr1>11)
hr1=0;
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
min1++;
if(min1>59)
min1=0;
lcd_cmd(0xc6);
lcd_data_int(min1);
void main()
int k;
start=1;
dig_hr1=1;
dig_min1=1;
lcd_cmd(0x01);
lcd_cmd(0x83);
lcd("SET TIMING");
lcd_cmd(0xc3);
lcd_data_int(hr1);
lcd_data(':');
lcd_data_int(min1);
while(start==0)
delay(10);
if(dig_hr1==0)
set_hr1();
if(dig_min1==0)
set_min1();
if(am_pm==0)
lcd_cmd(0xc8);
lcd_data_string("am");
dig_am_pm=0;
}
if(am_pm==1)
lcd_cmd(0xc8);
lcd_data_string("pm");
dig_am_pm=1;
delay(200);
lcd_cmd(0x01);
while(1)
for(k=0;k<2;k++)
for(hr=hr1;hr<12;hr++)
for(min=min1;min<60;min++)
for(sec=0;sec<60;sec++)
lcd_cmd(0x82);
delay(1);
lcd_data_int(hr);
lcd_data(':');
lcd_data_int(min);
lcd_data(':');
lcd_data_int(sec);
if(dig_am_pm==0)
lcd("am");
else
lcd("pm");
}
lcd_data_string(" ");
delay(100);
min1=0;
if(dig_am_pm==0)
dig_am_pm=1;
else
dig_am_pm=0;
hr1=0;
Tool Overview
The Keil 8051 Development Tools are designed to solve the complex problems facing
embedded software developers.
When starting a new project, simply select the microcontroller you use from
the Device Database and the µVision IDE sets all compiler, assembler, linker,
and memory options for you.
Numerous example programs are included to help you get started with the
most popular embedded 8051 devices.
The Keil µVision Debugger accurately simulates on-chip peripherals (I²C,
CAN, UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM
Modules) of your 8051 device. Simulation helps you understand hardware
configurations and avoids time wasted on setup problems. Additionally, with
simulation, you can write and test applications before target hardware is
available.
When you are ready to begin testing your software application with target
hardware, use the MON51, MON390, MONADI, or FlashMON51 Target Monitors,
the ISD51 In-System Debugger, or the ULINK USB-JTAG Adapter to download
and test program code on your target system
Good Circuit
It is always best connecting the switch to ground with a pull-up resistor as shown in the
"Good" circuit. When the switch is open, the 10k resistor supplies very small current needed
for logic 1. When it is closed, the port pin is short to ground. The voltage is 0V and all the
sinking current requirement is met, so it is logic 0. The 10k resistor will pass 0.5 mA (5
Volt/10k ohm). Thus the circuits waste very little current in either state. The drawback is that
the closure of switch gives logic 0 and people like to think of a switch closure gives logic 1. But
this is not a matter because it is easy to handle in software.
Fair circuit
The "Fair" circuit requires that the pull-down resistor be very small. Otherwise, the pin will rise
above 0.9V when the resistor passes the 1.6mA sinking current. When the switch is closed,
the circuit waste a large current since virtually no current flows into the pin. The only
advantage is that a switch closure gives logic 1.
Poor circuit
In the "Poor" circuit, the logic 1 is stable when the switch is closed. But when the switch is
open, the input floats to a noise-sensitive high rather than a low. An open TTL pin is usually
read as logic 1 but the pin may picks up noise like an antenna.
To conclude, driving a TTL input should always consider current sinking (pulling input to 0V).
Unlike diodes, Light-emitting diodes have a forward voltage drop from 1.7 to 2.5 volts and
most of them flow a forward current 20mA.
Poor circuit
since the TTL output can't source above 1mA so the LED will be very dim.
Fair circuit
The LED will conduct heavily at about 2V and the extra 3V has to be dropped in the TTL
circuitry. This causes high power dissipation in the TTL or the LED fails.
Good circuit
The resistor limits the current. The resistance can be calculated by assuming its voltage is
about 2.5V and the TTL output is 0.9V. For 2.2V LED, 1.9V is across the resistor so the
220ohm would limit the current to 8.6mA (1.9/220). For 1.7V LED, 2.4V is across the resistor
so it would limit the current to 10.9mA (2.4/220). The resistor should not less than 100ohm or
the LED would fail.
CODE EXAMPLE
Connection -Switch -P1.0 , LED - P2.0
Condition - Turn on LED when switch is pressed.
B P1.0 ; input pin. BIT button p1.0 / * Using BIT keyword for p1.0 definition*/
OP: BIT LED p2.0
2.0, LOOP ; not grounded then stay in loop void main ( )
P0.0 ;To clear pin P0.0 when P1.0 is at 0 v
while (1) {
LED = button ; /* Note LED=button is wrong */
In A, NPN transistor (say a BC337 or BC338) is being used to control a relay with a 5 V coil.
Series base resistor R1 is used to set the base current for Q1, so that the transistor is driven
into saturation (fully turned on) when the relay is to be energized. That way, the transistor will
have minimal voltage drop, and hence dissipate very little power as well as delivering most of
the 5V to the relay coil.
Let us say RLY1 needs 50mA of coil current to pull in and hold reliably, and has a resistance of
24 Ohms so it draws this current from 5V. Our BC337/338 transistor will need enough base
current to make sure it remains saturated at this collector current level. To work this out, we
simply make sure that the base current is greater than this collector current divided by the
transistors minimum DC current gain hFE. So as the BC337/338 has a minimum hFE of 100
(at 100mA), we'll need to provide it with at least 50mA/100 = 0.5mA of base current.
In practice, you give it roughly double this value, say 1mA of base current, just to make sure
it does saturate. So if your resistance will be
TTL Logic High Voltage (Min) /1ma ( 1K approx)
EXAMPLE
Condition - Corresponding led should light up when switch pressed , i.e. if Switch at 1.0 is
pressed -> LED at P0.0 should light up.
CODE EXAMPLE
LOOP: . 1.
mov p1,#0ffh ; To configure port for input.
mov a,p1 void main() {
mov p0 ,a while (1) {
sjmp LOOP ; Stay in infinite loop P0 = P1; /* Note P1=P0 will not work
}
}
2.
voided main() {
char port_value;
while (1) {
port_value = P1;
P0 = port_value;
}
}
Circuit Schematic
1 THE CIRCUIT
ISIS Screen
2 THE SCHEMATIC
The ISIS user interface is shown here, consisting of edit, overview and
object select windows, with edit toolbars. Components are added to the
object list from the libraries provided, dropped onto the schematic, and
connected up using virtual wiring. Components can be labelled and their
simulation properties modified.
Components are found in the libraries accessed via the ‘pick’ button P in the
object select window. The MCU is selected from ‘Microprocessors ICs’
category, ‘PIC16 Family’ sub-category. The other components are added to
the pick list from the appropriate categories. These are then selected and
dropped on the schematic within the blue border.
Save the source code when complete. From the Source menu, select Build
All. The message window should confirm build OK. If not, correct syntax :020000040000FA
errors in the source code by reference to PIC programming rules. A hex file :0A000000003066008601
is produced as shown, BIN1.HEX, which contains the MCU machine code. :00000001FF
This hex file must be attached to the MCU in the schematic. Right click,
then left click on the PIC chip to open the Edit Component dialogue. Click
on the Program File folder tab and select the BIN1.HEX file from the
project folder. Set the Processor Clock Frequency to 40kHz. Note that the
external components do not affect the simulation clock frequency. The Port
B output LEDs should operate when the run/step/pause/stop controls are
clicked (the buttons on the schematic have no effect with this program).
Pause the program and from the Debug menu check the PIC CPU Source
Code option to display the program with the execution point highlighted.
Use the ‘Step Into’ button in the source code window to single step the
program. Note that the initialisation instructions are executed once, and the
loop then repeats endlessly – this is the usual program operating sequence
for control applications. The source code window has buttons to run, single
step (into, over and out of subroutines) and set breakpoints.
The effect of the program on the registers and status flags, and program
timing can thus be checked.
ICD
module
9 DOWNLOAD PROGRAM
When all logical errors have been resolved, the program can be downloaded
to the real hardware using the programming tools in MPLAB, for example,
using the Mpstart programmer unit. Alternatively, the ICD system allows
in-circuit programming and debugging, requiring the purchase of the Embedded
System
MPLAB ICD2 module. Development System PIC MCU
See www.microchip.com
PC +
PROTEUS
+ MPLAB
REFRENCES
www.altavista.com
www.8051.net
www.8051.info
www.freewebs.com
www.innovationrnd.in
www.google.com
www.scribd.com
www.esnips.com