You have no items in your shopping cart.

Subtotal: 0.00

8051 Trainer Kit user and Technical Reference Manual

INTRODUCTION

 

The PS-8051 board which demonstrates the capabilities of the 40-pin 8051 (various families) Sample programs are provided to demonstrate the unique features of the supported devices.

 

The PS-8051 board comes with the following:

 

  • PS-8051 board
  • Sample device (NXP 89V51RD2)
  • Cross cable (RS232)
  • CD-ROM, which contains:
       -  Sample programs
       -  User and Technical Reference Manual
  • User and Technical Reference Manual
  • Keyboard (101 keys)
 

 

PS-8051 BOARD OVERVIEW




8051-board-overview


The PS-8051 in based on Intel 8051Microcontroller which operates at 11.0592 MHZ. the board can operate using the 101/104 PC keyboard supplied along with the trainer kit and 2 line by 16 characters LCD display or from the PC (using the Terminal Emulation Software). PS-8051 is equipped with powerful software monitor in 27C256 EPROM. Keyboard and LCD display. The board has 32KB CMOS static RAM (type 62256). PS-8051 works on +9V DC at 1 Amp.

 

PS-8051 SPECIFICATIONS

 

The PS-8051 board has the following hardware features:

 

  • 8051 Microcontroller operating at 11.0592MHZ.
  • 32KB powerful software monitor in 27C256 EPROM.
  • 64KB on chip Flash memory (partially used by Firmware).
  • Two 16 – bit programmable on chip Timer.
  • 30 Programmable I/O pins (24 from 8255 and 6 (P1.0 to P1.5) from Port 1 of 8051).
  • 50 pin FRC connector for system bus expansion.
  • 20 pin FRC connector for user interface from 8255.
  • 9 pin D type connector for RS 232C interface.
  • Six different selectable baud rates from 150 to 9600.
  • One timer and external interrupt.
  • 101 PC type keyboard for entering user address/data and for commands.
  • Built in line – by – line Assemble and Disassemble.
  • User – friendly software monitor for loading and executing programs with break point facility.
  • Facility to connect to PC.
  • PS-8051 board supports Assembly and “C “ language

 

SYSTEM DESCRIPTION

 

HARDWARE

 

PS – 8051 Microcontroller board designed around 8051 is ideal for learning about Microcontroller. The Microcontroller operates at 10 MHZ using a 11.0592 MHZ crystal. Lower bytes of address and data are multiplexed as in 8085 and hence a decoder is necessary to separates address and data. IC 74LS373 is used for this purpose.

 

Firmware is stored in 27C256 EPROM. User data/program can be stored in 32KB COMS static RAM of type 62256. The board uses an 8255 totally available to the user.

 

2X16 character LCD display is directly connected to the bus like a memory device.

 

Serial communication is achieved using 8051. This is possible when the Microcontroller is operating in alternate mode. In this mode, port pins 3.0 and 3.1 act as receive and transmit pins respectively.

 

Timer 1 is used for generating the baud clock. IC Max 232 convert TTL transmit and receive signals to RS 232 levels. These signals are brought to a 9 – pin D type connector (female). 8051 has built in 16 bit counter/timer called timer 0 and 1.

 

Timer 1 is used internally by the system for generating the baud clock. Timer 0 is free and hence can be used by the user.

 

8051 has following interrupt:

 

  • Timer 0 and 1 interrupts.
  • External interrupts 0 and 1.
  • Serial interrupt.

 

Out of the 5 interrupts listed above external interrupt 0 and timer 0 are available to the user.

 

MAPPING OF DEVICES

 

DEVICE

ADDRESS

EPROM

0000H     TO      7FFFH

8255

4000H     TO      4003H

LCD

LCD">

4020H – command   4021H – for data

RAM

8000H     TO      FFFFH

(8500H – FFFFH for user)

 

 

CONNECTOR DETAILS

 

50 PIN EXPANSION CONNECTOR:

 

The 50 Pin FRC connector is used to interconnect with the Interface cards like 8255, 8279, 8253/8251, 8259, 8257 and the pin details are given below




50-pin-expansion-connector-8051-trainer


FRC PIN NO

SIGNAL

FRC PIN NO

SIGNAL

FRC PIN NO

SIGNAL

1

GND

21

A10

41

PSEN

2

VCC

22

A11

42

CS6

3

D0

23

A12

43

CS7

4

D1

24

A13

44

CS8

5

D2

25

A14

45

CS9

6

D3

26

A15

46

CS10

7

D4

27

PCLK

47

RXD

8

D5

28

NC

48

TXD

9

D6

29

RESET

49

VCC

10

D7

30

NC

50

GND

11

A0

31

NC

 

 

12

A1

32

INT0

 

 

13

A2

33

INT1

 

 

14

A3

34

NC

 

 

15

A4

35

NC

 

 

16

A5

36

RD

 

 

17

A6

37

WR

 

 

18

A7

38

NC

 

 

19

A8

39

ALE

 

 

20

A9

40

EA

 

 

 

 

20 PIN EXPANSION CONNECTORS:

 

The 20 Pin FRC connector is used to interconnect with the Interface cards like ADC, DAC, SWITCH/LED, RELAY buzzer Interfaces etc. Pin details are given below




20-pin-expansion-connectors-8051-trainer


CONNECTOR J1-U2(8255)

CONNECTOR J1-U7(8051)

CONNECTOR J3

PIN NO

SIGNAL

PIN NO

SIGNAL

PIN NO

SIGNAL

1

PA0

1

P1.0

1

PC0

2

PA1

2

P1.1

2

PC1

3

PA2

3

P1.2

3

PC2

4

PA3

4

P1.3

4

PC3

5

PA4

5

P1.4

5

PC4

6

PA5

6

P1.5

6

PC5

7

PA6

7

P1.6

7

PC6

8

PA7

8

P1.7

8

PC7

9

PB0

9

P3.0

9

CS6

10

PB1

10

P3.1

10

CS7

11

PB2

11

P3.2

11

CS8

12

PB3

12

P3.3

12

CS9

13

PB4

13

P3.4

13

CS10

14

PB5

14

P3.5

14

CS11

15

PB6

15

P3.6

15

NC

16

PB7

16

P3.7

16

NC

17

VCC

17

VCC

17

VCC

18

GND

18

GND

18

GND

19

VCC

19

VCC

19

VCC

20

GND

20

GND

20

GND

 

 

KEYBOARD CONNECTOR:




keyboard-connector


PIN NO

SIGNAL

1,2

