Professional Documents
Culture Documents
Roll No:304111
Index
Sr.No. Name of Date/Page no. Sign Remark
Experiment
1 Study of 8085
2 Study of 8085
interfacing
(prerequisite 2)
3 To Study 8051
assembler and
simulator (Keil)
4 Arithmetic operation
I
a) Program for HEX
and BCD add and
subtract
b) )Program to
find BCD
addition of two
numbers
5 Arithmetic operation
II
a)Multiplication of
two numbers
b)Division of two
numbers
6 To Examine flags and
stack (Keil)
7 Data Transfer
Programming
8 To Simulate I/O ports
(Keil)
9 The 8051 serial
interface.
To develop GREAT technocrats and to establish centre of excellence in the field of Electronics
and Telecommunications.
MGM’S
Jawaharlal Nehru Engineering College
N-6, CIDCO, Aurangabad
Department of Electronics & Telecommunication
Program memory
Program can be located any where in memory.Jump ,brach and call instructions use 16-bit
addresses, i.e. they can be used to jump/branch anywhere within 64 KB. All jump/branch
instructions use absolute addressing.
Data memory - the processor always uses 16-bit addresses so that data can be
placed anywhere.
Stack memory is limited only by size of memory.Stack grows downwords.
First 64 bytes in a zero memory page should be reserved for vectors used by RS
instructions.
Interrupts:
INTR (Input)
INTERRUPT REQUEST; is used as a general purpose interrupt. It is sampled only during the
next to the last clock cycle of the instruction. If it is active, the Program Counter (PC) will be
inhibited from incrementing and an INTA will be issued. During this cycle a RESTART or
CALL instruction can be inserted to jump to the interrupt service routine. The INTR is enabled
and disabled by software. It is disabled by Reset and immediately after an interrupt is accepted.
INTA (Output)
INTERRUPT ACKNOWLEDGE; is used instead of (and has the same timing as) RD during the
Instruction cycle after an INTR is accepted. It can be used to activate the 8259 Interrupt chip or
some other interrupt port.
RST 5.5 RST 6.5 - (Inputs)
RST 7.5 RESTART INTERRUPTS; These three inputs have the same timing as I NTR except
they cause an internal RESTART to be automatically inserted. RST 7.5 ~~ Highest Priority RST
6.5 RST 5.5 o Lowest Priority The priority of these interrupts is ordered as shown above. These
interrupts have a higher priority than the INTR.
TRAP (Input)
Trap interrupt is a nonmaskable restart interrupt. It is recognized at the same time as INTR. It is
unaffected by any mask or Interrupt Enable. It has the highest priority of any interrupt.
FLAG REGISTER :
General purpose registers
Conclusion:
PREREQUISITE NO 2
Aim :Interface LED’s to 8085 using 8255
Write an 8085 based assembly language program to flash the LEDs connected through 8255
REQUIREMENTS: An 8085 kit, interface of LED through 8255 and driver circuit.
OUTPUT: The LEDs connected to PORT A of 8255 flash regularly.
PROCEDURE:
1. Connect 8 LEDs in common cathode configuration through driver circuit and 8255 PPI to
8085 kit.
2. Note down the address of Port A from manual.
3. Write an 8085 based program as per the algorithm.
ALGORITHM:
Conclusion:
EXPERIMENT NO. 3
Aim: To study 8051 Assembler & simulator (Keil) with sample program.
Theory:
Assembler
An assembler is a program that translates symbolic code (assembly language) into executable
object code. This object code can be executed with a 80C51-compatible microcontroller. If you
have ever written a computer program directly in machine-recognizable form, such as binary or
hexadecimal code, you will appreciate the advantages of programming in symbolic assembly
language.
Assembly language operation codes (mnemonics) are easily remembered (MOV for move
instructions, ADD for addition, and so on). You can also symbolically express addresses and
values referenced in the operand field of instructions. Because you assign these names, you can
make them as meaningful as the mnemonics for the instructions. For example, if your program
must manipulate a date as data, you can assign it the symbolic name DATE. If your program
contains a set of instructions used as a timing loop (executed repeatedly until a specific amount
of time has passed), you can name the instruction group TIMER_LOOP.
An assembly program has three parts:
1. Machine instructions - Code the machine can execute. Detailed discussion of the machine
instructions is in the hardware manuals of the 80C51 microcontroller.
2. Assembler directives - Define the program structure and symbols, and generate non
executable code (data, messages, and so on.).
3. Assembler controls - Set assembly modes and direct assembly flow.
Assembler Differences
This appendix lists the differences between between the Intel ASM 51 assembler, the
Keil A51 assembler, and the Keil A251/AX51 assembler.
Differences Between A51 and A251/AX51
Assembly modules written for the A51 assembler may be assembled using the
A251/AX51 macro assembler. However, since the A251 macro assembler supports the
Intel 251 architecture and the AX51 macro assembler supports extended 8051 variants
like the NXP 80C51MX, the following incompatibilities may arise when A51 assembly
modules are assembled with the A251/AX51 assembler
The AX51 assembler is a superset of the A51 assembler. This user's guide therefore
covers all development tools variants. Whenever a feature or an option is available in one
specific tool chain only, it is clearly marked.
For general reference to all tool variants and microcontroller architectures the terms listed
in the following table are used:
Term Refers to ...
Ax51 Macro Assembler A51, AX51 and A251 Macro Assembler .
Cx51 Compiler C51, CX51 and C251 ANSI C Compiler.
Lx51 Linker/Locator BL51, LX51 and L251 Linker/Locator.
LIBx51 Library Manager LIB51, LIBX51 and LIB251 Library
Manager.
OHx51 Object-Hex Converter OH51, OHX51 and OH251 Object-Hex
Converter.
x51 Architecture or x51 Device All classic 8051, extended 8051 and 251
device variants.
The µVision target debug interface to the Analog Devices Download/Debug Kernel allows you
to download and debug applications in ADuC83x and ADuC84x devices over the serial interface
(UART).
No hardware modifications are required and no additional RAM or ROM resources are allocated
for debugging.
The following image shows a typical configuration.
The µVision target debugger with Analog Devices debug interface helps you easily debug your
target programs in real-time. You may:
Evaluation Tools
The Analog Devices evaluation boards are shipped with the Keil Evaluation Tools that
include the following:
11. Powerful and easy-to-use µVision IDE with editor, project management, and make.
12. Efficient C51 Compiler and Macro Assembler.
13. µVision Debugger with complete CPU and peripheral simulation.
14. Extensive tutorials and documentation.
Instructions
Assembly language instructions specify the program code that is to be assembled by the
Ax51 assembler. The Ax51 assembler translates the assembly instructions in your
program into machine code and stores the resulting code in an object file.
Simulation-
Simulator mode configures the µvision debugger as software only product that accurate
simulates target systems including systems including instruction and on chip peripherals. This
allows application code testing before hardware is available and gives you several benefits for
rapid, reliable embedded software development.
Simulation allows software testing on your desktop with no hardware environment.
Early software debugging on functional bases improves overall software reliability. Simulation
allows break points that are impossible with hardware debuggers. Simulation offers optimal
inputs signals hardware debugger add extra noise. Single stepping through single processing
algorithm is possible. External signal are stepped when CPU halts. Failure entries that would
destroy real hardware peripherals are easily chore.
KEIL Compiler-
The µvision IDE is the easiest way for the most developers to create embedded SIM programs.
To launch µvision click on your icon desktop at the selected KEIL µvision3 for start menu. The
µvision screen provides a menu bar that contains means of commands various tool bars that
contains buttons for common commands and window that displays project details, source files,
dialogue box, and other information of course, multiple windows can be open simultaneously.
4. Menu Bar –
It provides access to most µvision commands including file operations, editor operations, project
maintenance development tool setting program debugging, window selection and manipulation
and online help.
5. File Menu –
It includes commands that are open, save, print and close source files device database and license
manager dialogs are accessed from this menu.
6. Edit Menu-
It includes editing commands like undo, cut, copy, paste and indentation, bookmark functions
advanced editor functions, editor configuration.
7. View Menu-
It includes commands that select which to do editor window and debugger window to display as
well as commands that configure window viewing options.
8. Project Menu-
It includes commands that open, import, close project files. In addition project group and file
options project more functions are accessed from this menu.
9. Debug Menu-
It includes commands that start and stop depression, run the program, single step, half program
execution modify the program memory map. In addition commands are available to manage
break points, setting trace recording, enable execution profile analyzer and performance analyzer
and manage debug.
16. File tool bar contains buttons for commands used to edit source file.
17. Build tool bar contains buttons for commands used to build target.
18. Debug tool bar contains buttons for commands used in debugger.
KEIL Compiler µVision3 is a simulator/assembler for 8051 microcontroller to write and edit the code in
assembly language, compile it and also to run the code. Output of the assembly language program can be
verified using simulator.
Project New Project Save project (save project without any extension) select Microcontroller.
Conclusion:
EXPERIMENT NO. 4
Symbol Function
CY Carry flag
AC Auxiliary Carry flag (For BCD Operations)
F0 Flag 0 (Available to the user for General Purpose)
RS1, Register bank select:
RS0 RS1 RS0 Working Register Bank and Address
0 0 Bank0 (D:0x00 - D:0x07)
0 1 Bank1 (D:0x08 - D:0x0F)
1 0 Bank2 (D:0x10 - D:0x17)
1 1 Bank3 (D:0x18H - D:0x1F)
0V Overflow flag
UD User definable flag
P Parity flag
— Reserved for future use (251 Only)
Z Zero flag (251 Only)
N Negative flag (251 Only)
Program :
Write program here
RESULT :
µVision provides dialogs that show the status of all I/O ports. The I/O Pins are represented with
VTREGs. You may use this VTREGs also together with signal functions or breakpoints as
shown in the following example.
// in your C user program
PortAvalue = P2; // read Port 2 input
Breakpoints that you define in the µVision simulator:
bs write PORT2, 1, "printf (\"Port2 value=%X\\n\", PORT2)"
bs read PORT5, 1, "PORT5 = getint (\"Input Port5 value\")"
When you execute your C program, µVision asks you for a Port5 input value. If a new output
value is written to Port3, a message is printed in the Output Window - Command page.
ASSEMBLY PROGRAM
Conclusion :
EXPERIMENT NO. 6
Data Transfer Programming
Aim : To transfer data from one memory location to another
Program :
RESULT :
Before execution :
Paste screenshot of your result on keil platformo
After Execution
Conclusion:
EXPERIMENT NO. 7
b.Write an assembly language program to perform the subtraction of two 16-bit numbers.
Result:
Paste screenshot of your result on keil platform
conclusion:
EXPERIMENT NO. 8
Arithmetic operation II
Exercise a): Multiplication of a 8 bit no.
b): Division of a 8bit no.
Aim: - Write an ALP for Multiplication & Division of two 8 bit bit numbers.
Statement: - Write an 8051 based assembly language program to multiply and Divide 8 bit no
by 8 bit no stored at memory location.
Algorithm:
Program :
Write program here
Result :
EXPERIMENT NO. 9
Program:
Conclusion:
EXPERIMENT NO. 10
Serial Communication Programming
Note: To use result of this program, after selecting DEBUG session in the main menu use View-
> serial window #1. On running & halting the program, the data is seen in the serial window.
Program:
To get 9600, 28800/3 is obtained by loading timer1 with -3 (i.e., FF – 3 = FD) for further clock
division. For 2400 baud rate, 28800/12 => -12 = F4 in TH1.
EXPERIMENT NO.10
Waveform generation using DAC
Aim : To interface ADC and DAC to 8051
Write a C program to generate square wave of amplitudeV & frequency
Hz using DAC. Display the waveform on the CRO. Circuit Diagram for wave form generation:
Dual DAC
Program:
#include <REG51xD2.H>
void delay(unsigned int x) /* delay routine */
{
for(;x>0;x--);
}
main()
{
unsigned char on = 0x7f,off=0x00; unsigned int fre = 230;
while(1)
{
P0=P1=on; /* write amplitude to port */ delay(fre);
P0=P1=off; /* clear port */ delay(fre);
}
}
DESIGN:
Let f = 2 kHz, Therefore T = 1/f= 0.5msec,
Count value for the delay is (T/ 1clock cycle period) = 0.5 x 10-3sec/1.085 x 10-6sec Hence Count
value is =460. Hence for 50% Duty cycle the Count value is half of the Count value=230.
Note: Delay produced by the program will depend on the microcontroller you are using, so
frequency of the waveform generated may not match with the given frequency.
Write a C program to generate ramp wave of amplitudeV using DAC. Display the waveform on
the CRO.
Program:
Write program here
Result :
Paste screenshot of your result on keil platform
Conclusion :
EXPERIMENT NO.11
Project title:
Working:
Ckt diagram:
Program.:
Simulation screenshots :