It is 8-bit microcontroller,
means MC 8051 can Read, Write and Process 8 bit data. This is mostly used
microcontroller in the robotics, home appliances like mp3 player,
washing machines, electronic iron and industries. Mostly used blocks in
the architecture of 8051 are as follows:
128
Byte RAM for Data Storage
MC 8051 has 128 byte Random
Access memory for data storage. Random access memory is non volatile memory.
During execution for storing the data the RAM is used. RAM consists of the
register banks, stack for temporary data storage. It also consists of some special
function register (SFR) which are used for some specific purpose like timer,
input output ports etc. Normally microcontroller has 256 byte RAM in which 128
byte is used for user space which is normally Register banks and stack. But
other 128 byte RAM which consists of SFRs. We will discuss the RAM in detail in
next section.
Now what is the meaning of 128
byte RAM. What are address range which is provided for data storage. We will
discuss here.
We know that 128 byte = 2^7 byte
Since 2^7 bytes so last 7 bits
can be changed so total locations are from 00H to 7F H. This procedure of
calculating the memory address is called as “memory mapping”. We can save data
on memory locations from 00H to 7FH. Means total 128 byte space from 00H to 7FH
is provided for data storage.
4KB
ROM
• In 8051, 4KB read only memory
(ROM) is available for program storage. This is used for permanent data
storage. Or the data which is not changed during the processing like the
program or algorithm for specific applications.
• This is volatile memory; the
data saved in this memory does not disappear after power failure.
• We can interface up to 64KB
ROM memory externally if the application is large. These sizes are specified
different by their companies.
• Address Range of PC: Address
range of PC means program counter (which points the next instruction to be
executing) can be moved between these locations or we can save the program from
this location to this location.
The address range can be
calculated in the same way just like the RAM which is discussed in previous
section.
Address range of PC is 0000H to
0FFFH means total 4KB locations are available from 0000H to 0FFFH. At which we
can save the program.
Difference
between RAM and ROM
• RAM is used for data storage
while ROM is used for program storage.
• Data of RAM can be changed
during processing while data of ROM can’t be changed during processing.
• We can take an example of
calculator. If we want to perform addition of two numbers then we type the two
numbers in calculator, this is saved in the RAM, but the Algorithms by which
the calculation is performed is saved in the ROM. Data which is given by us to
calculator can be changed but the algorithm or program by which calculation is
performed can’t be changed.
Timers
and Counters
Timer means which can give the
delay of particular time between some events. For example on or off the lights
after every 2 sec. This delay can be provided through some assembly program but
in microcontroller two hardware pins are available for delay generation. These
hardware pins can be also used for counting some external events. How much
times a number is repeated in the given table is calculated by the counter.
• In MC8051, two timer pins are
available T0 and T1, by these timers we can give the delay of particular time
if we use these in timer mode.
• We can count external pulses
at these pins if we use these pins in counter mode.
• 16 bits timers are available.
Means we can generate delay between 0000H to FFFFH.
• Two special function
registers are available.
• If we want to load T0 with 16
bit data then we can load separate lower 8 bit in TL0 and higher 8 bit in TH0.
• In the same way for T1.
• TMOD, TCON registers are used
for controlling timer operation.
1.4.4 Serial Port
• There are two pins available
for serial communication TXD and RXD.
• Normally TXD is used for
transmitting serial data which is in SBUF register, RXD is used for receiving
the serial data.
• SCON register is used for
controlling the operation.
• There are four modes of
serial communication which has been discussed in next chapter.
Input
Output Ports
• There are four input output
ports available P0, P1, P2, P3.
• Each port is 8 bit wide and
has special function register P0, P1, P2, P3 which are bit addressable means
each bit can be set or reset by the Bit instructions (SETB for high, CLR for
low) independently.
• The data at any port which is
transmitting or receiving is in these registers.
• The port 0 can perform dual
works. It is also used as Lower order address bus (A0 to A7) multiplexed with 8
bit data bus P0.0 to P0.7 is AD0 to AD7 respectively the address bus and data
bus is demultiplex by the ALE signal and latch which is further discussed in
details.
• Port 2 can be used as I/O
port as well as higher order address bus A8 to A15.
• Port 3 also have dual
functions it can be worked as I/O as well as each pin of P3 has specific
function.
P3.0 – RXD –
Serial I / P for Asynchronous communication
Serial O / P for synchronous
communication.
P3.1 – TXD – Serial data
transmit.
P3.2 – INT0 – External
Interrupt 0.
P3.3 – INT1 – External
Interrupt 1.
P3.4 – T0 – Clock input for
counter 0.
P3.5 – T1 – Clock input for
counter 1.
P3.6 – WR – Signal for writing
to external memory.
P3.7 – RD – Signal for reading
from external memory.
When external memory is
interfaced with 8051 then P0 and P2 can’t be worked as I/O port they works as
address bus and data bus, otherwise they can be accessed as I/O ports.
Oscillator
• It is used for providing the
clock to MC8051 which decides the speed or baud rate of MC.
• We use crystal which
frequency vary from 4MHz to 30 MHz, normally we use 11.0592 MHz frequency.
Interrupts
• Interrupts are defined as
requests because they can be refused (masked) if they are not used, that is
when an interrupt is acknowledged. A special set of events or routines are
followed to handle the interrupts. These special routines are known as
interrupt handler or interrupt service routines (ISR). These are located at a
special location in memory.
• INT0 and INT1 are the pins
for external interrupts.
0 comments:
Post a Comment