KEYBOARD CLOCK

8,6

DATA

5

VCC

3

GND

 

 

9PIN ‘D’ TYPE (FEMALE):




9pin-d-type-female


LCD CONNECTOR




lcd-connector-8051-trainer


POWER SUPPLY DETAILS

 

PS trainer kit will work at 0 – 9v (1 amp) from the PS power supply. Provision is made in PS power supply to bring out on the front panel DC regulated voltage output for interfacing with add-on cards.

 

+9V 1 amp

 

POWER SWITCH

power-supply-off 

Supply Turned OFF

 power-supply-on

Supply Turned ON

 

 

KEYBOARD DETAILS

 

101 PC type keyboard is interfaced to Microcontroller through its port pin. Communication between keyboard and Microcontroller takes place using 2 wires – one for serial clock and serial data (P1.6 and P1.7).

 

COMMANDS AND KEYS

 

RESET

 

This key is located in the main PS board. On depressing this key the program starts executing from the beginning i.e. at reset address 0000. On power on reset message PS-8051 is displayed in local LCD display.

 

H (Help Menu)

 

This key is used in PS – 51/31 to get into help menu and it will display the following commands.

 

A <BEG>

ASSEMBLE

B

BAUD RATE

D <BEG>

DISASSEMBLE

E <BEG> <END>

EXAMINE

G <BEG>

EXECUTE

H

HELP COMMANDS

I <ADDR>

INTERNAL RAM

L <OFFSET>

DOWNLOAD

M <ADDR>

MODIFY

N

NORMAL MODE

Q

QUIT

R <REG>

REGISTER DISPLAY

S

SERIAL MODE

T <START> <END> <DS>

BLOCK TRANSFER

U <BEG> <END>

UP LOAD

 

 

OPERATING INSTRUCTIONS

 

POWER ON

 

Connect the PS-8051 board to the power having the following specifications.

 

+9V DC 1 Amp

 

Switch on the power supply after ensuring the correct voltages. Following message will appear on the LCD display.

 

 PAN TECH

 8051

On power on or after reset the display shows PANTECH 8051 as a sign on message. The prompt character – is displayed in the next line informing the user, that the board is ready to accept the commands.

 

PROGRAM ENTRY USING ASSEMBLER:

 

PS-8051 is ready to accept the assembler entry command after power on or after reset. Commands can be entered in the second line of display and to enter into assembler from where the user program gets stored. In PS-8051, the user may enter the program from 8000H – FFFFH (if 32KB RAM is installed).

 

EXAMPLE

 

Example:

A8500 Press ENTER Key

On typing this line PS-8051B is ready to store the user program from start address 1100. Following message shows in local LCD.

 

8500---

ENTERING MNEMONICS

As mentioned before, each instruction of Microcontroller can be entered by specific set of characters generally 2/3/4 letters followed by respective operands.

 

List of instruction and mnemonics are given in the Appendix A.

 

EXAMPLE

            MOV A, R0  ENTER key

 

Sequence for entering the above instruction is as follows.

 

Typing sequence,


MOV A, R0      ENTER key

EXAMPLE
  INC A     Press ENTER Key

 

Typing sequence,

INC Space bar

 Enter key      (ENTER Key     )

As per the above procedure mnemonics are entered. On completion of one line address, display in the first line automatically gets incremented by respective value depending on the instruction.

 

Line by line assembler converts the entered mnemonics to equivalent opcode and stores it in the displayed address. If any wrong mnemonics or operands are entered “ERROR” message is displayed.

 

On completion of one line of entry, the user may repeat the above sequence of operation till the program is over or till the end of memory. Termination of Assembler entry is by depressing enter key.

 

IMPORTANT INSTRUCTIONS

 

1.   When immediate addressing mode is used before entering the data, # symbol should be entered for instruction like,

           MOV DPTR, #1234

 

2. When register indirect addressing mode is used @ symbol to entered for instruction like,

     MOV A, @DPTR MOV A, @R0

 

EDITING

 

During the entry of mnemonics if any wrong entry is made it is possible to edit it before depressing Enter key. Use the Backspace key in the keyboard to erase the previous character and this process may be repeated till the first character. Once a character is erased, retype the correct character.

 

DISASSEMBLER

 

Disassemble converts the hex byte stored in the memory into equivalent mnemonics. To enter into disassemble mode, type D in the command mode followed by the memory address.

 

EXAMPLE

 

Assume the following data is stored in the memory address 8500.

 

8500

74

8501

AA

8502

00

 

 

To disassemble the above data is,

 

D8500 [Enter]

 

On completion of this command, the display is as follows,

 

74 AAMOV A, #AA

 

To see the next line depress space bar key. Display is,

 

00 NP

 

In similar manner, the above sequence may be repeated and depressing the enter key can terminate this command.

 

M (MODIFY EXTERNAL MEMORY)

 

Using this command the user can display/modify any external memory address.

 

ENTERING ADDRESS

 

After depressing this key, the system is ready to accept from the keyboard and the board displays the data of the selected memory address. Depressing any other non-hex key results in error and the current command and once again wait’s for new command.

 

ENTERING DATA

 

Now, if required, entering the new data can modify data at the desired address. Entry of data is also similar to that of address. Terminator for data is cursor up key or cursor down key or space or enter key. Thus it is possible to load the opcode/data in memory and verify it using M (MDFY), UP and DOWN keys.

 

EXAMPLE

 

LCD DISPLAY

COMMENTS

PS-8051

-

Press M

PS-8051

-M

Press 8

PS-8051

-M8

Press 4

PS-8051

-M84

Press 0

PS-8051

-M840

Press 0

PS-8051

-M8400

Press ENTER Key

M8400:

55 (Previous data)

Press A

M8400:

55 A

Press 3

M8400:

55 A3

Press Space Bar Key

M8401:

99 (Previous data)

Press UP Arrow Key

M8402:

66 (Previous data)

Press UP Arrow Key

M8403:

78(Previous data)

Press DOWN Arrow Key

M8402:

66 (Previous data)

Press ENTER Key

PS-8051

-

Next Command is expected

 

 

Thus it is possible to load the program/data in memory and verify it using M (MDFY), UP and DOWN key.

 

G (GO COMMAND)

 

This command is used to execute user program from the specified address.

 

EXAMPLE

 

LCD DISPLAY

COMMENTS

PS-8051

-

Press M

PS-8051

-M

Press 8

PS-8051

-M8

Press 4

PS-8051

-M84

Press 0

PS-8051

-M840

Press 0

PS-8051

-M8400

