MPMC Sougata

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

TECHNICAL REPORT

8051 MICROCONTROLLER

NAME- SOUGATA MAJI


COLLEGE ROLL NO- EE/21/L-43
UNIVERSITY ROLL NO- 10701621041
UNIVERSITY REGISTRATION NO- 211070101620018
ABSTRACT
It is a general purpose 40 Pin 8051 modular development board with onboard 16*2 LCD
support, 4*4 general purpose switches, power supply circuit, RS232 port for serial interface
with computer and other serial devices, reset switch, poewer status LED. Use this board to
kick start development based on compatible 8051 microcontrollers. The board lets you to
concentrate on programming, testing and optimizing your code, and therby your overall
project, rather than spending time in getting to know the electronics requinboardred to use
these microcontrollers. These boards are perfect for learning, testing and development. The
intermediate Board offers support for 16*12 LCDs with onboard contrast control and it offers
a lot more general purpose LEDs and switches are connected to IO pins on the
microcontroller the jumpers and their connected to pins can be disabled if you wish to use the
io pins on the microcontroller for other purpose. The board is compatible with the
AT89S51/52 microcontrollers. The board is perfect if you are just starting out with 8051
programming and also if you want areliable tried and tested board far building advanced
project based on it.

INTRODUCTION
Micro-controllers are useful to the extent that they communicate with other devices, such
as sensors, motors, switches, keypads, displays, memory and even other micro-controllers.
Many interface methods have been developed over the years to solve the complex problem of
balancing circuit design criteria such as features, cost, size, weight, power consumption,
reliability, availability, manufacturability .Many microcontroller designs typically mix
multiple interfacing methods. In a very simplistic form, a micro-controller system can be
viewed as a system that reads from (monitors) inputs, Development of a trainner kit for
college laboratory so we find a project to execut and implement the 8051 microcontroller
functions every time and everywhere . So a system development of 8051 micro controller
board that simulate and executes various operations and functions with motor, lcd, led, serial
interface. So Our 8051 development board find helpful in laboratory purposes Embded
Systems Design in an interdiscipilinary coarse from hardware, software, tool, algorithm and
domain. The objective of the course Embeded Systems Design is to understand Computing
Methadology and technology from system design perspectives.

DISCUSSION
1. PSW REGISTER IN 8051 MICROCONTROLLER –
The program status word (PSW) register is an 8-bit register. It is also referred to
as the flag register. Although the PSW register is 8 bits wide, only 6 bits of it are used
by the 8051. The two unused bits are user-definable flags. Four of the flags are called
conditional flags, meaning that they indicate some conditions that result after an
instruction is executed. These four are CY (carry), AC (auxiliary carry), P (parity),
and OV (overflow).
The following is a brief explanation of four of the flag bits of the PSW register. The impact
of instructions on these registers is then discussed.
How the bits of PSW are change after arithmetic & logical operation?
CY, the carry flag-
 This flag is set whenever there is a carry out from the D7 bit.
 This flag bit is affected after an 8-bit addition or subtraction.
 It can also be set to 1 or 0 directly by an instruction such as “SETB C” and “CLR
C” where “SETB C” stands for “set bit carry” and “CLR C” for “clear carry”.

AC, the auxiliary carry flag-


 If there is a carry from D3 to D4 during an ADD or SUB operation, this bit is set;
otherwise, it is cleared.
 This flag is used by instructions that perform BCD (binary coded decimal) arithmetic.

P, the parity flag-


 The parity flag reflects the number of 1 s in the A (accumulator) register only.
 If the A register contains an odd number of Is, then P = 1. Therefore, P = 0 if A has an
even number of 1s.

OV, the overflow flag-


 This flag is set whenever the result of a signed number operation is too large, causing the
high-order bit to overflow into the sign bit.
 In general, the carry flag is used to detect errors in unsigned arithmetic operations.
 The overflow flag is only used to detect errors in signed arithmetic operations

