Professional Documents
Culture Documents
Exp#6-Introduction To MTS-86C Trainer Kit
Exp#6-Introduction To MTS-86C Trainer Kit
I- Objective:
The objective of this experiment is to familiarize the students with microprocessor trainer kit MTS-
86C and loading some simple programs in the kit. There are two ways to download the machine code to the
RAM of MTS86, debugging and running this program through a MTS86 keypad or through a PC. This
experiment is emphasizing on the both methods.
You can enter the machine code directly to the specified memory address by using the MTS86 Keypad.
To do this, you must deduce the machine code first. The machine code can be found, after the program is
assembled by using MASM program, in the file *.LST. For example, the list file of the LED.ASM is
shown below. The machine code is listed at the second column.
1
====================== LED.LST ===================================
========================================================================
Rearrange the machine code so that they can be saved to a specified memory address in MTS86. Note
that if the code length is 2 BYTE ( 1 WORD), put the lower Byte first, as shown below
BC 00 40 BO 90 BA D6 3F EE B0 FF BA D2 3E EE F4
Turn on the power of MTS86 and following the steps shown below to input the machine code at
address (0100:0000) which equivalent to( 01000h) of physical address.
2
, Seg. Offs Data Show Memory Data at
0100:0001 xx (0100:0001)
0 Seg. Offs Data Modify memory Data 00 at
EB/AX 0100:0001 00 ( 0100:0001)
0 Seg. Offs Data
EB/AX 0100:0001 00
, Seg. Offs Data
0100:0002 xx
4 Seg. Offs Data Modify Byte to 40 at
IB/SP 0100:0002 04 (0100:0002)
0 Seg. Offs Data
EB/AX 0100:0002 40
, Seg. Offs Data Show Memory Data at
0100:0003 xx (0100:0003)
I
I
I
I
REAPTING KEYING THE MACHINE CODE FROM ADDRESS (01000:0004) TO (01000:000E).
3
B – Running the program
We have enter the machine code with starting address is located at (0100:0000). So now the program
is ready to execute by using GO Command.
.
After pressing the command termination key [ ], you suppose to see 8 LEDs on MTS86C are ON. If
the led LEDs are not ON, it might because (1) the machine code you input to the specified memory address is
incorrect or (2) you specify a wrong starting address for execution.
Exercise1:
1- Re-enter the above program with starting address (0200:0200), then execute it
from the new starting address. Record your observation.
2- Change the content of memory location 0009 to be 55h.and the executethe
Program again. What do you observe? Give your interpretation.
4
A-Writing Code and making hex file:
1. 8086 cannot take a simple written text file. It takes hex files. So an text file needs to be converted to
hex file. This is done in following steps.
2. Write your code in a notepad file with necessary instructions.
3- Save the file as p1.asm (for example) in the folder named up in C drive.
4- Go to command prompt window.
5- You can observe that execution has begun.
6- Give bin file name as p1.bin.
7- Press Enter when asked for address.
8- Your hex file is created. For checking you can go to up folder and fine out newly created file p1.hex.
5
B- Assembling program:
This section introduce you how to convert an assembly program to machine code. There are two steps
to obtain the machine code, editing the source code and assembling the source code.
To edit the source program, simply edit it under any text editor, such NOTEPAD, MICROSOFT
word or DOS editor. We are going to use DOS editor in this experiment. BE SURE that the file is saved with
the extension of [.ASM]. The source program is an example of lighting up all of the LEDs in MTS-86C
shown in Fig# 1.1A and Fig 1.1B
Fig # 1.1A
Fig 1.1B
6
The following steps is to convert the source assembly program [ LED.ASM] to machine code
[ LED.HEX].
STEP1: Launch the DOS command Prompt
STEP2: Edit your source program
STEP3: Save the edited program with the extension [ . ASM]
STEP4: Exit from DOS editor
STEP5: Enter [ V LED] as shown below
NOTE: (DO NOT Enter [ V LED.ASM] , this action may damage your assembled code).
Fig #1.2
STEP6: After press [ ENTER], the batch file will ask you to input the binary file, as shown below in
Fig # 1.3
STEP7: Enter [ LED.bin] and press [ ENTER] twice. The hex file [LED.HEX] will generated automatically
in the same folder where the assembled program located.
Fig # 1.3
7
C- Downloading the program by PC:
The Exp#1 introduced you how to download the machine code to the MTS-86C by keypad. Now, this
experiment you will learn how to download the machine code to the MTS-86C by using the PC. The steps
are shown below.
Fig# 1.4
4- Enter a name, for example MTS-86C, in the Connection Description Window and press OK as shown
in Fig# 1.5
Fig # 1.5
8
5- Select a proper COM port from the connect to Window for example COM2.and press OK as shown
in Fig #1.6
Fig # 1.6
6- In the COM properties Window, select the Baud rate to 19200bits per second, flow control to Xoff /
Xon, and press [OK] as shown in Fig# 1.7
Fig # 1.7
9
7- Press [ RESET] bottom and then press any key among [ A-F] from MTS86 keypad.
The Hyper terminal Window will show the welcome message as shown in Fig#1.8, meaning that the
connection is established between MTS-86C and PC
Fig#1.8
8- To download the machine code to the MTS86C , you need to specify the start address first. We are
going to save the program in (0200:0000) . So input [ L 0200] and press [ ENTER] in command
Prompt, as shown in Fig# 1.9
Fig#1.9
10
9- Now the system is ready to download the program. To download ( the machine code to the MTS-
86C) first select '\" TRANSFER >> SEND FILE" from the menu bar , then browse the Hex file
generated from the assembler [*.HEX] and press [ OPEN] as shown in Fig#1.10
Fig#1.10
10- To execute the program stored in [ 0200:0000] ,you can either use [GO] Command from MTS-86C
Keypad or input [ G=0200:0] the press [ ENTER] in Hyper Terminal Prompt .Press [Y] to confirm
the execution as shown in Fig#1.11
Fig # 1.11
11- You suppose to see 8 LEDs on MTS86C are ON after press [Y].
11
IV- Debugging by Hyper terminal:
In This section, you will use the program that you have downloaded [LED.HEX]. There are many
helpful commands able you to debug your program from Hyper Terminal rather from MTS-86C Keypad.
Note: The contents of memory location after [0200:000F] are not considered as part of the download
program[ LED.HEX].
12
3- Examine or modify the content of 8086 register R[Register name]
Input [R][ENTER] to examine the contents of all registers
14