Press ENTER Key

M8400:

55 (Previous data)

Press A

M8400:

55 A

Press 3

M8400:

55 A3

Press Space Bar Key

M8401:

99 (Previous data)

Press UP Arrow Key

M8402:

66 (Previous data)

Press UP Arrow Key

M8403:

78(Previous data)

Press DOWN Arrow Key

M8402:

66 (Previous data)

Press ENTER Key

PS-8051

-

Next Command is expected

 

 

EXAMPLE

 

G8850

The above command starts the program execution from address 8850. If enter key is depressed immediately after G, the program starts executing from the value specified in PC of R command. Thus all register values displayed in R command are initial values for user program address.

 

B (BAUD RATE)

 

When this key is depressed it displays the currently selected baud rate. Default baud rate is 2400 baud and this will be selected during power on or hardware reset and displayed in the first line. Second line display shows 150 baud. By depressing the space bar key the baud display can be changed from 150 to 300 and so on till 9600. The system permits following baud rates.

 

{9600 2400 1200 600 300 and 150}

 

By depressing the enter key, the currently displayed baud rate is selected fir future serial communication (however, this will be modified if reset key is depressed).

 

NOTE: Space bar key doesn’t select the baud rate and it’s used to display the succeeding baud value only.

 

R (REGISTER DISPLAY/MODIFY)

 

When this key is depressed it displays current register contents one after another. After depressing this key the board waits for the register number and enter key from the user.

 

If for example, key R2 depressed and then enter key the system will display R2 contents.

 

As in the case of Modify, it is possible change the displayed register contents. The entry is similar to that of data filed entry. The termination for register data entry is by space bar key.

 

Entering space bar key increments register number and its data is displayed once again. Thus it is possible to display and modify all the sixteen registers. Termination of this command is by enter key.

 

EXAMPLE

 

LCD DISPLAY

COMMENTS

PS-8051

-

Press R

PS-8051

-R

Press A

PS-8051

-RA

Press ENTER Key

A = 12 (pervious data)

Enter New data value, Press 3

A = 12 3

Press 4

A = 12 34

Press Space Bar Key

B=89 (previous data)

Press ENTER Key

PS-8051

-

Waiting for next Command

 

 

If after depressing R, A is typed followed by enter this command displays A value and waits for the user to enter new value.

 

If succeeding registers are to be modified use space key to advance. Enter terminates the command. In the following example, A register value to be changed to 33 and R0 to 66.

 

EXAMPLE

 

LCD DISPLAY

COMMENTS

PS-8051

-

Press R

PS-8051

-R

Press ENTER Key

A = 55

Press Space Bar Key

B = 67

Press Space Bar Key

R0 = 11

Press Space Bar Key

R1 = 22

Press Space Bar Key

R2 = 34

Press Space Bar Key

R3 = 56

Press Space Bar Key

R4 = 89

Press Space Bar Key

R5 = 87

Press Space Bar Key

R6 = 78

Press Space Bar Key

R7 = 90

Press Space Bar Key

DPTR = 1234

Press Space Bar Key

PC = 8902

Press Space Bar Key

SP = 09

Press Space Bar Key

PSW = 01

Press Space Bar Key

 

 

I (Modify internal memory)

 

This command is similar to that of modify external except it displays/modifies internal 128 bytes of 8051 Microcontroller. Use of UP, DOWN and ENTER keys are also as described above.

 

Note: This command is one of the important command used to Modify the internal memory of controller.

 

T (TRANSFER COMMAND)

 

This command is useful for transferring data from one area to another. The user has to specify the source start address, source end address and Destination start address.

 

User can key in source start address and its delimiter with space bar key. Source end address is also keyed in similar way with space bar key as delimiter.

 

Next enter the Destination start address and is moved from one area to another.

 

EXAMPLE

 

     T9000 90FF 9800 Press ENTER Key.

 

The above command transfer the memory content starting from source start address 9000 to destination start address 9800 till source end address 90FF is reached.

 

Starting address

9000

End address

90FF

Destination address

9800

 

 

N (LOCAL MODE)

 

When this key is depressed on PC keyboard, the PS-8051 Kit starts working through local 101 keyboard. Serial communication is disabled. Following message will appear in the LCD display.

 

         ! NORMAL MODE !
E (EXAMINE / DUMP MEMORY)

 

This command will show the hex byte on the console from the memory. This command requires start address and end address. Its operates only the serial mode.

 

EXAMPLE

 

E8500 85FF     This will show hex bytes in the location from 8500 to 85FF.

 

PROGRAMMING THE 8051 TRAINER KIT:

 

PROCEDURE 1: TO ENTER THE MNEMONICS

 

  • Initially connect the 9V adaptor to J2 connector
  • Switch ON the PS-8051kit using slide Switch SW1
  • “PANTECH- 8051” will be displayed on the LCD
  • Connect the Keyboard in PS/2 connector
  • Depress “A” starting address of the program for Ex: A8500
       - For ex: A8500 enter key
       - Type the mnemonics MOV A,#12 press Enter key
       - Type the mnemonics ADD A,#12 press Enter key and continue the same procedure till the end of the program

 

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

74 12

MOV A,#12H

8502

24 12

ADD A,#12H

8504

90 45 00

MOV DPTR,#8600H

8507

F0

MOVX @DPTR,A

8508

80 FE

HERE: SJMP HERE

 

 

    • To verify the code depress D starting address and depress space bar to see next memory location
    • For Ex:

D8500

    and press spacebar till the end of the program
  • To execute the program Depress “G staring address for Ex: G8500.
  • To see the result depress “M result address” for Ex: M8600.
  • To view the output in the Register depress ‘R’ and press enter key in keyboard.

 

PROCEDURE 2: TO ENTER THE OPCODE

 

Follow the same procedure till step 4

 

  • Depress “M” starting address of the program for Ex: M8500
       - For ex: M8500 press enter
       - Type the opcode 74 space bar
       - Type the opcode 12 space bar and continue the same till the end of the program

 

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

74 12

MOV A,#12H

8502

24 12

ADD A,#12H

8504

90 45 00

MOV DPTR,#8600H

8507

F0

MOVX @DPTR,A

8508

80 FE

HERE: SJMP HERE

 

 

  • To view the code depress D starting address and depress space bar to see next memory location
       - For Ex: D8500 and press spacebar till the end of the program
  • To execute the program Depress “G staring address for Ex: G8500.
  • To see the result depress “M result address” for Ex: M8600.
  • To view the output in the Register depress ‘R’ and press enter key in keyboard

 