2. RAM MEMORY SPACE ALLOCATION AND STACK IN 8051


MICROCONTROLLER –

RAM-
The Data Memory or RAM of the 8051 Microcontroller stores temporary data and
intermediate results that are generated and used during the normal operation of the
microcontroller. Original Intel’s 8051 Microcontroller had 128B of internal RAM.
But almost all modern variants of 8051 Microcontroller have 256B of RAM. In this 256B, the
first 128B i.e., memory addresses from 00H to 7FH is divided in to Working Registers
(organized as Register Banks), Bit – Addressable Area and General Purpose RAM (also
known as Scratchpad area).

In the first 128B of RAM (from 00H to 7FH), the first 32B i.e., memory from addresses 00H
to 1FH consists of 32 Working Registers that are organized as four banks with 8 Registers in
each Bank.

The 4 banks are named as Bank0, Bank1, Bank2 and Bank3. Each Bank consists of 8
registers named as R0 – R7. Each Register can be addressed in two ways: either by name or
by address.

STACK-
The stack is a section of RAM used by the CPU to store information temporarily
information could be data or an address.

1. The register used to access the stack is called stack pointer register.
2. Stack is used to store data temporary during any program execution.
3. The 8 bit stack pointer is used to hold an internal RAM address which is called the top
of stack.
4. Generally 8051 used bank1 of internal RAM as the stack so the default stack pointer
is 07H.
5. The stack pointer in the 8051 only 8 bit wide which means that it can take value of 00
to FFH.
6. When the 8051 is powered up the sp register contain value 07H.
7. RAM location 08H is the first location begin used for the stack by the 8051.
8. When data is retrieved from the stack the byte is read from the stack and then sp
register increment.
9. The stack is used during PUSH, POP, CALL, RET instruction.
10. Stack pointer work on the principal of last ID first output (LIFO).
3. SUBROUTINE TO GENERATE A DELAY OF 0.5sec FOR
AT89C51 MICROCONTROLLER WITH A FREQUENCY OF
22MHz-
DELAY_500ms:
MOV R2, #0
MOV R1, #177 ; Load R1 with 177 for 22MHz oscillator frequency
L1: DJNZ R1, L1 ; Decrement R1 and jump to L1 if not zero
DJNZ R2, L1 ; Decrement R2 and jump to L1 if not zero
RET
EXPLANATION-
 The delay loop consists of two nested DJNZ (Decrement and Jump if Not
Zero) instructions.
 R1 is loaded with the value 177, which is the number of cycles required for a 1
microsecond delay at a 22MHz frequency.
 The outer loop (L1) decrements R1 and jumps back to L1 until R1 reaches
zero, resulting in a delay of approximately 177 microseconds.
 The inner loop decrements R2 and jumps back to L1 until R2 reaches zero,
resulting in a total delay of approximately 177 * 2843 = 0.5 seconds (since
2843 is the number of times the outer loop runs in half a second).

The exact delay time may vary slightly due to factors such as compiler
optimizations and other system interrupts. Also, this delay routine is blocking,
meaning that the processor will be tied up during the delay and unable to
perform other tasks. For more precise and non-blocking delay routines, other
methods such as timer interrupts may be used.

CONCLUSION
The 8051 development board that was developed resulted in providing a user friendly
device. This system helps in college lab purpose for executing and implementing 8051
microcontroller programming with interfaced devices with in it The next version of the glove
will be included more interfacing devices It makes this easily portable and easier to use. The
board is compatible with the AT89S51/52 microcontrollers. This board is perfect if you are
just starting out with 8051 programming and also if you want a reliable tried and tested board
far building advanced project based on it.

REFERENCE
[1] https://www.ijser.org/researchpaper/8051-MODULAR-DEVELOPMENT-BOARD.pdf

[2] https://www.electronicshub.org/8051-microcontroller-memory-organization/

[3] https://www.ques10.com/p/17217/what-is-stack-how-it-is-implemented-in-8051-1/

You might also like