Experiment:-1: AIM: - Introduction To 8086 Microprocessor
Experiment:-1: AIM: - Introduction To 8086 Microprocessor
Result:
AFTER EXECUTION
0300 : 01 0308 : 0A 0308 : 0B
0301 : 02 0309 : 0B 0309 : 0D
0302 : 03 030A: 0C 030A: 0F
0303 : 04 030B: 0E 030B: 12
0304 : 05 030C: 0F 030C: 14
0305 : 06 030D: 10 030D: 16
0306 : 07 030E: 11 030E: 18
0307 : 08 030F: 12 030F: 1A
EXPERIMENT :- 3
AIM : To find the maximum no. in a given string (16 byte long) and store it in location
0310.
ADDRESS OPCODE MNEMONICS COMMENTS
0200 BE 00 03 MOV SI,0307 Load SI registers with
starting address of
string .
Result:-
After execution
0300 : 01 0308 : 12 0310:15
0301 :02 0309 :08
0302:03 030A:09
0303:04 030B:0A
0304:05 030C:0B
0305:06 030D:0E
0306:15 030E:0C
0307:07 030F:0D
EXPERIMENT :- 4
AIM : To sort a string of a number of bytes in descending order
ADDRESS OPCODE MNEMONICS COMMENTS
0200 BE 00 03 MOV SI,0300 Initialize SI reg. with
memory location
0300.
0203 8B 1C MOV BX,[SI] BX has the number of
bytes (to use for
sorting) location 0300
and 0301
0205 4B DEC BX Decrement the
number of bytes by 1
0206 8B 0C MOV CX[SI] Also CX has the
number of bytes 0300
and 0301
0208 49 DEC CX Decrement the
number of bytes by 1
0209 BE 02 03 MOV SI,0302 Initialize SI reg. with
starting address of
string
020C 8A 04 MOV AL,[SI] Move the first data
byte into AL
020E 46 INC SI Point to the bytes of
the string
020F 3A 04 COMP AL,[SI] Compare the two
bytes of the string
0211 73 06 JAE 0219 If 2 bytes are equal or
first byte is above
branch to (1)
0213 86 04 XCHG AL,SI Else
0215 4E DEC SI Second byte is less
than first byte and
swap the two bytes
0216 88 04 MOV [SI], AL
0218 46 INC SI Point at the next
location of the string
0219 E2 F1 LOOP 020C Loop if CX is not zero
021B 4B DEC BX At this juncture first
021C BE 00 03 MOV SI, 0300 sorting will be over
i.e., first number is
logically compared
with rest of the
number
021F 75 E5 JNZ 0206
0221 F4 HLT Halt
Result:
After execution
0300 : 05 0302:28
0301 :00 0303:25
0302:20 0304:20
0303:25 0305:15
0304:28 0306:07
0305:15
0306:07
EXPERIMENT :- 5
AIM : To multiply an ASCII string of eight numbers by a single
ASCII digit. The result is a strig of unpacked BCD digits.
ADDRESS OP CODE MNEMONIC COMMENTS
0200 BE 00 03 MOV SL, 0300 Load SI reg. with starting address
of string
0203 BF 08 03 MOV DI, 0308 Load DI reg . with starting address
Of result LOCNS .
0206 B2 34 MOV DL ,34 Load DL with multiplier ASCII Digit .
0208 B9 08 00 MOV CX,0008 Load counter register with the number
of bytes in the string
020B C6 05 00 MOV[DI],00
020E B0 E2 0F ANDL ,0F MS nibble of multiplier is zeroed
0211 BA 04 MOV AL,[SI] First ASCII no. of string in AL
0213 46 INC SI Point at the next LOCN in string
( of ASCII Nos. )
0214 60 E0 0F AND AL,0F MS nibble at multiplier no gap
And is also zeroed
0217 F6 E2 MUI DL Perform the fn. AX=AL*DL
0219 D4 0A AAM Perform the fn. AH=AL/0A
AL = reminder
021B 02 05 ADD AL,[DI] The contents of AL ( remainder obtained
by
performing the above operation )
021D 37 AAA Added in 00 which are in 1st Dest . LOCN .
the content
Of AL unpacked decimal no. and are
stored in 1st desti.
LOCN {=0308}
021E 88 05 MOV[DI]
0220 47 INC DI Point at the next Dest. LOCN
0221 88 25 MOB [DI],AH Content of AH (Quotient got in AAM
operation ) are moved in next Dest.
(0309).
0223 49 DEC CX Decrement the counter register
0224 75 EB JNZ 0211 If not zero , continue multiply and storing
BCD digits . ELSE
0226 F4 HLT HALT.
Result :-
After execution
0300 : 31 0308 : 04
0301 :32 0309 :08
0302:33 030A:02
0303:34 030B:07
0304:35 030C:01
0305:36 030D:06
0306:31 030E:06
0307: 32 030F:08
EXPERIMENT :- 6
AIM : To divide a string of unpacked ASCII digit.
ADDRESS OPCODE MNEMONICS COMMENTS
0200 B2 36 MOV DL,36 DL having the divisor,
a single 8 bit ASCII
digit.
0202 BE 00 03 MOV SL, 0300 Load SI with the
starting address of
ASCII string.
0205 BF 08 03 MOV DI, 0308 Load DI with the
starting address of
the result LOCNS
0208 B9 08 00 MOV CX, 0008 Initialize the counter
register with the
number of bytes in
the string.
020B BO E2 0F AND DL, 0F MS nibble of DL
contents in zeroed.
020E 32 E4 XOR AM, AH Initialize the 8 bit
ACC(=00)
0210 AC LODS B Load AL with the
contents of address
accessed by SI
register and
increment SI register
i.e. point at the next
address LOCN
0211 80 E0 0F AND ALOF MS nibble of AL
contents is also
zeroed.
0214 B5 0A AAD Perform the fn.
AL=[(AH*0A)+AL],
AH=00
0216 F6 F2 DIV DL Perform the fn AD/DL
AL= quotient and AH=
remainder.
0218 AA STOS B The contents of AL
are stored in the
address pointed to by
the D1 register, and
next address LOCN in
D1 register is pointed
(i.e. current address
LOCN of D1 register is
incremented by one).
0219 E0 F5 LOOP NZ 0210 Continue dividing the
unpacked ASCII digits
if the contents of are
not zeroed else.
021B F4 HLT Halt
Result:
After execution
0300 : 31 0308 :00
0301 : 32 0309: 02
0302: 33 030A: 00
0303: 34 030B: 05
0304: 35 030C: 07
0305: 36 030D: 06
0306: 31 030E: 00
0307: 32 030F: 02
0308: 08
EXPERIMENT :- 7
AIM : To calculate the no of bytes in a string starting from 0302 up
to an identifier placed in AL register. The actual count will be in
location 0300 and 0301.
ADDRESS OPCODE MNEMONICS COMMENTS
0200 BE 00 03 MOV SI,0300 Load SI reg. with
starting address
where the result is to
be stored
0203 BE FF FF MOV CX,FFFF Initialize the counter
reg.
0206 BF 02 03 MOV DI,0302 Load DI reg. with the
starting address of
string.
0209 B0 03 MOV AL,03 Store the identifier in
ASL
020B F2 AE REPNZ Data byte accessed by
BI reg. compared with
identifier without
altering either of
contents .
020C AE SCASB
020D F7 B1 NOT CX ZX complemented CX
and move
020F 89 0C MOV SI,CX CX 89 0C MOV[SI], CX
020F Content into
0300.
0211 CC INT 3 Halt
Result:
After execution
0300 : 03 0301:00
EXPERIMENT :- 8
UNIVERSAL Board has on board
(a) ADC section.
(b) RTC & EEPROM section.
(c) DISPLAY (LCD, LED, & 7-SEG) section.
(d) INPUT SWITCHES (PUSH BUTTON & DIP SWITCH) section.
(f)RELAY section.
(e) BUZZER section
FEATURES
• 89C51 Central Processing Unit
• On-chip Flash Program Memory with In-System Programming (ISP) and In-Application Programming
(IAP) capability
• Boot ROM contains low level Flash programming routines for downloading via the UART
• Can be programmed by the end-user application (IAP)
• Parallel programming with 87C51 compatible hardware interface to programmer
• Supports 6-clock/12-clock mode via parallel programmer (default clock mode after ChipErase is 12-
clock)
• 6-clock/12-clock mode Flash bit erasable and programmable via ISP
• 6-clock/12-clock mode programmable “on-the-fly” by SFR bit
• Peripherals (PCA, timers, UART) may use either 6-clock or
12-clock mode while the CPU is in 6-clock mode
• Speed up to 20 MHz with 6-clock cycles per machine cycle (40 MHz equivalent performance); up to
33 MHz with 12 clocks per machine cycle
• Fully static operation
• RAM expandable externally to 64 kbytes
• Four interrupt priority levels
• Seven interrupt sources
• Four 8-bit I/O ports
• Full-duplex enhanced UART
– Framing error detection
– Automatic address recognition
• Power control modes
– Clock can be stopped and resumed
– Idle mode
– Power down mode
• Programmable clock-out pin
• Second DPTR register
• Asynchronous port reset
• Low EMI (inhibit ALE)
• Programmable Counter Array (PCA)
– PWM
– Capture/compare
UNIVERSAL BOARD
ANALOG TO DIGITAL CONVERTER (ADC0809)
Features:
Easy interface to all microprocessors
Operates ratio metrically or with 5 VDC or analog span
adjusted voltage reference
No zero or full-scale adjust required
8-channel multiplexer with address logic
0V to 5V input range with single 5V power supply
Outputs meet TTL voltage level specifications
ADC0808 equivalent to MM74C949
ADC0809 equivalent to MM74C949-1
Key Specifications
Resolution 8 Bits
Total Unadjusted Error ±1⁄2 LSB and ±1 LSB
Single Supply 5 VDC
Low Power 15 mW
Conversion Time 100
DIGITAL OUTPUT
CONTROL DATA
LED
Stepper motor
RL2
External 12 V
RL1 Supply
FEATURES:-
High-Performance RISC CPU:
• Only 35 single-word instructions to learn
• All single-cycle instructions except for program branches, which are two-cycle
• Operating speed: DC – 20 MHz clock input DC – 200 ns instruction cycle
• Up to 8K x 14 words of Flash Program Memory,
Up to 368 x 8 bytes of Data Memory (RAM),
Up to 256 x 8 bytes of EEPROM Data Memory
• Pinout compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX microcontrollers
Peripheral Features:
• Timer0: 8-bit timer/counter with 8-bit prescaler
• Timer1: 16-bit timer/counter with prescaler, can be incremented during Sleep via external
crystal/clock
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
• Two Capture, Compare, PWM modules
- Capture is 16-bit, max. resolution is 12.5 ns
- Compare is 16-bit, max. resolution is 200 ns
- PWM max. resolution is 10-bit
• Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™ (Master/Slave)
• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address
detection
• Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls (40/44-pin only)
• Brown-out detection circuitry for Brown-out Reset (BOR)
Analog Features:
• 10-bit, up to 8-channel Analog-to-Digital Converter (A/D)
• Brown-out Reset (BOR)
• Analog Comparator module with:
- Two analog comparators
- Programmable on-chip voltage reference (VREF) module
- Programmable input multiplexing from device inputs and internal voltage reference
- Comparator outputs are externally accessible
Special Microcontroller Features:
• 100,000 erase/write cycle Enhanced Flash program memory typical
• 1,000,000 erase/write cycle Data EEPROM memory typical
• Data EEPROM Retention > 40 years
• Self-reprogrammable under software control
• In-Circuit Serial Programming™ (ICSP™) via two pins
• Single-supply 5V In-Circuit Serial Programming
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
• Programmable code protection
• Power saving Sleep mode
• Selectable oscillator options
• In-Circuit Debug (ICD) via two pins
CMOS Technology:
• Low-power, high-speed Flash/EEPROM technology
• Fully static design
• Wide operating voltage range (2.0V to 5.5V)
• Commercial and Industrial temperature ranges
• Low-power consumption
After performing all these steps the chip will be configured through ECE FLASH .
1. Double Click on the icon SOURCE BOOST IDE present on the desktop.
2. Then a window will be popped-up
3. Now go to settings and select target. A dialog box will appear, in this dialog box select our
controller named PIC16F877A, then click ok.
4. Now go to settings and select toolsuit. A dialog box will again appear, in this dialog box select
C2C-plus, and then click ok
5. Now go to settings and select options. A dialog box will again appear with a display name C2C-
plus compiler option, now select tools, now go to assembler option and choose
6. Now go to projects and select new, now specify the path where you want to save your project
and name, click ok.
7. A pop up box will appear you may select “empty or with empty source file” and click ok.
8. Now write your program . After you had written your program go to build and first select
compilers then assembler then build. Any error or warning will be displayed in the dialog box.
After performing all these steps the chip will be configured through PPPv3 .
How to use PPPv3
1. Now after you had successfully created your .Hex file you would use an PIC programmer
called “PPPv3”. Double Click on the icon present on the desktop.
2. Now go to options and select options then select version 2 and click ok.
3. After that go to options and select configure PIC microcontroller and do the
following displayed settings.
4. After that choose your hex file and select send to PIC microcontroller.
EXPERIMENT :- 9
AIM : ALP to generate 10 KHz square wave without interrupts .
Program:
ORG 0000H
MOV TMOD, #10H ; timer 1, mode 1 (16-bit)
AGAIN: MOV TL1, #0D2H ; TL1=D2, low byte
MOV TH1, #0FFH ; TH1=FF, high byte
SETB TR1 ; start the timer 1
BACK: JNB TF1, BACK ; stay until timer rolls over
CLR TR1 ; stop timer 1
CPL P2.3 ;comp. P2.3 to get hi, lo
CLR TF1 ; clear timer flag1
SJMP AGAIN ; reload timer since mode1
; is not auto-reload
END
LOGIC: For generation of square wave, we firstly configure timer 1 to operate in mode 1, then
load 16 – bit value FFD2H in TL &TH register, after which the timer must be started by SETB
instruction. As the timer is started ,it counts up until it reaches its time limit of FFFFH , when over
flows , it sets high a flag bit called timer Flag (TF).By monitoring timer Flag. Timer can be stopped by
using CLR TR1. Then output on port 2 is complemented to generate square wave. Then timer flag is
complemented to generate square wave .Then timer flag is cleared and loop is rotated to continue
generation of square wave.
EXPERIMENT :- 10
LOGIC : For generation of 10 KHz square wave we firstly make our program execute at MAIN
which starts beyond INT vector space .MAIN initializes timer 0 and sets it for the mode1,timer
operation MAIN then enables timer 0 interrupted by initializing IE to 10000010 then it just it just
waits around letting the interrupt routine to do the work. Timer 0 is loaded with value FFD2 H to
generate square wave of 10khz.If the timer INT in IE register is enabled, whenever TF is raised. The
microcontroller is interrupted and jumps to interrupt vector table to service ISR .The 8051
microcontroller will check for the condition automatically and when condition is satisfied, will jump
to a subroutine, execute the code, then return.
In this case subroutine will complement the output at port 1.2, then RET1 instruction else 8051
microcontroller that interrupt routine has finished.
NOTE 1: When using ORG 0000H in the very first line then microcontroller upon wake up go to MAIN,
where ORG 0000H entry address for 8051 RESET.
NOTE 2: When using SJMP 000BH which is replaced by ORG 000BH, it is a start of ISR for timer 0 to
generate square wave.
NOTE 3: When using SJMP 0030BH which is replaced by ORG 0030BH, it is a start of main program for
initialization.