Note:

 

  • “M” is used for displaying the result, for Ex: M8500
  • “M” is used to entering the Opcode.
  • “M” is used for entering the data.

 

Note:

 

There are two ways to enter the program

 

  • Mnemonics method
  • Opcode method

 

Sample program is given to enter the program in both the methods

 

PROGRAMMING DETAILS

 

This chapter describes the technique for developing program in PS-8051 Board. For the development of program it is essential to get familiar with the machine code of 8051 Microcontroller or mnemonics of instruction set.

 

REGISTERS

 

From the programmer’s point of view 8051 has the following register:

 

  • A or Accumulator used for all logical and arithmetical operations.
  • B register (8 bit) used in multiply/divides instructions only.
  • R0, R1, R2, R3, R4, R5, R6, and R7 register are general-purpose registers.
  • Program counter is 16 bit register capable of addressing from 0000-FFFF
  • Stack pointer is an 8-bit register. It is initialized a value of 70, please note the value of SP is incremented by 1 or 2 (whereas SP decrements 1 or 2 in 8085 or Z80) depending on the type of instructions. Also stack uses only internal 128 bytes of memory.
  • Status/Flag register keeps track of flags.

 

MONITOR PROGRAM:

 

Monitor the program uses following areas:

 

  • Program EPROM : 0000 – 7FFF
  • External user RAM : 8000 – 8500 (for monitor program variables).
  • Internal RAM : 256 bytes RAM 128 bytes used by 8051 itself. Area from 40 to 6F is available for user.
  • User Interrupts : Timer 0 interrupt vectors to address 800b.

 

     External interrupt 0 vector to address 8003.
     (The user has to enable desired interrupts in his program).

 

Chip select signals for user :

 

CS6

4040 – 405F

CS7

4060 – 407F

CS8

4080 – 409F

CS9

40A0 – 40BF

CS10

40C0 – 40DF

 

 

BREAKPOINT

 

When writing program it is essential to debug them and for this break points are necessary. Normally these are achieved by using software Break points. However 8051 does not have any such facility. Other conventional methods require extra hardware and hence these are avoided in PS – 8051 board.

 

Wherever break points are required they can be called like subroutines. As soon as break point are called all the register values are saved and displayed on the console or in local display.

 

BREAK POINT SUBROUTINE ADDRESS 00BB

It is possible to continue the program execution just by depressing G and enter in local mode.

 

BREAK POINT DISPLAY IN LOCAL MODE:

 

When break point is encountered, all the register values are saved and the Acc. Value is displayed in the LCD display. Now use SPACE key to check register values one by one.

 

BREAK POINT DISPLAY IN SERIAL MODE:

 

When break point is encountered, all the register values are saved and all the register value will be displayed on the console.

 

EXAMPLE PROGRAMS

 

32 – BIT ADDITION

 

FLOW CHART:




32--bit-addition-flow-chart


This program adds two 32 – bit numbers.

 

  • First number is from 40h to 43h.
  • Second number is from 50h to 53h.
  • Result is from 60h to 63h.

 

NOTE: To enter the data in the internal memory, press ‘i’ and address then data.

 

Reset the kit and then enter, i0040       Press ENTER Key.

 

Then enter the data and press space bar from keyboard for entering the next data

 

EX: i0040

FIRST DATA  : 40

address : 40 TO 43  MSB IN 40

EX: i0050

SECOND DATA : 50

address : 50 TO 53  MSB IN 50

EX: i0060

RESULT DATA : 60

address : 60 TO 63  MSB IN 60

 

 

PROGRAM:

 

ADDRESS

OPCODE

MNEMONICS

COMMENTS

8500

C3

CLR C

Clear Carry flag

8501

E5 43

MOV A, 43

st

Move the 1 LSB data from ADDR 43 to ACC

8503

35 53

ADDC A, 53

nd

Add ACC with 2 LSB data in ADDR 53

8505

F5 63

MOV 63, A

Store the LSB data from ACC to ADDR 63

8507

E5 42

MOV A, 42

st

Move the 1 Mid Lowest data from ADDR 42 to ACC

8509

35 52

ADDC A, 52

nd

Add ACC with 2 Mid Lowest data in ADDR 52

850B

F5 62

MOV 62, A

Store the Mid Lowest data from ACC to ADDR 62

850D

E5 41

MOV A, 41

st

Move the 1 Mid Highest data from ADDR 41 to ACC

850F

35 51

ADDC A, 51

nd

Add ACC with 2 Mid Highest data in ADDR 51

8511

F5 61

MOV 61, A

Store the Mid Highest data from ACC to ADDR 61

8513

E5 40

MOV A, 40

st

Move the 1 MSB data from ADDR 40 to ACC

8515

35 50

ADDC A, 50

nd

Add ACC with 2 MSB data in ADDR 50

8517

F5 60

MOV 60, A

Store the MSB data from ACC to ADDR 60

8519

12 00 BB

LCALL 00BB

Break point

 

 

32 BIT SUBTRACTION

 

FLOW CHART:




32-bit-subtraction-of-flow-chart


This program subtracts two 32 bit numbers.

 

  • First number is from 40h to 43h.
  • Second number is from 50h to 53h.
  • Result is from 60h to 63h.

 

NOTE: To enter the data in the internal memory, press ‘i’ and address then data.

 

Reset the kit and then enter, i0040      Press ENTER Key.

 

Then enter the data and press space bar from keyboard for entering the next data

 

EX: i0040

FIRST DATA   : 40

address : 40 TO 43   MSB IN 40

EX: i0050

SECOND DATA : 50

address : 50 TO 53   MSB IN 50

EX: i0060

RESULT DATA : 60

address : 60 TO 63   MSB IN 60

 

 

PROGRAM

 

ADDRESS

OPCODE

MNEMONICS

COMMENTS

8500

C3

CLR C

Clear the Carry flag

8501

E5 43

MOV A, 43

st

Move the 1 LSB data from ADDR 43 to ACC

8503

95 53

SUBB A, 53

nd

Sub 2 LSB data in ADDR 53 from ACC

8505

F5 63

MOV 63, A

Store the LSB data from ACC to ADDR 63

8507

E5 42

MOV A, 42

st

Move the 1 Mid Lowest data from ADDR 42 to ACC

8509

95 62

SUBB A, 52

nd

Sub 2 Mid Lowest data in ADDR 52 from ACC

850B

F5 62

MOV 62, A

Store the Mid Lowest data from ACC to ADDR 62

850D

E5 41

MOV A, 41

st

Move the 1 Mid Highest data from ADDR41 to ACC

850F

95 51

SUBB A, 51

nd

Sub 2 Mid Highest data in ADDR 51 from ACC

8511

F5 61

MOV 61, A

Store the Mid Highest data from ACC to ADDR 61

8513

E5 40

MOV A, 40

st

Move the 1 MSB data from ADDR 40 to ACC

8515

95 50

SUBB A, 50

nd

Sub 2 MSB data in ADDR 50 from ACC

8517

F5 60

MOV 60, A

Store the MSB data from ACC to ADDR 60

8519

12 00 BB

LCALL 00BB

Break point

 

 

32 BIT BCD ADDITION

 

FLOW CHART:




32-bit-bcd-addition-of-8951-trainer


  • This program adds 32 bit BCD numbers.
  • First BCD number is from 40h to 43h.
  • Second BCD number is from 50h to 53h.
  • Result is from 60h to 63h.

 

NOTE: To enter the data in the internal memory, press ‘i’ and address then data.

 

For Example: Reset the kit and then enter, i0040      Press ENTER Key.

 

EX: i0040

FIRST DATA  : 40

address : 40 TO 43  MSB IN 40

EX: i0050

SECOND DATA : 50

address : 50 TO 53  MSB IN 50

EX: i0060

RESULT DATA : 60

address : 60 TO 63  MSB IN 60

 

 

PROGRAM:

 

ADDRESS

OPCODE

MNEMONICS

COMMENTS

8500

C3

CLR C

Clear the Carry flag

8501

E5 43

MOV A, 43

st

Move the 1 LSB data from ADDR 43 to ACC

8503

35 53

ADDC A, 53

nd

Add ACC with 2 LSB data in ADDR 53

8505

D4

DA A

DA adjusts ACC contents to correspond to a BCD no

8506

F5 63

MOV 63, A

Store the LSB data from ACC to ADDR 63

8508

E5 42

MOV A, 42

st

Move the 1 Mid Lowest data from ADDR 42 to ACC

850A

35 52

ADDC A, 52

nd

Add ACC with 2 Mid Lowest data in ADDR 52

850C

D4

DA A

DA adjusts ACC contents to correspond to a BCD no

850D

F5 62

MOV 62, A

Store the Mid Lowest data from ACC to ADDR 62

850F

E5 41

MOV A, 41

st

Move the 1 Mid Highest data from ADDR41 to ACC

8511

53 51

ADDC A, 51

nd

Add ACC with 2 Mid Highest data in ADDR 51

8513

D4

DA A

DA adjusts ACC contents to correspond to a BCD no

8514

F5 61

MOV 61, A

Store the Mid Highest data from ACC to ADDR 61

8516

E5 40

MOV A, 40

st

Move the 1 MSB data from ADDR 40 to ACC

8518

35 50

ADDC A, 50

nd

Add ACC with 2 MSB data in ADDR 50

851A

D4

DA A

DA adjusts ACC contents to correspond to a BCD no

851B

F5 60

MOV 60, A

Store the MSB data from ACC to ADDR 60

851D

21 00 BB

LCALL 00BB

Break point

 

 

FIBONACCI SERIES

 

FLOW CHART




fibonacci-series-of-flow-chart


  • FIBONACCI SERIES (0, 1, 1, 2, 3, 5, 8, 13 ……..)
  • This program will generate the Fibonacci series
  • This will take input from the internal memory, 60h.
  • Input = number of elements to be generate in the series.
  • Output =elements of the series is stored in the memory.
  • Starting from 8F00h.

 

NOTE: To enter the data in the internal memory, press ‘i’ and address then data.

 

For Example: Reset the kit and then enter, i0060     Press ENTER Key.

 

No = 40

Input count location

Beg = 8F00

Output buffer start address

 

 

PROGRAM:

 

ADDRESS

OPCODE

MNEMONICS

COMMENTS

8500

A8 60

MOV R0, 60

Move the no. of Fibonacci data into R0

8502

79 01

MOV R1, #01

Initialize 1 to R1

8504

7A 01

MOV R2, #01

Initialize 1 to R2

8506

74 00

MOV A, #00

Initialize 0 to ACC

8508

90 8F 00

MOV DPTR, #8F00

Load output data to DPTR

850B

B8 00 03

CJNE R0, #00, 8511

If R0 is not equal to 0 then jump into 8511

850E

02 85 1C

LJMP 851C

Long Jump into 851C

8511

F0

MOVX @DPTR, A

Store ACC value into DPTR

8512

A3

INC DPTR

Increment the DPTR

8513

FA

MOV R2, A

Load the ACC value into R2

8514

29

ADD A, R1

Add ACC with R1

8515

85 02 01

MOV R1,R2

Copy value from R2(addr2) to R1 (addr1)

8518

F0

MOVX @DPTR, A

Store the new value from ACC to DPTR

8519

A3

INC DPTR

Increment DPTR

851A

D8 F7

DJNZ R0, 8513

If the count isn’t equal to Zero, jump back

851C

12 00 BB

LCALL 00BB

Break point address

 

 

HEX TO ASCII CONVERSION




hex-to-ascii-conversion-flow-chart


This program takes one HEX number (0 to F) then it will convert that in to ASCII byte.user has entered any one of the HEX number ( 0 to F).

 

  • INPUT : Enter the HEX value in external memory location 8600.
  • OUTPUT : Result is stored in Accumulator and also in R1 register.

 

PROGRAM:

 

ADDRESS

OPCODE

MNEMONICS

COMMENTS

8500

90 86 00

MOV DPTR,#9200H

Load output data to DPTR

8503

E0

MOVX A,@DPTR

Store DPTR value into ACC

8504

F8

MOV R0,A

Move ACC value in temporary register R0

8505

C3

CLR C

Clear Carry flag

8507

94 0A

SUBB A,#0AH

Subtract the data 10HEX from ACC

8508

E8

MOV A,R0

Move temporary register R0 value in ACC

850A

40 02

JC LOOP

If Carry is coming then jump into LOOP

850C

24 07

ADD A,#07H

Add ACC with data 07HEX

850D

24 30

LOOP:ADD A,#30H

In Loop, Add ACC with data 30HEX

850E

A3

INC DPTR

Increment the memory pointer

8510

F0

MOVX @DPTR,A

Move ACC value into memory pointer

8512

12 00 BB

LCALL 00BB

Break point address

 

 

PORT BITS SELECTION

 

FLOW CHART:




port-bits-selection-flow-chart


  • In this port -1bit (p1.0) is set and cleared after specific interval
  • Using bit wise operators
  • User can view the output on the first pin of 8051(i.e., bit 0 of port1) in oscilloscope.

 

PROGRAM:

 

ADDRESS

OPCODE

MNEMONICS

COMMENTS

8500

D290

SETB 90

setting bit 0 in port1

8502

12 85 0C

LCALL 850C

calling delay

8505

C2 90

CLR 90

clearing bit 0 of port 1

8507

12 85 0C

LCALL 850C

calling delay

850A

80 F4

SJMP 8500

JMP to 8500

850C

7F FF

MOV R7, #FF

R7 = FF

850E

00

NOP

No operation

850F

00

NOP

 

8510

00

NOP

 

8511

00

NOP

 

8512

1F

DEC R7

Decrement R7 value

8513

EF

MOV A, R7

MOV R7 value to accumulator

85 14

70 F8

JNZ 850E

Jump if not zero to 850E

8516

22

RET

Return

 

 

CHARACTER TRANSMISSION

 

Baud calculation

 

Baud rate = (1/32) * (OSCILATOR FREQ/ (12*256))

 

0089            = tmod:           equ           89h

008d            = th1:              equ            8dh

008b            = tl1:               equ            8bh

088e           = tr1:                equ            8eh

0098          = scon:             equ             98h

0099         = sbuf                equ            99h

 

 

PROGRAM:

 

MEMORY ADDRESS

OPCODE

MNEMONICS

8500

75,89,21

MOV TMOD,#21

8503

75 8D FD

MOV TH1,#FD

8506

75 98 52

MOV SCON,#52

8509

D2 8E

SETB TR1

850B

74 41

H:      MOV A,#41

850D

B1 11

ACALL TXMT

850F

80 FA

SJMP H

8511

30 99 FD

TXMT: JNB TI,TXMT

8514

C2 99

CLR TI

8516

F5 99

MOV SBUF,A

8518

22

RET

 

 

OUTPUT: connect the Cross cable between PC and KIT execute the program and verify the result in HyperTerminal

 

ADDITIONAL PROGRAMS ON 8051 TRAINER KIT

 

EX1 programming using Arithmetic, Logical and Bit Manipulation instruction of 8051

 

1. 8-BIT ADDITION:

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

74 12

MOV A,#12H

8502

24 12

ADD A,#12H

8504

90 45 00

MOV DPTR,#8600H

8507

F0

MOVX @DPTR,A

8508

80 FE

HERE: SJMP HERE

 

 

INPUT:

 

     8501 = 12

     8503 = 12

 

RESULT:

 

     8600 = 24.

 

2. 8-BIT SUBTRACTION:

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

74 20

MOV A,#12H

8502

24 10

SUBB A,#12H

8504

90 45 00

MOV DPTR,#8600H

8507

F0

MOVX @DPTR,A

8508

80 FE

         HERE: SJMP HERE

 

 

INPUT:

 

     8501 = 20

     8503 = 10

 

RESULT:

 

     8600 = 10.

 

3. 8-BIT MULTIPLICATION:

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

74 0A

MOV A,#0A

8502

75 F0 88

MOV B,#88

8505

A4

MUL AB

8506

90 45 00

MOV DPTR,#8600

8509

F0

MOVX @DPTR,A

850A

A3

INC DPTR

850B

E5 F0

MOV A,B

850D

F0

MOVX @DPTR,A

850E

80 FE

HERE: SJMP HERE

 

 

INPUT:

 

     8501 = 0A

     8504 = 88

 

RESULT:

 

     8600 = 50 (LSB)

     8601 = 05 (MSB)

 

4. SETTING BITS IN AN 8-BIT NUMBER:

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

74 2F

MOV A,#2FH

8502

44 45

ORL A,#45H

8504

90 45 00

MOV DPTR,#8600H

8507

F0

MOVX @DPTR,A

8508

80 FE

HERE: SJMP HERE

 

 

INPUT:

 

     8501 = 2F      8503 = 45

 

RESULT:

 

     8600 = 6F.

 

5.MASKING BITS IN AN 8-BIT NUMBER:

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

74 87

MOV A,#87H

8502

54 7E

ANL A,#7EH

8504

90 45 00

MOV DPTR,#8600H

8507

F0

MOVX @DPTR,A

8508

80 FE

HERE: SJMP HERE

 

 

INPUT:

 

     8501 = 87

     8503 = 7E

 

RESULT:

 

     8600 = 06.




1) 16-BIT ADDITION of two numbers:

 

OBJECTIVE:

 

To perform 16-bit addition of two 16-bit data using indirect addressing and store the result in Memory.

 

THEORY:

 

As there is only one 16-bit Register in 89C51, 16-bit addition is performed by using ADDC Instruction twice, i.e. adding LSB first and MSB next.

 

GIVE INPUT TO THIS LOCATION:

 

8500 - F5; MSB of first 16 bit data         8501 - D5; LSB of first 16 bit data

 

8502 - 43; MSB of second 16 bit data         8503 - 55; LSB of second 16 bit data

 

RESULT:

 

8600 - MSB of result         8601 - LSB of result

 

PROGRAM

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 85 01

MOV DPTR,#8501H

8503

E0

MOVX A,@DPTR

8504

F5 F0

MOV B,A

8506

90 85 03

MOV DPTR,#8503H

8509

E0

MOVX A,@DPTR

850A

35 F0

ADDC A,B

850C

90 8601

MOV DPTR,#8601H

850F

F0

MOVX @DPTR,A

8510

90 85 00

MOV DPTR,#8500H

8513

E0

MOVX A,@DPTR

8514

F5 F0

MOV B,A

8516

90 85 02

MOV DPTR,#8502H

8519

E0

MOVX A,@DPTR

851A

35 F0

ADDC A,B

851C

90 86 00

MOV DPTR,#8600H

851F

F0

MOVX @DPTR,A

8520

80 FE

E:        SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8500 to 8503.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored in 8600 & 8601. Change data and check result in 8600, 8601.

 

2) 16-BIT SUBTRACTION Of Two Numbers:

 

OBJECTIVE:

 

To perform 16-bit Subtraction of two 16-bit data using indirect addressing and store the result in memory.

 

THEORY:

 

As there is only one 16-bit Register in 89C51, 16-bit subtraction is performed by using subb Instruction.

 

GIVE INPUT TO THIS LOCATION:

 

  • 8600 - MSB of first operand 8601 - MSB of second operand
  • 8602 - LSB of first operand 8603 - LSB of second operand

 

RESULT:

 

  • 8700 – MSB 8701 – LSB

 

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F5 F0

MOV B,A

8506

90 86 01

MOV DPTR,#8601H

8509

E0

MOVX A,@DPTR

850A

A4

MUL AB

850B

90 87 01

MOV DPTR,#8701H

850E

F0

MOVX @DPTR,A

850F

90 87 00

MOV DPTR,#8700H

8512

E5 F0

MOV A,B

8514

F0

MOVX @DPTR,A

8515

80 FE

E:       SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600 to 8603.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored in 8700 & 8701. Change data and check result in 8700, 8701.

 

3) 8-BIT MULTIPLICATION of two numbers:

 

OBJECTIVE:

 

To perform 8-bit Multiplication of two 8-bit data using indirect addressing and store the result In memory.

 

THEORY:

 

Using indirect addressing Multiply two 8-bit data.

 

GIVE INPUT TO THIS LOCATION:

 

8600 - Multiplicand

 

8601 - Multiplier

 

RESULT

 

8700        8701 – LSB

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 03

MOV DPTR,#8603H

8503

E0

MOVX A,@DPTR

8504

F8

MOV R0,A

8505

90 86 01

MOV DPTR,#8601H

8508

E0

MOVX A,@DPTR

8509

FA

MOV R2,A

850A

98

SUBB A,R0

850B

90 87 01

MOV DPTR,#8701H

850E

F0

MOVX @DPTR,A

850F

90 86 02

MOV DPTR,#8602H

8512

E0

MOVX A,@DPTR

8513

F9

MOV R1,A

8514

90 86 00

MOV DPTR,#8600H

8517

E0

MOVX A,@DPTR

8518

99

SUBB A,R

8519

90 87 00

MOV DPTR,#8700H

851C

F0

MOVX @DPTR,A

851D

80 00

SJMP E

851F

80 FE

E:       SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600 to 8601.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored in 8700 & 8701. Change data and check result in 8700, 8701.

 

8-BIT DIVISION of two numbers:

 

OBJECTIVE

 

To perform 8-bit Division of two 8-bit data using indirect addressing and store the result in memory.

 

THEORY

 

Using indirect addressing divide two 8-bit data’s.

 

GIVE INPUT TO THIS LOCATION:

 

8600 - Dividend.

 

8601 - Divisor.

 

RESULT

 

8700 & 8701

 

PROGRAM

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F5 F0

MOV B,A

8506

90 86 01

MOV DPTR,#8601H

8509

E0

MOVX A,@DPTR

850A

84

DIV AB

850B

90 87 00

MOV DPTR,#8700H

850E

F0

MOVX @DPTR,A

850F

E5 F0

MOV A,B

8511

90 87 01

MOV DPTR,#8701H

8514

F0

MOVX @DPTR,A

8515

80 FE

E:      SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600 to 8601.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored in 8700 & 8701. Change data and check result in 8700, 8701

 

FACTORIAL OF A GIVEN NUMBER:

 

OBJECTIVE

 

To find factorial of a given number.

 

PROGRAM

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F8

MOV R0,A

8505

79 01

MOV R1,#01H

8507

FC

MOV R4,A

8508

75 F0 01

MOV B,#01H

850B

E8

LOOP: MOV A,R0

850C

A4

MUL AB

850D

FD

MOV R5,A

850E

8D F0

MOV B,R5

8510

E8

MOV A,R0

8511

94 01

SUBB A,#01H

8513

F8

MOV R0,A

8514

DC F5

DJNZ R4,LOOP

8516

90 86 00

MOV DPTR,#8600H

8519

ED

MOV A,R5

851A

F0

MOVX @DPTR,A

851B

80 FE

E: SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored in 8600. Change data and check result in 8600.

 

MULTIPLY BY SHIFT AND ADD METHOD

 

OBJECTIVE

 

Multiple of two 8-bit numbers using repeat addition method.

 

PROGRAM

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F8

MOV R0,A

8505

90 86 01

MOV DPTR,#8601H

8508

E0

MOVX A,@DPTR

8509

F9

MOV R1,A

850A

7A 00

MOV R2,#00H

850C

7B 08

MOV R3,#08H

850E

E9

LOOP:    MOV A,R1

850F

54 01

ANL A,#01H

8511

FC

MOV R4,A

8512

BC 01 03

CJNE R4,#01H,LOOP1

8515

EA

MOV A,R2

8516

28

ADD A,R0

8517

FA

MOV R2,A

8518

E8

LOOP1:  MOV A,R0

8519

23

RL A

851A

F8

MOV R0,A

851B

E9

MOV A,R1

851C

03

RR A

851D

F9

MOV R1,A

851E

DB EE

DJNZ R3,LOOP

8520

90 87 00

MOV DPTR,#8700H

8523

EA

MOV A,R2

8524

F0

MOVX @DPTR,A

8525

 

80 FE

 

E:   SJMP E

 

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600 & 8601.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored in 8700. Change data and check result in 8700.

 

LCM of a given number

 

OBJECTIVE

 

To find LCM of a given number.

 

PROGRAM

 

ORG 8500H

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F8

MOV R0,A

8505

90 86 01

MOV DPTR,#8601H

8508

E0

MOVX A,@DPTR

8509

F9

MOV R1,A

850A

7D 00

MOV R5,#00H

850C

7A 01

MOV R2,#01H

850E

C3

TOP1: CLR C

850F

EA

MOV A,R2

8510

98

SUBB A,R0

8511

60 1B

JZ TOPY

8513

EA

MOV A,R2

8514

99

SUBB A,R1

8515

60 17

JZ TOPY

8517

E8

MOV A,R0

8518

8A F0

MOV B,R2

851A

84

DIV AB

851B

E5 F0

MOV A,B

851D

B4 00 0B

CJNE A,#00H,TOPX

8520

E9

MOV A,R1

8521

8A F0

MOV B,R2

8523

84

DIV AB

8524

E5 F0

MOV A,B

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600 & 8601.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored in 8700. Change data and check result in 8700

 

 

HCF of a given number

 

OBJECTIVE

 

To find HCF of a given number.

 

PROGRAM

 

ORG 8500H

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F8

MOV R0,A

8505

90 86 01

MOV DPTR,#8601H

8508

E0

MOVX A,@DPTR

8509

F9

MOV R1,A

850A

7D 00

MOV R5,#00H

850C

7A 01

MOV R2,#01H

850E

C3

TOP1: CLR C

850F

EA

MOV A,R2

8510

98

SUBB A,R0

8511

60 1B

JZ TOPY

8513

EA

MOV A,R2

8514

99

SUBB A,R1

8515

60 17

JZ TOPY

8517

E8

MOV A,R0

8518

8A F0

MOV B,R2

851A

84

DIV AB

851B

E5 F0

MOV A,B

851D

B4 00 0B

CJNE A,#00H,TOPX

8520

E9

MOV A,R1

8521

8A F0

MOV B,R2

8523

84

DIV AB

8524

E5 F0

MOV A,B

8526

B4 00 02

CJNE A,#00H,TOPX

8529

EA

MOV A,R2

852A

FD

MOV R5,A

852B

0A

TOPX: INC R2

852C

80 E0

SJMP TOP1

852E

ED

TOPY: MOV A,R5

852F

90 87 00

MOV DPTR,#8700H

8532

F0

MOVX @DPTR,A

8533

80 FE

E:      SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600 & 8601.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored in 8700 & 8701. Change data and check result in 8700 & 8701.



 

MATRIX ADDITION

 

PROGRAM

 

ORG 8500H

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

79 01

MOV R1,#01H

8502

90 86 00

MOV DPTR,#8600H

8505

E0

MOVX A,@DPTR

8506

FA

MOV R2,A

8507

90 86 01

MOV DPTR,#8601H

850A

E0

MOVX A,@DPTR

850B

FB

MOV R3,A

850C

EA

L1:      MOV A,R2

850D

89 F0

MOV B,R1

850F

A4

MUL AB

8510

FE

MOV R6,A

8511

AF F0

MOV R7,B

8513

8B F0

MOV B,R3

8515

84

DIV AB

8516

E5 F0

MOV A,B

8518

60 03

JZ RESULT

851A

09

INC R1

851B

80 EF

SJMP L1

851D

90 87 00

RESULT: MOV DPTR,#8700H

8520

EF

MOV A,R7

8521

F0

MOVX @DPTR,A

8522

90 87 01

MOV DPTR,#8701H

8525

EE

MOV A,R6

8526

F0

MOVX @DPTR,A

8527

80 FE

E:       SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600 & 8603.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored from 8700 & 8703.Change data and check result in 8700 & 8703



 

FIBONACCI SERIES OF A NUMBER

 

OBJECTIVE

 

To find Fibonacci series of a given number.

 

PROGRAM

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F5 F0

MOV B,A

8506

90 86 50

MOV DPTR,#8650H

8509

E0

MOVX A,@DPTR

850A

25 F0

ADD A,B

850C

90 87 00

MOV DPTR,#8700H

850F

F0

MOVX @DPTR,A

8510

90 86 01

MOV DPTR,#8601H

8513

E0

MOVX A,@DPTR

8514

F5 F0

MOV B,A

8516

90 86 51

MOV DPTR,#8651H

8519

E0

MOVX A,@DPTR

851A

25 F0

ADD A,B

851C

90 87 01

MOV DPTR,#8701H

851F

F0

MOVX @DPTR,A

8520

90 86 02

MOV DPTR,#8602H

8523

E0

MOVX A,@DPTR

8524

F5 F0

MOV B,A

8526

90 86 52

MOV DPTR,#8652H

8529

E0

MOVX A,@DPTR

852A

25 F0

ADD A,B

852C

90 87 02

MOV DPTR,#8702H

852F

F0

MOVX @DPTR,A

8530

90 86 03

MOV DPTR,#8603H

8533

E0

MOVX A,@DPTR

8534

F5 F0

MOV B,A

8536

90 86 53

MOV DPTR,#8653H

8539

E0

MOVX A,@DPTR

853A

25 F0

ADD A,B

853C

90 87 03

MOV DPTR,#8703H

853F

F0

MOVX @DPTR,A

8540

80 FE

E:       SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored from 8601 . Change data and check result in 8601



 

SQUARE OF A GIVEN NUMBER

 

OBJECTIVE

 

To find Square of a given number.

 

PROGRAM

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

FB

MOV R3,A

8505

74 00

MOV A,#00H

8507

75 F0 01

MOV B,#01H

850A

A3

INC DPTR

850B

F0

LOOP: MOVX @DPTR,A

850C

25 F0

ADD A,B

850E

FA

MOV R2,A

850F

E5 F0

MOV A,B

8511

8A F0

MOV B,R2

8513

A3

INC DPTR

8514

DB F5

DJNZ R3,LOOP

8516

80 FE

E:    SJMP E

 



 

SQUARE ROOT OF A GIVEN NUMBER

 

OBJECTIVE

 

To find Square root of a given number.

 

PROGRAM

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F5 F0

MOV B,A

8506

A4

MUL AB

8507

90 87 01

MOV DPTR,#8701H

850A

F0

MOVX @DPTR,A

850B

E5 F0

MOV A,B

850D

90 87 00

MOV DPTR,#8700H

8510

F0

MOVX @DPTR,A

8511

80 FE

E:      SJMP E

 

 

PROCEDURE

 

  • Enter the input data in memory location 8600.
  • Enter the above opcodes from 8500.
  • Execute the program.
  • Result stored from 8700 . Change data and check result in 8700



 

LARGEST ELEMENT IN AN ARRAY

 

OBJECTIVE

 

To find the biggest number in an array of 8-bit unsigned numbers of predetermined length.

 

EXAMPLE

 

The length of the array is specified in the Register R5. The array itself starts at 8600. The largest number of the array is stored at location 860A.

 

Data : [8600] = 05

 

[8601] = 67     [8602] = 76

 

[8603] = 89     [8604] = 98

 

[8605] = 49     [8606] = 45

 

[8607] = 9F     [8608] = 57

 

[8609] = 7A

 

Result :[860A] = 9F

 

PROGRAM

 

MEMORY ADDRESS

OPCODES

MNEMONICS

8500

90 86 00

MOV DPTR,#8600H

8503

E0

MOVX A,@DPTR

8504

F9

MOV R1,A

8505

7A 01

MOV R2,#01H

8507

E9

L1:      MOV A,R1

8508

8A F0

MOV B,R2

850A

84

DIV AB

850B

FB

MOV R3,A

850C

AC F0

MOV R4,B

850E

9A

SUBB A,R2

850F

60 03

JZ RESULT

8511

0A

INC R2

8512

80 F3

SJMP L1

8514

90 87 00

RESULT: MOV DPTR,#8700H

8517

EB

MOV A,R3

8518

F0

MOVX @DPTR,A

8519

80 FE

E:       SJMP E