Sei sulla pagina 1di 84

Manual

&
Experiments
Microprocessor lab

By Dr.Hanal Abuzant
And Eng. Asma Afifi
An-Najah National University
12/1/2012
Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 2 An-najah National University


Microprocessor Lab

General Safety Instructions for the Computer Engineering Labs

1. Tampering with devices is prohibited. In the case of a device


malfunction, the lab supervisor must be informed immediately.

2. When conducting the lab experiments, the correctness of the wiring and
circuit connections must be verified. The power sources must be
properly turned off. The activation of the power sources must not occur
without the permission of the lab supervisor or the instructor.

3. The setting of the power sources (in terms of utilizing AC or DC) must
be verified.

4. In the event of an evacuation alarm, please stay calm and follow the
instructions of the University general safety committee in this regard.

5. In the event of a fire, the Foam-type Fire Extinguisher is to be used only.


The Powder-type Fire Extinguisher is strictly prohibited due to the
damage it inflicts on the computers.

6. The student must consult the lab supervisor in the case a device stops
working or in the case of an electricity outage.

7. Tampering with the 220V device power lines is prohibited. Do not insert
any object into the openings of the power line adapters or sockets.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 3 An-najah National University


Microprocessor Lab

General Rules and Regulations for the Computer Engineering Labs


1. Eating, using mobile phone, drinking and smoking are strictly prohibited in the
lab.

2. You must faithfully follow the instructions of the lab supervisor.

3. Students are prohibited from entering the lab premise in the absence of the lab
supervisor or anyone fulfilling that role.

4. It is strictly prohibited to take any lab item or equipment outside the lab without
the permission of the lab supervisor. In the case such permission exists, the
Temporary Loan Form must be filled out duly.

5. The lab time schedule must be observed. It is prohibited to be present in the lab
before or after the designated time slot without prior coordination and permission.

6. It is prohibited to conduct any experiment or drill in the absence of the lab


supervisor or the instructor.

7. The workbenches and tables must be arranged properly before leaving the lab.

8. When in the lab, maintain a serious and responsible conduct and refrain from
joking and any irresponsible behavior.

9. Avoid fiddling with devices that you are not familiar with or ones that you do not
know how to operate very well.

10. Relocating lab equipment is prohibited without the lab supervisor permission.

11. The student must prepare beforehand for any experiment or drill he/she is going to
conduct in the lab.

12. All devices must be turned off as soon as the student is done from using them.

13. Students are advised to rest frequently while working on computers.

14. The main power safety switch must be turned off when the lab activities conclude.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 4 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 5 An-najah National University


Microprocessor Lab

UNPACKING and INSPECTION

Unpacking
The module and its accessories are packed in a cardboard box that is used
also to pack the entire equipment after its use.

Inspection and materials identification

The box contains:


• The module Z3
• The 3"1/2 floppy disk with the application MODZ3 for Windows
• n. l `parallel' connection cable for connection to Personal Computer
• n. l `serial' connection cable for connection to Personal Computer
• n.l cable and 8 conductors for connection of the logic probes to the
test-points
• n.2 cables to connect the module to the power supply
• n.2 cables with `claps' for the logic probes.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 6 An-najah National University


Microprocessor Lab

Table of Contents
1. Introduction ..................................................................................................................................................10
1.1. General presentation ........................................................................................................................................ 10
1.1. Starting the system............................................................................................................................................ 11

2. General descriptions ......................................................................................................................................12


1.2. Introduction....................................................................................................................................................... 12
1.3. 32 bit Microprocessor ....................................................................................................................................... 12
1.4. Memory unit ...................................................................................................................................................... 13
1.5. Display unit ........................................................................................................................................................ 14
2.1. Keyboard unit .................................................................................................................................................... 15
2.2. Parallel I/O unit ................................................................................................................................................. 15
2.3. Serial I/O unit..................................................................................................................................................... 16
2.4. Analogue I/O unit .............................................................................................................................................. 16
2.5. Power supply unit .............................................................................................................................................. 16
2.6. Logic probes unit ............................................................................................................................................... 17
2.7. Faults unit .......................................................................................................................................................... 17

3. Commands and monitor ................................................................................................................................18


3.1. introduction ....................................................................................................................................................... 18
3.2. Keyboard ........................................................................................................................................................... 18
3.3. Commands of the monitor .............................................................................................................................. 20

4. Software interrupts .......................................................................................................................................25


4.1. Introduction....................................................................................................................................................... 25
4.2. List of interrupts ................................................................................................................................................ 25
4.3. Descriptions of interrupts.................................................................................................................................. 26

5. Peripherals of the system ..............................................................................................................................33


5.1. Console .............................................................................................................................................................. 33
5.2. Parallel interface and Buzzer ............................................................................................................................. 37
5.3. Serial interface................................................................................................................................................... 39

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 7 An-najah National University


Microprocessor Lab

5.4. A/D converter .................................................................................................................................................... 42


5.5. D/A converter .................................................................................................................................................... 44

6. Communications with PC ...............................................................................................................................45


6.1. Modz3 application for windows ........................................................................................................................ 45

7. Lab Experiments ............................................................................................................................................50


7.1. Experiment 1: Basic Input Output ..................................................................................................................... 51
7.2. Experiment 2: Analogue to digital converter .................................................................................................... 53
7.3. Experiment 3: Keypad scanning ........................................................................................................................ 54
7.4. Experiment 4: Digital to analogue converter .................................................................................................... 55
7.5. Experiment 5: Strain gage and temperature sensor acquisition ....................................................................... 56
7.6. Experiment 6: Ultrasonic transmitter and receiver........................................................................................... 59
7.7. Experiment 7: DC motor control ....................................................................................................................... 61
7.8. Experiment 8: Stepper motor control ............................................................................................................... 64
7.9. Experiment 9: Stepper motor positioner .......................................................................................................... 66
APPENDIX A: Use of the application modules with module Z3/EV ...................................................................67
APPENDIX B: Description of the electrical Diagrams........................................................................................73

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 8 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 9 An-najah National University


Microprocessor Lab

1. INTRODUCTION

1.1 General presentation


The 32 Bit Microprocessor Trainer (Module Z3/EV) is a didactical system
with a microprocessor, based on the 80386 Intel, which allows facing all
the problematic of the study and use of microprocessor systems.
It has been designed and built for educational use in the formation of
technicians for the project, use and maintenance of systems with
microprocessor.
The use of a microprocessor of the series x86 Intel, widely found in the
Personal Computer, makes an instrument adapted to many applications.
the Module Z3/EV possesses all the typical components necessary for the
study of this type of systems: microprocessor, memories RAM and
EPROM, keyboard and liquid crystal display, serial and parallel interface,
analog inputs and outputs.
the module possesses additionally the connector for fault insertion of the
System IPES, , which allows facing all the problematic of fault research in
microprocessor systems.

The main subjects of study that can be faced with the 32 Bit Microprocessor
Trainer are:
• structure of a microprocessor system
• programming of the microprocessor systems
• memory devices
• interface with external devices (serial and parallel)
• analog-digital and digital-analog conversion
• fault research in the microprocessor systems
• examples of interfacing with the modules of the Student-Trainer.

Main characteristics of the system are:


• microprocessor 386EX at 2.21 MHz
• 32 KB EPROM system, 32 KB EPROM user, 32 KB RAM static
• keyboard hexadecimal/commands, display LCD with a line of 16
characters
• parallel interface (8+8+4 lines 1/O), serial interface RS-232
• analog inputs and outputs 0-8V converter of 8 bit
• logic probes
• single supply 5V
• Monitor in EPROM with commands for:
• visualization and modification memory and registers
• continuous execution, step by step, with program breakpoints
• loading of programs from PC.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 10 An-najah National University


Microprocessor Lab
1. INTRODUCTION

1.2 Starting the System

For the starting and use of the system proceeds in the following mode:

• If the system is connected to the Units IPES SISI, SIS2 or SIS3


make sure that the dip-switch DPI and DP2 are all OFF.

• If the system is autonomous make sure that the dip-switch DP2 is


in ON and that DPI is in OFF.

Connect the system to a power supply at +5 VDC.

Turn on the power supply.

The microprocessor starts operating and, after having initialized all the
peripherals, sends the message to the display:

(In the case the message doesn't appear, try to carry out a reset
operation of the microprocessor using the key RESET on the
keyboard).

AT THIS POINT THE SYSTEM IS READY TO OPERATE.

For doing a simple immersion and starting test of a program, see the
examples of chapter 5.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 11 An-najah National University


Microprocessor Lab
12. GENERAL DESCRIPTION

2. GENERAL DESCRIPTION

2.1 INTRODUCTION
The 32 Bit Microprocessor Trainer is composed of a single card in which
all its components are found.
In this chapter, all the different unit components are described.
For a more detailed description refer to the chapters to come.

2.2 32 BIT MICROPROCESSOR UNIT

This unit contains:

• the microprocessor Intel 386EX


• the clock generator with quartz at 4.43 MHz (this clock is sent directly to
the microprocessor which divides it by 2, obtaining an effective working
frequency of 2.215 Mhz)
the decoding of the addresses for the enabling of the memory and I/O
devices (internal decoding lines in the microprocessor for the memory
devices (CHIP SELECT), and an external decoder for the UO devices (1/O
SELECT))
• the data bus (DATA BUS), it's a bus of 16 bit since the 386EX is an internal
32 bit and external 16 bit (the test points D16-D31 repeat the same signals
as DO-D15)
• the address bus (ADDRESS BUS) with 26 lines (the system uses the real
modality of the lW with 20 lines of effective address, the test points
A20-A31 are therefore not used)
• the state signals (STATE SIGNALS).

The CHIP SELECT used for the selection of the devices, with their
specifics, are shown in the table:

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 12 An-najah National University


Microprocessor Lab
13. GENERAL. DESCRIPTION

The I/O SELECT used for the selection of the I/O devices. with their
specifics, are shown in the table:

In this unit of the system, there are N.2 connectors present, which are
available at the exterior:

• Connector J4: contains the interruption lines INTO, INTI, INT2


and INT3 of the peripheral Interrupt Control Unit integrated in the
microprocessor 80386EX.

• Connector J3: contains the lines of the three timers of the peripheral
Timer Counter Unit integrated in the microprocessor 80386EX.

2.3 MEMORY UNIT


The memory unit contains the following devices, with the
corresponding addresses at the interior of the system:

Beginning Final
Memory Devices
Address Address

system EPROM 32K IC5 F8000 FFFFF


user EPROM 32K IC6 F0000 F7FFF
RAM 32K IC7-8-9-10 00000 07FFF

The memories EPROM are preset in a way to operate with the


microprocessor 80386EX with data transferring of 8 bit.

The memories RAM are preset to operate at 16 bit, therefore, there are
always used N.2 memories in couple for the least significant byte (IC7,
IC9) and N.2 memories for the most significant byte (ICS, ICI O).

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 13 An-najah National University


Microprocessor Lab
2. GENERAL DESCRIPTION

At system's starting, the memory EPROM of the system and the


microprocessor follow the instruction at addresses FFFFO. where the
program Monitor begins.

The EPROM of the system is reserved for the memorization of


programs developed by the user, which have to be rendered available in
the system.

For what concerns to the RAM, it contains:


• the area reserved to the interruption vectors
• the area reserved to the system
• the user area.

The area User RAM begins at the memory address 00800


(0080:0000) and starting from this address, the user programs can
be loaded.

2.4 DISPLAY UNIT


This unit contains the display for data and message visualization during
the use of the system.

It is a LCD display composed of 1 line of 16 characters and driven by


an internal controller LSI.
It receives the commands and the data directly from the data bus and
uses the following address lines:

Address
Function
hexadecimal
350 Writing of codes
351 Writing of data
352 Reading of state
353 Reading of data

Refer to the list of interruption vectors for the use of the display in the
programs that describe the routines present in the monitor that can be
used.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 14 An-najah National University


Microprocessor Lab
2. GENERAL DESCRIPTION

2.5 KEYBOARD UNIT


This unit contains the keyboard for the emission of commands and data during the use of the
system.

It is composed of 20 keys divided in N.5 lines of 4 columns each.


The RESET key acts directly on the reset of the microprocessor, while the other keys are
managed by means of a matrix in the following mode:

The columns correspond to different 1/O addresses (32E, 32D, 32B, 327), while the lines
correspond to different bit of the data bus (DO, D 1, D2, D3, D4).

Refer to the list of interruption vectors for the use of the keyboard in the programs that describe
the routines present in the monitor that can be used.

2.6 PARALLEL 1/O UNIT

This unit contains a parallel interface controller of the type 8255, which gives at disposition N.3
parallel LO ports.
The module Z3 utilizes N.2 ports of 8 bit (Port A and Port B) and N.4 I/O lines coming from
Port C (PCO-PC3 ).
One line of Port C (PC4) is then used for commanding the Buzzer.
See the electrical diagram in the appendix of the manual to consult about the pin-out of the
output connector.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 15 An-najah National University


Microprocessor Lab
2. GENERAL DESCRIPTION

2.7 SERIAL I/O UNIT


This unit contains an asynchronous serial interface controller of the type 8250.
It receives the clock at 1.8432 Mhz from an external oscillator and manages all the typical lines
of an interface RS-232: TXD, RXD, CTS, RTS, DCD, DSR and DTR.
The integrated circuits IC14 (1488) and IC15 (1489) manage to move the TTL signals (0-5V) in
output of the 8250 towards the level (-12V - +12V) foreseen by the standard RS-232.
The output connector J2 had a pin-out equal to the connectors of 113M compatible PCs.
See the electrical diagram in the appendix of the manual to consult about the pin-out of the
output connector.

2.8 ANALOG I/O UNIT

This unit contains an A/D converter and a D/A converter of 8 bit. Manages input and output
analog signals within the field 0-8 Volt.

The A/D conversion is done using the IC17 (ADC0804), which is connected directly to the
section of 8 bit (DO-D7) of the microprocessors bus.

The D/A conversion uses the IC18 (74374) as a latch for the data coming from the bus DO-D7 of
the microprocessor, and IC19 (DAC0800) for the D/A conversion.

2.9 POWER SUPPLY UNIT

This unit contains the supply section.


It is preset for single supply operation at +5V.
The voltages of +12V and -12V, used by the Serial I/O Unit and by the Analog 1/O Unit, are
taken internally at the module by means of dedicated DC-DC converters.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 16 An-najah National University


Microprocessor Lab
2. GENERAL DESCRIPTION

2.10 LOGIC PROBES UNIT

This unit contains logic probes, together with the corresponding LEDs for state visualization.

In particular, there are present:

• N.8 logic probes TTL (0-5V), called DO-D7, with the corresponding signaling LED
DO-D7, that can be connected simultaneously, by means of a dedicated cable of 8
test-points.
• N.1 logic probe TTL, called DH, equipped with pull-up resistance, with the corresponding
signaling LED, DH.
• N.1 logic probe TTL, called DL, equipped with pull-down resistance, with the
corresponding signaling LED, DL.
• N.1 logic probe TTL, called DS, which acts on the transitory signals, with the
corresponding signaling LED, DH and with reset key RES-DS.

2.11 FAULTS UNIT

This unit contains the connector for the connection to the unit IPES Mod. SIS 1, SIS2 e SIS3
which manage the introduction of faults.

The faults can also be managed in a local mode by means of the dipswitch sDP 1 and DP2.

In normal conditions, without faults, DP2 has to be set all in ON, while DPI has to be set all
in OFF.

See the Teacher Appendix `Faults Management' of this manual for the detailed description of
foreseen faults.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 17 An-najah National University


Microprocessor Lab
3. MONITOR COMMANDS

3. COMMANDS and MONITOR

3. 1 INTRODUCTION
The MONITOR is the program, installed at the interior of the EPROM of
the system, which supplies the system management and allows the user to
work with it. Its fundamental functions are:
• Visualization and modification of memory and registers
• Continuous execution, step by step, with program breakpoints
• Loading programs from keyboard and from PC.

The interaction with the user is done by means of keyboard and display.

3.2. KEYBOARD
The keyboard locks like in the figure:

it is basically divides in two parts:

• The top section with 4 keys.


• The bottom section with the 16 hexadecimal keys with number and
command function

NOTE.
The microprocessor 80386 addresses a high quantity of memory. The
devices (RAM and EPROM) present in the system do not occupy all
this memory.
If trying to access, during the use of the Monitor commands, to non
occupied memory cells from the RAM or from the EPROM, the
system gets blocked, since the microprocessor sets itself to wait for the
READY signal from the external memory (which is obviously not
present).
In these cases, it's necessary to carry out a reset of the system in
order to return to the command mode.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 18 An-najah National University


Microprocessor Lab
19. MONITOR COMMANDS

Top section with 4 keys.

In this section there are present

This key is physically connected to the reset line of the microprocessor. It


is always active and provokes the reset of the micro and the starting of the
program Monitor in the system EPROM.

This key has a double function. The function CHG (Change) allows
entering in modification session of a value eventually present on the
display (contents of a register, memory location, ..) the function RET
(Return) allows ending the modification session. the modification session
is made evident by the presence of the cursor on the display.

The ARROW keys allow moving the cursor during the modification
session.
16 Keys Hexadecimal/Command Section.
The 16 keys in this section have a double function.
Number Function. Corresponds to the 16 hexadecimal numbers 0-F
during the modification sessions (the modification
session can be entered with the key CHG/RET).
Command Function. Allows giving the commands to the Monitor when
the system is not in modification session (the
modification session can be exited with the key
CHG/RET).

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 19 An-najah National University


Microprocessor Lab
20. MONITOR

3.3 COMMANDS OF THE MONITOR


The commands of the Monitor are shown next and make reference to the
description of the keyboard's keys, which corresponds to each one of the
commands.

This command allows examining the contents of the


memory. The display is done one byte at the time.
Once the key has been pressed, the address of the memory cell to be
visualized in the segment form, is requested: address (the system is set
directly in modification session):

Once the address of interest has been inserted, the key CHG/RET has to
be pressed in order to end the modification session. On the display
appear at this time the specified address and the corresponding data, in
the form:

On the left appears the address in the segment form: address.


the character, which appears after the letter -a'. represents the data in ASCII
P P P P

code.
The number, which appears after the letter 'h", represents the data in
hexadecimal form.
The possible commands at this time are the following:
• To pass to the successive cell: press INC(+)
• To pass to the preceding cell: press DEC(-)
• To pass to the first RAM user cell: press FIRST
• To pass to the last RAM user cell: press LAST
• To modify the displayed data: press CHG/RET
• To end the modification: press ClHG/RET.

This command allows visualizing/modifying the contents of all the


REG registers of the microprocessor:
EAX, ECX, EDX, EST, EDT, EBP, ESP, EIP, EFLAGS

After having pressed the key, the first register appears on the display:

The possible commands at this time are the following:


• To pass to the successive register: press INC(+)
• To pass to the preceding register: press DEC(-)
• To pass to the first register: press FIRST
• To pass to the last register: press LAST

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 20 An-najah National University


Microprocessor Lab
3. MONITOR COMMANDS

• To modify the value of the register: press CHG/RET


• To end the modification of the register: press CHG/RET

This command allows visualizing/modifying the contents of all the


segment registers of the microprocessor:
SEG CS, SS, DS, ES, FS, GS

After having pressed the key, the first segment register appears on the
display:

The possible commands at this time are the following:


• To pass to the successive register: press INC(+)
• To pass to the preceding register: press DEC(-)
• To pass to the first register: press FIRST
• To pass to the last register: press LAST
• To modify the value of the register: press CHG/RET
• To end the modification of the register: press CHG/RET

This command allows charging a program in the memory emitting the


LD KB instruction codes by means of the keyboard.
Once the key has been pressed, the departing address of the program in
the segment form is requested: address (the system is set directly in
modification session):

Once the address of interest has been inserted, the key CHG/RET has to
be pressed in order to end the modification session. On the display appear
at this time the specified address and the corresponding data, in the form:

The modification session is entered with the cursor in the first position of
the hexadecimal data to insert in the indicated memory site.
Once the data has been inserted, the key CHG/RET is pressed which
memorizes the data, increments the memory site, and gets ready for new
data insertion.
The insertion operations are terminated with the key RESET.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 21 An-najah National University


Microprocessor Lab

This command allows charging a program from the Personal Computer


means of the parallel interface.
LD PAR Once pressed the key, the system is set to listening of the parallel
interface and memorizes all the bytes, which arrive to it, starting from
the memory address 0000:0800H.
Once the transfer is finished, the system visualizes the number of bytes
received and is set to the command mode.
See chapter 6 referring to the Communications with Personal Computer
for the operative details.

This command allows charging a program from the Personal Computer,


LD SER by means of the serial interface.
Once pressed the key, the system is set to listening of the serial interface
and memorizes all the bytes, which arrive to it, starting from the
memory address 0000:0800H.
Once the transfer is finished, the system visualizes the number of bytes
received and is set to the command mode.
See chapter 6 referring to the Communications with Personal Computer
for the operative details.

This command starts a program considering the memory address


RUN 0000:0800H as the departing address.
It is useful for quickly starting the programs transferred from PC. which
are positioned automatically starting from this address.

This command allows starting the execution of a program specifying the


GO departing address.
The departing address is required to be introduced in the form CS:IP
(the system is set directly into modification session)

Once the program's departing address has been inserted, the key
CHG/RET has to be pressed. this time the execution of the program is
launched starting from the specified address.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 22 An-najah National University


Microprocessor Lab
3. MONITOR COMMANDS

This command allows following a step of the active user program,


SS starting from the present value contained in the user registers CS and IP.
Pressed consecutively, it allows following a program step by step.

After each step of the program, it stops, displaying the memory to which
it has arrived:

it's possible at this time, examining the contents of the registers and of the
memory.

This command allows visualizing and modifying the value of the


BR breakpoints inserted in the program (a maximum of 5 breakpoints is
foreseen).
Once pressed the key, the address of the first break points is displayed in
the segment form: address:

The possible commands at this time are the following:


• To pass to the successive breakpoint: press INC(+)
• To pass to the preceding breakpoint: press DEC(-)
• To pass to the first breakpoint: press FIRST
• To pass to the last breakpoint: press LAST
• To modify the value of the breakpoint: press CHG/RET
• To cancel the breakpoint: press CB

This command allows canceling the breakpoint presently displayed (a


CB breakpoint is considered cancelled, and therefore not active, when it's
positioned in address FFFF:FFFF).

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 23 An-najah National University


Microprocessor Lab

Increments the values of the memory address. of the register, of the


INC(+) register segment. or of the present! displaced breakpoint.

Decrements the values of the memory address, of the register, of the


DEC(-) register segment, or of the presently displayed breakpoint.

Positions in the first memory address, register, register segment, or


FIRST breakpoint.

Positions in the last memory address, register, register segment, or


LAST breakpoint.

Key of general use, left free.


GEN

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 24 An-najah National University


Microprocessor Lab
25. MONITOR
RESOURCES

4. SOFTWARE INTERRUPTS

4.1 INTRODUCTION
The Monitor of the system contains at its interior the management
software of the different peripherals of the 32 Bit Microprocessor Trainer.

This software is rendered available in the simplest way possible, by


means of the interruption software of the microprocessor.

In this chapter the different interruptions are described; their functions and
the required parameters.
In all the examples of this manual, the interruption software will be
employed for the management of the system's peripherals.

4.2 LIST OF THE INTERRUPTIONS SOFTWARE

The list of the interruptions software of the 32 Bit Microprocessor Trainer


Mod. Z3/EV is the following:

Interruption Routine General


Number Name Description
INT OOH IMONITOR Division by 0. Return to the monitor.
INT O4H reserved Single-step
[NT 02H Not used Interruption non mask
INT 03H Reserved Breakpoints
INT 04H Not used Overflow
TNT 05H Not used
INT 06H Not used
INT 07H ]MONITOR End user prog. and return to the monitor
INT 08H 1KEYBOARD Reading of a key from the keyboard
INT 09H IDIS BYTE Sending of hexadec. byte to the display
Sending of ASCII character to the
INT 0AH IDIS CHAR
display
INT 0BH IRIS OUTS Sending of a string to the display
INT 0CH IDIS CODE Sending commands to the display
INT 0DH IWAIT_MS Wait in milliseconds
INT 0EH IAD READ Reading from A/D converter
INT 0FH IDA WRITE D/A converter Command
INT 1 0H IBUZZER Buzzer Command
INT 11H Not used
INT 12H IPARAL Management parallel interface
INT 13H Not used
INT 14H ISERIAL Management serial interface

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 25 An-najah National University


Microprocessor Lab
4. MONITOR RESOURCES

4.3 DESCRIPTION OF THE INTERRUPTIONS SOFTWARE


The different interruptions, with the corresponding parameters. are
described next.

End of the program.


INT 07H This interruption terminates the execution of the program and transfers
the system's control to the program Monitor.
It has to be called at the end of each program having to give up the control
to the monitor at the end of its execution.
It makes appear the monitor's prompt on the display.

INPUT none
OUTPUT none
Altered
none
Registers

Reading of a key from the keyboard.


INT 08H This interruption allows reading the keys pressed on the keyboard.
It makes the scanning of the keyboard and waits until a key is pressed. The
key code (number from 0 to 18) is taken back to the register AL.

INPUT none
OUTPUT AL= key code pressed (0-18)
Altered
none
Registers

Sending a byte in hexadecimal form to the display.


This interruption allows writing a byte in hexadecimal form in any
INT 09H position of the display.
the position is identified by means of the contents of register CL, and
the byte by means of the contents of AL.

INPUT CL =position on the display (0-14)


AL = byte to
OUTPUT none display
Altered none
Registers

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 26 An-najah National University


Microprocessor Lab
4. MONITOR RESOURCES

Sending a character ASCII to the display.


This interruption allows writing a character ASCII in any position of the
INT 0AH display.
the position is identified by means the contents of register CL, and the
ASCII code by means of the contents of AL.

INPUT CL = position on the display (0-14)


AL = ASCII code of the character to
dis lay
OUTPUT none
Altered none
Registers

Sending a string of characters on the display.


This interruption allows sending a string of characters on the display.
INT 0BH The string consists in a sequence of bytes, which correspond to
different characters of the string, ending with the code 00H.
The string is identified by the contents of DS:SI.The string is written
starting from the first position of the display.

INPUT DS = indicates the segment containing the string.


SI = indicates the beginning address of the stringt
at the interior of the segment DS

OUTPUT none
Altered none
Registers

Sending Commands to Display.


This interruption sends control commands to the display:
INT 0CH INPUT AH = 1 Cancels the display
AH = 2 Brings the cursor home
AH = 3 Moves the cursor right
AH = 4 Moves the cursor left
AH = 5 Cursor ON
AH= Cursor OFF
AH = 7 Brings the cursor in position
(AL contains position:0-15)
OUTPUT none
Altered none
Registers

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 27 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 28 An-najah National University


Microprocessor Lab
4. MONITOR RESOURCES

Wait in milliseconds.
This interruption provokes a wait, before the return, equal to the number
INT 0DH of milliseconds specified by the contents of register AX in input:

INPUT AX = number of milliseconds

OUTPUT none
Altered
none
Registers

Reading the Analog/Digital converter.


This interruption operates in the following mode:
INT 0EH • sends the command Beginning Conversion to the A/D converter
• waits for the signal of End Conversion
• reads the result of the conversion and returns it into AL.

INPUT none
OUTPUT AL = result of the conversion
Altered
none
Registers

Command of the Digital/Analog converter.


INT 0FH This interruption sends a data (byte) to the Digital/Analog converter,
which transforms it automatically in an analog value.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 29 An-najah National University


Microprocessor Lab

Command of the Buzzer.


This interruption commands the emission of sounds on the buzzer.
INT 10H It is possible specifying the frequency and the duration of the emitted
sound.

INPUT BX = duration
CX = frequency
OUTPUT none
Altered none
Registers

Management of the Parallel Interface.


This interruption manages the functioning of the parallel interface.
The controller 8255 is always used in Mode 0 (Basic I/O).
INT 12H The available functions are determined from the contents of AH:

INPUT AH = 0 Programming ports


AH= 1 Sending data to port A
AH = 2 Sending data to port B
AH = 3 Sending data to port C
AH= 4 Reading data from port A
AH = 5 Reading data from port B
AH = 6 Reading data from port C
OUTPUT AL = data read
Altered none
Registers

AH = 0 : Programming ports
Register AL Programming
Bit 0 = 0 : port A in output
= 1 : port A in input
Bit 1 =0 :port B in output
= 1 : port B in input
Bit 2 = 0 : port C (CO-C3) in output
= 1 : port C (CO-C3) in input

AH = 1, 2, 3 : Sending Data to ports A, B, C

The contents of AL determine the data to be sent to the ports.


AH = 4,5,6: Reading Data from ports A, B, C

The contents of AL in output correspond to the data read from the port.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 30 An-najah National University


Microprocessor Lab
4. MONITOR RESOURCES

Management of the Serial Interface.


This interruption manages the functioning of the asynchronous serial
INT 14H interface RS-232.
The controller 8250 is used.
The available functions are determined from the contents of AH:

AH =0 : Initialization of the communication port


The contents of AL determines the initialization parameters:

Register AL Programming
Bit 7,6,5 Baud rate
= 000 : 1200
= 001 : 2400
= 010 : 4800
= 011 : 9600
(use the baud rate 1200 for the
controllers UMB 8250)
Bit 4,3 Parity
=
00 : no
= 01 :odd
=10:no
= 11 :even
Bit 2 Stop Bit
=0 :1
=1 :2
Bit 1,0 Word length
=10 : 7 bits
=11 : 8 bits

AH = 1 : Transmission of a character
The contents of AL determine the character to be sent.
Before sending character, the routine waits until eventually other
preceding characters have been transmitted.

AH = 2 : Reception of a character
The contents of AL determine the received character.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 31 An-najah National University


Microprocessor Lab
32. MONITOR RESOURCE

The routine waits for the availability of a character before returning to


the calling program.

AH = 3 : Reading of the state

The contents of AH determine the present state of the line and of the
modem.

Register AH State of the Modem


Bit 7 Received line signal detect
Bit 6 Ring indicator
Bit 5 Data set ready
Bit 4 Clear to send
Bit 3 Delta receive line signal detect
Bit 2 Trailing edge ring detector
Bit 1 Delta data set ready
Bit 0 Delta clear to send
Register AL State of the Line
Bit 7 Time-out
Bit 6 Transmitter shift register empty
Bit 5 Transmitter holding register empty
Bit 4 Break detect
Bit 3 Framing error
Bit 2 Parity error
Bit 1 Overrun error
Bit 0 Data ready

AH = 4 : Control of the Modem

The contents of AH determine the present state of the Modem. which


will be set.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi


Page | 32 An-najah National University
Microprocessor Lab
5. SYSTEM PERIPHERALS

5. PERIPHERALS of the SYSTEM and APPLICATION EXAMPLES

5.1 CONSOLE
The console of Module Z3/EV is composed of the keyboard and the
display.

5.1.1 Keyboard
Refer to the electrical diagram of fig. 5.1.1 .

fig. 5.1.1 Electrical diagram of the


k b d
It can be seen how the keyboard is composed of 5 lines x 4 columns.
The reading of the keyboard is done, one column at the time, carrying
out input operations at the addresses:

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 33 An-najah National University


Microprocessor Lab
34. SYSTEM PERIPHERALS

For each one of these addresses, the buffer IC26 (74244) is enabled,
which allows reading by means of the lines D0-D4, the situation of the
keys (D0 corresponds to the highest key of the column).
In the Test-Points Rl, R2, R3, R4 and R5, the situation of the lines read
by means of the buffer IC26 is shown.
RI corresponds to the highest line of the keyboard, R5 to the lowest one.

In order to develop programs which use the keyboard, the interruption


software INT 08H can be used.

An example of a program that reads the keyboard and visualizes the key
code is shown (its number) in hexadecimal form on the display.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi


Page | 34 An-najah National University
Microprocessor Lab
5 . S Y S TE M P E R I P I 1 F R A L S

5.1.2 Display
Refer to the electrical diagram of fig.5.1.2 .

fig.5.1.2 Electrical diagram of the display

It's a LCD display composed of 1 line of 16 characters and driven by an LSl internal controller.
Receives the commands and the data directly from the data bus and uses the following address
lines:

Address
Function
hexadecimal
350 Writing of the codes
351 Writing of the data
352 Reading of the state
353 Reading data

The codes that can be used with the various functions, are shown next:

03FH initial reset


00FH active cursor flashing
010H cancels display
002H moves cursor to home position
014H moves cursor to the right
010H moves cursor to the left

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 35 An-najah National University


Microprocessor Lab
5. SYSTEM PERIPHERALS

For the direct programming of the LCD display by means of its codes,
please refer to its data sheet.

The interruptions software can be used for the development of programs


which use the display:

• INT 09H: sending of a byte in hexadecimal form on the display


• INT 0AH: sending of an ASCII character on the display
• INT 0BH: sending of a characters string on the display
• INT 0CH: sending of commands to the display.

See the example of the preceding paragraph and to the consecutive


paragraphs for the use of the interruptions mentioned above.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi


Page | 36 An-najah National University
Microprocessor Lab
5. SYSTEM PERIPHERALS

5.2 PARALLEL INTERFACE and BUZZER


The parallel interface uses the Programmable Peripheral Interface 8255.
It is a programmable UO device, of general use, projected for Intel
microprocessors.
The use diagram at the interior of the system, is shown in the figure:

fig. 5.2.1 Electrical diagram of the parallel interface

The resources used are the following:

Port Use
Port A, bit A0-A7 Available at pins 15-22 of connector J I
Programmable ininput or in output
Port B, bit B0-B7 Available at pins 7-14 of connector JI
Programmable in input or in output
Port C, bit C0-C3 Available at pins 5-3-23-25 of connector JI
Programmable in input or in output
Port C, bit C4 Command of the buzzer
Programmed in output

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 37 An-najah National University


Microprocessor Lab
38. SYSTEM PERIPHERALS

Also for this peripheral, if you want to program directly the chip 8255
for its use, refer to its data-sheet.

The monitor of the system contains on the other hand, the following
interruptions software for the management of this interface:

• INT 10H: use of the buzzer


• INT 12H: programming, writing and reading data at ports A, B, C

Next, we show an example of a program that commands in a cyclic


mode, one at the time, the bits of port A and of port B with the value `1',
and emits a `beep' at each change of state.

Connect the test-points A0-A7 of the Parallel F0 Unit with the test-
points D0-D7 of the Logic Probes Unit, by means of the issued cable,
for the direct visualization of the port A (in the same way for port B).

By Dr.Hanal Abuzant and Eng.Asmaa Afifi


Page | 38 An-najah National University
Microprocessor Lab
5. SYSTEM PERIPHERALS
5.3 SERIAL INTERFACE

The serial interface uses the Programmable Peripheral interface 8255


It is a programmable I/O device, of general use. projected for Intel microprocessors.
The use diagram at the interior of the system, is shown in the figure5.3.1:

fig.5.3.1 Electrical diagram of the serial interface


The transmission and reception clock is issued with an external oscillator at 1.8432 Mhz. This
clock is then divided internally at the 8250 to furnish the different baud rate.

The serial interface is provided with a connector D9 (J2), identical to the connector serial interface
of the IBM compatible Personal Computer.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 39 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 40 An-najah National University


Microprocessor Lab
5. SYSTEM PERIPHERALS

The signals present at the connector are:


• Pin 1 (DCD): Data Carrier Detect (input signal). It is a modem
management signal.
• Pin 2 (RXD): Received Data (input signal). Serial data received from the
transmitting external device.
• Pin 3 (TXD): Transmitted Data (output signal). Serial data transmitted to
the receiving external device.
• Pin 4 (DTR): Data Terminal Ready (output signal). Modem management
signal which serves to communicate that the Module Z3 is ready to initiate
communication sessions.
• Pin 5 (GND): ground.
• Pin 6 (DSR): Data Set Ready (input signal). Modem management signal
which serves the external device to indicate that the Module Z3 is ready to
initiate communication sessions.
• Pin 7 (RTS): Request To Send (output signal). Indicates the request on the
side of Module Z3 for the transmission of a byte.
• Pin 8 (CTS): Clear To Send (input signal). Indicates the request on the side
of the external device for the transmission of a byte.

The controller 8250 communicates with the microprocessor through the


following addresses, which correspond to as many registers at its interior:
330H Receive Buffer Register
330H Transmit Holding Register
333H Line Control Register
335H Line State Register
334H Modem Control Register
336H Modem State Register
330H Divisor Latch LSB
331H Divisor Latch MSB
332H Interrupt Identification Register
331H Interrupt Enable Register

The registers mentioned above can be used directly for the writing of
communication programs,. In this case, refer to the controller 8250
datasheet for the details.

The monitor of the system contains on the other hand an interruptions


software ( INT 14H ) with all the functions needed for serial
communications.

Next, N.2 programs are shown; a transmission and a reception one. for
the serial connection with a peripheral.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi


Page | 41 An-najah National University
Microprocessor Lab
5. SYSTEM PERIPHERALS

5.4 A/D CONVERTER


The A/D conversion unit uses the Analog Digital converter AD0804.
It is an Analog Digital converter of 8 bits that interfaces directly to the bus
of microprocessor 80386EX.
The use diagram, at the interior of the system is shown in figure 5.4.1:

fig.5.4.1 Electrical diagram of the AID conversion


i
See how the input signal (range 0-8 Volt) is sent to the operational
amplifier IC16, which manages to reduce the level in output to the range
0-5 Volt required by the input Vin+ of the converter.
The converter operates in the following mode:
• receives the signal of Beginning of Conversion by means of the line
WR#
• during the conversion, the line INTR# is not active (high level)
• at the end of conversion, the line INTR# turns active (low level)
• the result of the conversion (B0-B7) is sent to the bus and activates
the signal RD#

The line INTR# is connected to the input INT0 of the microprocessor and
to the input A0 of the buffer IC21 (address 32EH).
It's possible thus to use the A/D converter with Interrupt or Polling
techniques.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 42 An-najah National University


Microprocessor Lab
43. SYSTEM PERIPHERALS

The Monitor of module Z3/EV renders available the Interruption


Software INT 0EH, which facilitates teh use of the A/D converter at the
interior of the programs.

Next we will show an example of a program that reads continuously the


A/D converter and visualizes on the display the conversion result in
hexadecimal (00-FF) form.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi


Page | 43 An-najah National University
Microprocessor Lab
5.SYSTEM PERIPHERALS

5.5 D/A CONVERTER


The D/A conversion unit uses the Digital Analog converter DAC0800.
It's a Digital Analog converter of 8 bits with output in current.
The use diagram, at the interior of the system is shown in figure 5.5.1:

ICIE3

Fig. 55.1 Electrical diagram of the D/A conversion section

The converter DAC0800 is not provided with an internal latch, and therefore cannot be connected
directly to the bus of the microprocessor.

Therefore, the latch 74374 (IC 18) is used, connected to address 0300H, in order to supply the 8
bits to the converter.

The 8 bits are available on the test-points D0-D7 of the Analog I/O Unit. The converter transforms
the input digital information in an output current value on the pin IOUT.

This current is transformed in a voltage value within the range (0-8 Volt) of the operational
amplifier IC20.

For the command software of the D/A converter, it's necessary only to send the output data to the
Port with address 0300H.

The Monitor of module Z3/EV renders available the Interruption Software INT 0FH, which
facilitates the use of the A/D converter at the interior of the programs.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 44 An-najah National University


Microprocessor Lab
45. COMMUNICATIONS WITH THE PC

6. COMMUNICATION with the Personal Computer

6.1 The MODZ3 application for Windows


The Module Z3 is issued with the application MODZ3 for windows
attaining the use of the Personal Computer in the development of applications.
MODZ3 can be used on any PC with with operative system Windows 3.x,
Windows 95, Windows 98.
It is furnished with a single disc and is installed on the Personal Computer with the
command:
A:>SETUP

The Setup procedure provides automatically the creation of the group of


programs (EV: 32 bit Microprocessor) and of the launching command
requested.
Together with the application, there are also application examples
installed. Consult the file README.TXT for details.

The main functions of the application are described next.

MENU FILE: Open, New, Save,.. Files.


These commands serve to create or to open program files of type ASCII
with extension.ASM .
Once the file is open, the edit window becomes active, where it's possible
inserting and modifying the source programs.

MENU EDIT: Undo, Cut, Copy, Paste, Delete, Find, Find Next, Replace
These commands allow writing the programs with all the functions of any
edit program for Windows, as NotePad, WordPad, etc. .

MENU COMM
This section allows transferring the programs in machine code
corresponding to the source file, which is presently active.
If, for example, the file PROVA.ASM has been opened, the file
PROVA.BIN or PROVA.EXE is transferred to Module Z3/EV.

For the generation of the file PROVA.BIN it's necessary to proceed using
the assembler MASM Microsoft, with the following commands:
MASM PROVA;
LINK PROVA; EXE2BfN
PROVA.EXE PROVA.BIN

These commands can be automated with the options of the Utility menu.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 45 An-najah National University


Microprocessor Lab
46. COMMUNICATIONS WITH THE PC

MENU COMM: Serial transmission

This command allows transferring a program to Module Z3/EV using the serial interface
RS-232 of the Computer and of the Module.
The computer and the Module Z3 (connector 72) have to be connected together using the
adequate issued cable.

The transmission is done at the speed of 1200 bit/s, without parity, with 1 stop bit and with 8
bit/character.
Before the transmission, it appears a Dialog Box where it's possible setting the requested
parameters.
In particular:

• The interface used: COMI, COM2 and the other communication parameters.
• The directory where the transfer program resides

• The extension of the transfer file. It can be BIN in case the program EXE2Bin is
used to convert the file generated from the Linker, otherwise it can be EXE in case
the file generated from the Linker is directly used.
• The skipping of bytes in the file to transmit. This is important in case the files EXE
are used, which normally contain in the first 200H bytes, information which serve
only in MS-DOS environment.

MENU COMM: Parallel transmission

This command allows transferring a program to Module Z3/EV using the parallel interface
of the Computer and of the Module.
The computer and the Module Z3 (connector J2) have to be connected together using the
adequate issued cable.

Before the transmission, it appears a Dialog Box where it's possible setting the requested
parameters. In particular:
• The interface used: LPTI, LPT2, ..
• The directory where the transfer program resides
• The extension of the transfer file. It can be BIN in case the program EXE2Bin is used to
convert the file generated from the Linker, otherwise it can be EXE in case the file
generated from the Linker is directly used.
• The skipping of bytes in the file to transmit. This is important in case the files EXE are
used, which normally contain in the first 200H bytes, information which serve only in
MS-DOS environment.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 46 An-najah National University


Microprocessor Lab
6. COMUNICATIONS WITH THE PC
• The TX delay, which serves avoiding the PC of transmitting the data too fast to Module
Z3/EV. It is used because there are no handshake lines during the parallel transmission. In
the case in which there were transmission problems, try increasing this time.

MENU UTILITY

This menu contains the commands for the direct execution of the assembling operations from the
application MODZ3, Linker and binary conversion of the program.

MENU UTILITY: Set Parameters

This command sets the parameters for the execution of the assembling operations, Linker and
binary conversion.

These parameters are:

• Assembling command. It is counseled to specify a file batch (ex. MASM.BAT) where the
command for starting the assembler is written. A possible file batch of this type contains
the instructions: masm %1,,%I,;
pause

• Linker command. It is counseled to specify a file batch (ex. LINK.BAT) where the
command for starting the link is written. A possible file batch of this type contains the
instructions:
link %1;
pause
• Binary conversion command. It is counseled to specify a file batch (ex. EXE2BIN.BAT)
where the command for starting the conversion programs is written. A possible file batch
of this type contains the instructions:
exe2bin %l.exe %1.bin
pause

MENU UTILITY: Assembler

Starts automatically the assembling command giving as parameter the name of the active
program.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 47 An-najah National University


Microprocessor Lab
6. COMMUNICATIONS WITH THE PC
MENU UTILITY: Linker

Starts automatically the linker command giving as parameter the name of the active
program.

MENU UTILITY: Convert in Binary form

Starts automatically the binary conversion command giving as parameter the name of the
active program.
The operative system MS-DOS normally comprises a program (EXE2BIN.EXE) which has
this finality.

In some computers the program EXE2BIN is not available in the DOS version
installed.

In this case the binary conversion is abandoned and the file EXE is used directly (remember
in this case to skip the first 512 bytes of the file).

MENU UTILITY: Program List

This command opens a window on the video, where it's possible visualizing the list of the
assembled program (obviously if the file generated by the assembler NomeProg.LST is
present).

MENU UTILITY: Program Binary Code

This command opens a window on the video, where it's possible visualizing the binary code
of the active obviously if the file NomeProg.BIN is present).
These informations are important since they are the ones to be inserted in the memory of
Module Z3, whenever the program is charged directly from the keyboard.
The codes are visualized starting from address OOOOH.

When they have to be inserted into Module Z3, it's necessary to start with the address
where the program will be actually put (normally 0000:0800H).

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 48 An-najah National University


Microprocessor Lab

7.Experiments
Experiment 1: Basic Input Output
Experiment 2: Analogue to digital converter
Experiment 3: Keypad scanning
Experiment 4: Digital to analogue converter
Experiment 5: Strain gage and temperature sensor acquisition
Experiment 6: Ultrasonic transmitter and receiver
Experiment 7: DC motor control
Experiment 8: Stepper motor control
Experiment 9: Stepper motor positioned

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 49 An-najah National University


Microprocessor Lab

Experiment 1: Basic Input Output

Read the user manual and explore the 32 bit Microprocessor Trainer (Module Z3/EV) that
based on 8036 Intel.

Objectives
Carry out the IN/OUT digital operations (ON or OFF states) manually or
using a microprocessor system.
Equipment
needed
• Power supply unit PS
• Experiment module F04/EV
• Application board F04-1 lEV
• Multimeter

The different exercises can be developed by acting directly on the module


with jumpers, switches ... and by using a microprocessor module connected to
each application board.
With this system, after loading and developing programs into the
microprocessor memory which can be separately edited, compared, linked and
transferred into the microprocessor system, you can develop the exercises
directly controlled by the microprocessor and then analyze the programming
and interfacing.
Introduction
The application board BINARY I/O and A/D D/A CONVERTER basically
consists of two sections, one for the DIGITAL/ANALOG conversion and the
other for the ANALOG/DIGITAL one.
Two other sections are created in this structure for the digital IN of 8 lines
(Port B) and the digital OUT of other 8 lines (Port A).
The digital IN section can be used directly with a set of switches I0, I1, I2,
I3, I4, I5, I6, and I7 which enable the selection of the state of each input line.
The state of the 8 input bits (Port B) is displayed by 8 leds.
The input data are available through an 8-line buffer, for external
acquisition with microprocessor system. The digital OUT section is used by
interfacing to the microprocessor system. The state of the two output lines,
which is made available for external use with an 8-line buffer, is displayed by a
set of 8 leds.
Electrical
diagram
(see the schematic of the BINARY I/O and A/D D/A CONVERTER board
F04-1/EV in the APPENDIX B: Description of the electrical diagrams)

Digital IN:
The logic state of the 8 IN lines is selected with the 8 switches I0 - I7. The
switch I8 must be in SWITCH position. In this way, the integrated circuit IC3
(74HC244 – octal tri-state buffer) is enabled and so the 8 lines are available to
be acquired (Port B).
For the integrated circuit 74HC244, if the lines 1 and 19 are to the low logic
state, it behaves as buffer and takes the logic levels applied to the inputs back to
the outputs. These levels are then made available for the external acquisition

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 50 An-najah National University


Microprocessor Lab

port (Port B). If the lines 1 and 19 are to high logic state, the outputs are
electrically separated because they have high impedance and so the whole
switches section is separated from the rest of the circuit. This need appears when
using the A/D conversion input. The logical data obtained by conversion are not
altered by the state of switches I0-I7.

Digital OUT:
The digital data shown by the external unit (I/O ports of a microprocessor,
interface cards ...) are transferred by means of the integrated circuit 1C6
(74HC244) and then displayed with the set of leds.
The integrated circuit 74HC244 shows the lines 1 and 19 to the low logic
state and behaves as standard buffer, taking the logic levels applied to the input
back to the output.
The Experiment
• Connect the application board F04-l/EV to the parallel IN/OUT ports of the
microprocessor system through the proper 26-line flat cable
• Check that the switch I8 is turned to SWITCH
• Disconnect the 8 jumpers Jl-J8 otherwise the same function will be carried out
by the hardware of the same module.
• Write an assembly program that reads the digital input lines that can be changed
-
with the switches I0 I7 and reports the same logical values to the output ports
after a little delay through the 8255 controller. (see the data sheet of 8255)

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 51 An-najah National University


Microprocessor Lab

Experiment 2: Analog to Digital Converter

Objectives
Convert analog variables into digital
Equipment
needed
• Power supply unit PS
• Experiment module F04/EV
• Application board F04-1 lEV
• Multimeter
Introduction
The application board BINARY I/O and A/D D/A CONVERTER basically
consists of two sections, one for the DIGITAL/ANALOG conversion and the
other for the ANALOG/DIGITAL one.
The A/D conversion section is made with an A/D 8-bit dedicated converter
with 8 bits which outputs can be directly interfaced with the data bus or IN ports
(OUT of latch, tri-state kind).
The analog input voltage (0-8Vdc) is converted into a digital range variable
between 00H and FFH.
To guarantee a higher flexibility of use, the outputs are made more stable
by an 8-line buffer and so they can be acquired externally by means of a
microprocessor system.
Electrical diagram
(See the schematic of the BINARY I/O and A/D D/A CONVERTER board
F04-1/EV in the APPENDIX B: Description of the electrical diagrams)
The effective input line of the voltage to be converted is protected from
overvoltages with the two diodes D1 and D2.
The transistor T1 properly initializes the start up converter (at start up the
pulse is to ground at the input 5 as well as the input WR) and guarantees the later
continuous conversion (the converter can be used in direct connection with a
microprocessor).
The integrated circuit IC2 (74HC244) has 1 and 19 lines to low logic state
and behaves as normal buffer, taking the input logic levels back to the output
and enabling the acquisition from an external system (I/O ports of a
microprocessor, interface cards...)
The switch I8 must be to A/D position so to enable IC2 and force the
outputs of IC3 to a high impedance state; in this way the state of the switches I0
- I7 does not change the logic state of the lines from the A/D converter.
The Experiment:
• Connect the application board F04-l/EV to the parallel IN/OUT ports of the
microprocessor system through the proper 26-line flat cable
• Connect the IN/AD input of the module to a power supply with variable output
0-8V dc
• Check that the switch i8 is turned to A/D position
• Write an assembly program that reads the A/D converter from port B and
displays the digital values
o On the 8 leds through port A.
o On the LCD.
(Hint: use the system interrupts that explained in the manual)

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 52 An-najah National University


Microprocessor Lab

Experiment 3: Keypad scanning

Objectives
Detect keystrokes from a keypad (keypad interface
program)
Equipment needed
• Power supply unit PS
• Experiment module F04/EV
The Experiment:
• Write an assembly program to implement the keypad scan algorithm.
• Each time a key is pressed on the keypad, the program should display the key
that was pressed on the LCD.
(Hint: refer to the user manual to use the addresses of the keypad columns, and to use the system
interrupts to handle the LCD

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 53 An-najah National University


Microprocessor Lab

Experiment 4: Digital to Analog Converter

Objectives
• Convert digital variables into analog one
• Use keypad to control rises and falls in voltage
Equipment needed
• Power supply unit PS
• Experiment module F04/EV
• Application board F04-1 lEV
• Multimeter
• Oscilloscope
Introduction
The application board BINARY I/O and A/D D/A CONVERTER basically
consists of two sections, one for the DIGITAL/ANALOG conversion and the
other for the ANALOG/DIGITAL one.
The D/A conversion section is used by interfacing to the microprocessor
system. The values between OOH and FFH across the input are converted into a
corresponding value ranging between 0-8Vdc.
The logic state of the digital input values (port A) is displayed with a set of
8 leds.
Electrical diagram
(see the schematic of the BINARY I/O and A/D D/A CONVERTER board
F04-1/EV in the APPENDIX B: Description of the electrical diagrams)
The D/A converter IC4 receives the 8 digital lines (port A) directly to be
converted. These are usually shown by some external digital unit (I/O ports of a
microprocessor, interface cards...)
The conversion is made instantly and the resulting voltage value is present
across the output of the operational amplifier IC5. With the calibration trimmer
RV3, the offset voltage of the amplifier is compensated while with RV2, the
analog output range is fixed between 0 - 8Vdc.
The Experiment:
• Connect the application board F04-l/EV to the parallel IN/OUT ports of the
microprocessor system through the proper 26-line flat cable
• Check that the switch I8 is turned to SWITCH position
• Disconnect the 8 jumpers Jl-J8
o Write an assembly program to perform the digital to analog conversion and
use the keypad (buttons 3 and 7) to control rising and falling in output
voltage. Check the voltage using the multimeter.
o Write an assembly program to generate square, saw and sine waves,
display them using the oscilloscope.
o Use the keypad (buttons 3 and 7) to increase and decrease the width of the
signals above.
(Hint: use the system interrupts that explained in the manual to handle the LCD)

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 54 An-najah National University


Microprocessor Lab

Experiment 5: Strain Gage and Temperature Sensor


Acquisition

Objectives
• To analyze the characteristics of the force transducers and the signal
conditioners usually employed with this kind of sensors.
• To analyze the characteristics of temperature transducers and signal
conditioning circuits normally used with these sensors.
Equipment needed
• Power supply unit PS
• Experiment module F04/EV
• Application board F04-1 lEV
• Multimeter
Introduction
The application board STRAIN GAGE and TEMPERATURE SENSOR
consists of two sections one for each transducer (device for producing an
electrical signal from another form of energy).
Strain Gage Sensor:
U

The power sensor used is a strain gauge of universal use; it can be used for
general deformation analysis and mechanical stress in engineering field.
The operating principle is based on the correlation between percentage
elongation and resistance variation induced by the sensor. The obtained
resistance variations are very low. The sensor used in the application board,
with a weight of 5 Kg applied to the mechanical support it is attached to, has a
variation of 0.005Ω. To measure such small voltage variations, a bridge circuit
is used where the unknown resistance of the strain gauge strip is measured by
comparison to the other resistors. The bridge unbalancing is detected with a
differential amplifier to obtain the wished voltage range at the output.
Temperature Sensor:
U

To measure voltage variations corresponding to the sensor inner resistance


variations caused by the surrounding temperature, a bridge circuit is used to
detect the resistance variation and to amplify the output voltage. See the figure
below:

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 55 An-najah National University


Microprocessor Lab

Electrical diagram
Strain Gage:
As the resistance variations of the sensor are very low, the voltage
variations are very low and can hardly be measured with a normal multimeter
(µV).
With a voltmeter you can measure the voltage amplified by 10 which can be
detected at the output of the differential amplifier IC1 which takes a value of
some mV.
As the voltage value is too low for the acquisition, it is amplified further by
IC2 for about 350 times, so to obtain a voltage of +lVdc at a pressure of approx.
1 kg exerted on the support connected to the sensor.
Temperature Sensor:
U

The differential amplifier IC3 amplifies the voltage difference due to


resistance variation. And so, at the temperature of 0°C and 100°C, it has a
voltage of 0V and 8V at the output, respectively.
The quick heating section of the surrounding is made with a power resistor
R17 connected to the +12Vdc power supply.
The Experiment
Connect the output of the application board F04-4/EV to the IN/AD input
of the microprocessor system.
• Write an assembly program to read the weight measurement carried out with the
A/D converter (00H-FFH) and convert it into grams and print the value on the
LCD.
o The output voltage of the measurement circuit with STRAIN GAGE is
from 0V to +2V.
• Write an assembly program to read the measured temperature with A/D
converter (00H-FFH) and convert it into Celsius degree.
(Hint: use the system interrupts that explained in the manual to read from the A/D and to print on the LCD)

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 56 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 57 An-najah National University


Microprocessor Lab

Experiment 6: Ultrasonic Receiver and Transmitter

Objectives
• To analyze the emission characteristics and the driving circuits of an
ultrasound generator.
• To analyze the reception characteristics and the circuits of an ultrasound
receiver.
• To evaluate the use of the ultrasound transmitter and receiver as presence or
distance detector of a barrier set near the transmitter.
Equipment needed
• Power supply unit PS
• Experiment module F04/EV
• Application board F04-1 lEV
• Multimeter
• Oscilloscope
Introduction
The ultrasound transmitter/ receiver application board consists of two
sections, one to drive the transmitter and the other to receive the ultrasounds.
The ultrasound transducer consists of a ceramic tablet which oscillates in
case it is powered with a sine signal with frequency corresponding to the
resonance (usually 100 kHz and 5000 kHz). Similarly, the receiver uses the
resonance effect of a ceramic tablet to generate a signal when ultrasounds are
picked up.
Detection system of an obstacle:
U

The ultrasound signal transmitted by the transducer, is reflected and then


detected by the microphone if crossing a physical barrier.
The simplest use of the system is the detection of the presence or not of an
obstacle between the transmitter and the receiver.
Transmitter:
U

A 640-kHz reference clock signal is generated. The starting frequency is


divided by 16 using a binary division circuit, so that a 40 kHz-signal is obtained.
The transducer S1 is powered directly by a coupling circuit and a low-pass filter.
Receiver:
U

The reflected signal, intercepted by the ultrasound microphone, is


amplified with three amplifier stages, detected, squared and made stable for a
few seconds by a monostable circuit. The output drives an alarm led or an
acoustic device.

Electrical diagram
Transmitter:
U

IC1 (74HC4060) represents the clock generation and frequency division


section. This integrated circuit consists in a 14-stage (stages which are not
accessible from the outside) binary counter; each available output divides the
input clock signal frequency by a power of 2.
Connecting the external network Cl, R4, RV1 and R5, an inner oscillator
with 640-kHz signal generation is made with an astable included into the
integrated circuit.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 58 An-najah National University


Microprocessor Lab

With the next low-pass filter, the ultrasound transducer is applied a sine
wave-form with 40 kHz-frequency.
Receiver:
If an obstacle is set near the ultrasound transmitter, the signal is reflected
and then intercepted by the receiver.
The signal detected by the ultrasound microphone is amplified by 3 cascade
stages (IC2 - 4069). This signal starts a monostable which keeps the output to
high level for a fixed time if an obstacle is detected.
The output of the monostable IC3 enables the acquisition of the receiver
state, with an IN line of a microprocessor system.

The Experiment
Connect the ultrasound transmitter/ receiver application board to the
parallel IN/OUT ports of the microprocessor system through the proper 26-line
flat cable
Write an assembly program to do the following:
• Reading of the ULTRASOUND receiver state using the line B0, and transmitter
enabling and disabling using the line A0.
Pushing INC(+)/3 the transmitter lights on and so does the green led on the
transmitter (GENERATOR). Rx=ON or Rx=OFF appears by setting an obstacle
over the sensors TX and RX on the LCD display of module Z3/EV. If the
transmitter is switched off with DEC(-)/7, Rx keeps obviously always OFF

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 59 An-najah National University


Microprocessor Lab

Experiment 7: D.C Motor Control with Optical Receiver

Objectives:
• To analyze the motor operation in d.c.
• To analyze the PWM driving technique applied to a d.c. current motor
• To analyze the operation of an optical transmitter-receiver system
• To study the frequency-voltage conversion systems
• To analyze the application of an optical transmitter-receiver system for reading the speed of a motor

Equipment needed:
U

• Power supply unit PS


• Experiment module F04/EV
• Application board F04-1 lEV
• Multimeter
• Oscilloscope

Introduction:
U

PWM Control
The application board D.C. Motor control consists of two sections, one for driving the D.C. motor
and a second for reading the speed with an optical transmitter - receiver system. The PWM switching
technique is used to control the D.C. motor. It is powered by a rectangular behavior voltage with constant
period T and variable duty cycle.
PWM control diagram

The voltage Ve is compared which depends on the speed set-point to a saw-tooth voltage (or
triangular) Vs with constant frequency generated by an oscillator. The output of the comparator V O is a
R R

rectangular wave with constant frequency and variable duty cycle with the level Ve which drives the
switching of a power section directly connected to the motor.
Motor behavior
The motor characteristics, as concerns the speed and the given torque, basically depend on the
mean value of the applied voltage which depends on the duty cycle.
Optical sensor for speed detection

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 60 An-najah National University


Microprocessor Lab

The disk with transparent body on which opaque radial traces are produced, integral to the motor
axis, enables the light emitted by the TRANSMITTER led to reach or not the RECEIVER photo-sensor.
The output signal generated by the receiver consists of a train of pulses with frequency proportional to the
same speed.
Frequency-voltage converter
The train of pulses generated by the optical RECEIVER is properly squared and then converted
into a signal with voltage variable between 0 - 8Vdc by a monolithic F/V converter.

Electrical diagram - PWM motor driving:


Oscillator
The oscillator consists of transistor T1 which charges the capacitance Cl according to a particular
time constant. When the voltage on the collector of T1 reaches the voltage value present across the inverting
input of the operational amplifier IC 1, the output of the operational changes state, forcing the conduction of
the transistor T2 which quickly discharges the capacitance C1 determining the starting of a new cycle of
oscillation. On the inverting input of IC2 there is a saw tooth wave-form, with frequency of about 25 kHz
and amplitude of about 8Vdc.
Comparator
The control voltage ranging between 0 to 8 Vdc is applied to the non- inverting input. When the
saw-tooth voltage overcomes the reference signal value, the output of the operational amplifier switches
generating a square waveform with duty cycle depending on such level.
Power section
The DC motor is directly powered by the power transistor T3.

PWM Oscillator

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 61 An-najah National University


Microprocessor Lab

PWM control section of the DC motor

Electrical diagram - Optical transmitter / receiver and signal conditioning:


Optical receiver
The led constituting the transmitter is powered permanently. The phototransistor receiver, when
the motor is rotating, shows a set of pulses on the collector which amplitude is 10 Vdc and duration is 0.6
ms. These pulses are squared and inverted with the first inverter across IC3, detected with C6 / D2 and
inverted twice with IC3.
Conditioning and F/V converter
With the F/V IC4 converter, the pulse frequency is transformed into a d.c. voltage ranging between
0 and 8Vdc (the calibration is carried out with RV1 so to obtain a range covering the max. speed of the
motor completely).
Output
The operational amplifier IC5 operates as separator for the circuits which can be applied to the
output.

Optical transmitter /receiver section

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 62 An-najah National University


Microprocessor Lab

F/V conversion Section


Connection to an external microprocessor system
The application board has an input for the motor speed selection of analog kind IN 0 to +8V and
can be connected to a microprocessor system with a D / A conversion section to supply a programmable
voltage range from 0 to 8Vdc.
There is also an output OUT 0 to +8V to read the voltage value corresponding to the motor speed
with an external A/D conversion section. In this way, the speed SET-POINT value for the motor can be
fixed with a program in assembler, the effective speed can be read and an output corresponding to the motor
control can be generated.

The Experiment:
U

Speed reading through A/D converter and setting of the SET-POINT value through D/A converter
Part1:
• Connect the OUT (0 output to +8Vdc) of the application board F04- 3/EV to the IN A/D input of the
microprocessor system.
• Connect the IN (0 input to +8Vdc) of the application board to the OUT D/A output of the microprocessor
system.
• By pushing the pushbutton INC(+)/3 the motor speed increases up to a maximum value corresponding to
+8Vdc
• By pushing the pushbutton DEC(-)/7, the motor speed drops until stopping.
• The display of module Z3/EV shows the speed value (00H - FFH)
Part2:
The program reads the speed and applies a simple sum transformation to the detected error,
consisting in the difference between the set-point and the detected speed added to the set-point. This value
is emitted, as variable of the processed output, across the output toward the D/A converter and so toward the
motor.
• Connect the OUT (0 output to +8Vdc) of the application board F04- 37EV to the IN A/D input of the
microprocessor system.
• Connect the IN (0 input to +8Vdc) of the application board to the OUT D/A output of the microprocessor
system.
The display of module Z3/EV shows, the Setpoint (Sp), the speed (Tch) and the output (Out)

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 63 An-najah National University


Microprocessor Lab

Experiment 8: Stepper Motor

Objectives:
• To check the operating principles of a stepper motor
• To analyze the driving of the stepper motor
• To analyze the direct driving of the stepper motor with a microprocessor system

Equipment needed:
U

• Power supply unit PS


• Experiment module F04/EV
• Application board F04-1 lEV
• Multimeter
• Oscilloscope

Introduction:
U

Stepper Motor
The STEPPER MOTOR application board basically consists of two sections, one for the clock
pulses generation and the state defining the motor rotation direction and a second for driving the 4 windings
constituting the inductor of the same motor.
Powering the motor winding in sequence, a rotating magnetic field is created which is followed by
the rotor. The rotation speed is determined by the speed with which the windings are switched and the
rotation direction is determined by the particular switching sequence.
Clock and direction signal
The switching signal can be generated in three ways:
• by a local oscillator (continuous generation)
• with a pushbutton (a pulse at each push)
• with a line connected to an OUT port coming from a microprocessor system (continuous generation)

The motor direction is specified by a fixed logic state line. This line determines the UP or DOWN
counting of a binary counter which powers a binary/decimal counters. The pulses generated by the last
drives the four power stages powering the motor windings with the wished sequence.
The circuit configuration supplies a FULL STEP motor driving. Other kinds of driving can be
carried out using a microprocessor module and driving the power sections of the motor windings directly.
(see the APPENDIX B: Description of the electrical diagrams)

Electrical diagram:
U

(See the schematic of the STEPPER MOTOR application board F04-1/EV in the manual).
With jumper J2 inserted, the bistable oscillator IC1 generates a square wave-form with output
frequency of about 100 Hz.
If jumper J1 is inserted, the control pulse is generated directly with the pushbutton MANUAL
CLOCK. Each time you push it there is a step rotation of the motor. The signal produced with the
pushbutton MANUAL CLOCK is squared by 1C2 so to get a pulse with regular fronts at the output.
With jumper J3 the train of control pulses is generated directly by an output port of a
microprocessor system which can be connected externally.
In the two first cases, the control pulses are directly applied to the UP/DOWN counter IC3 which
shows the corresponding binary valve (QA, QB, QC and QD) in the four output lines.
Only 2 outputs are used as input for IC4 BCD-TO-DECIMAL DECODER which shows a pulse in
correspondence to each binary combination of its inputs only to its outputs 0, 1, 2 and 3 (the others are not
involved as only 2 inputs are used):

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 64 An-najah National University


Microprocessor Lab

BA 0 1 2 3
00 1 0 0 0
01 0 1 0 0
10 0 0 1 0
11 0 0 0 1

The pulses drive the stepper motor windings directly with the corresponding transistors Ti, T2, T3
and T4. The UP/DOWN counting is fixed with jumper J4.

Connection to external microprocessor system


If the jumper J3 is inserted, the clock signal for the UP/DOWN counter is shown directly with a line
of the output port of the microprocessor system. The same for the UP/DOWN counting direction.
Disconnecting jumpers J5, J6, J7 and J8, the driving transistors of the 4 windings are driven directly with 4
output lines coming from the microprocessor system. In this way, the driving mode can be determined in a
flexible way with the assembler program

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 65 An-najah National University


Microprocessor Lab

Experiment 9: Stepper motor – Positioner

In this experiment, you will write the code for a positioner. The input
to your program is the degree (0 – 360) which determine the angle at
which the motor should be positioned clockwise. For example, if 73
is first entered, the motor will rotate 73 degree clockwise. Then if 28
is entered, the motor will rotate 45 counter-clockwise, that is to the
position 28. Notice that (28 – 73 = -45). If 300 is then entered, the
motor should be positioned at 300, therefore it should rotate 300 – 28
= 272 degrees clockwise.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 66 An-najah National University


Microprocessor Lab
APPENDIX A: Use of the application modules with module Z3/EV

Use of the application. modules with the microprocessor system


Z3/EV

The use of the Microprocessor Module Trainer Z3/EV with the


application boards inserted into the module F04/EV, enables to carry
out experiments on the different modules using properly developed
programs in assembler that can be changed and extended according to
each educational need.

The control software is provided with the module Z3/EV and this
enables to carry out the following phases, for each program:

• EDITING
• ASSEMBLING
• LINKING
• TRANSFER TO Z3/EV RAM

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 67 An-najah National University


Microprocessor Lab
APPENDIX A: Use of the application modules with module Z3/EV

USE OF THE PERSONAL COMPUTER FOR THE PROGRAMS DEVELOPMENT

In order to develop programs in Assembler composed by a number of consistent instructions, it is


very difficult to build up the sequence of necessary instructions in manual mode, counting the
related addresses especially to the jump instructions, in the table control etc.
With the MACROASSEMBLER program, which translates the mnemonic representations of the
instructions into their equivalent hexadecimal language, it is possible to generate an even more
complex program that can be run directly on the module Z3.

The necessary phases are the following:

1) With the EDITOR program included into the development software, the list of instructions
constituting the program is composed in Assembler language. The programs of EDITOR kind
facilitate the insertion, change and possible erasing of the instructions of the whole program.
Usually, to make the insertion of the files name easier, the program name extension is ASM.
To create new programs it is convenient to start from one of the already provided developed
programs; with the EDITOR program integrated into the development software, it is sufficient to
insert only the particular data and instructions, as there are already parts with standard directions.

The standard structure is practically the following:

MEM_POS = 0800H
DS SEG = 0080H
IWAITMS = ODH ; interrupt wait
IBUZZER =10H ;interrupt buzzer command
IPARAL = 12H ;interrupt parallel control
IVIS = OBH ;interrupt LCD DISPLAY

CODE SEGMENT
ASSUME CS:CODE, DS:CODE
ORG OH
START: MOV AX,DS_SEG,
MOV DS,AX ;charge data segment
(Insert the useful program here)

DEC_Name PROC NEAR ;Dec_Name procedure

(Insert the SUBROUTINES here e.g. Dec_Name)


RET

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 68 An-najah National University


Microprocessor Lab
APPENDIX A: Use of the application modules with module Z3/EV

DEC_Name ENDP

CODE ENDS END


START

According to the specific program, the list of the Interrupt mnemonics that are used and the used
number of Subroutines can be changed.

The development program menu has the following selections:

2) Once the program in Assembler and the name with extension.ASM are created or changed,
select the icon Asm for compiling. The compiling is carried out in DOS automatically. If there
are syntax errors the following message is shown:

0 Warning Errors
0 Severe Errors
An object file is generated, with extension .OBJ. If there are syntax errors, the related error
messages are displayed with reference to the editing line where they are; (any key must be pressed
to return to the program normal ambient)

3) The related addresses of the program generated by the compiler must be specified with a linker
program. This operation is carried out selecting the icon Link on the file with extension OBJ
obtained across point 2.
The icon Bin must be selected (Exe2bin.exe is entered and a 512-bytes file without preamble is
created).
In this way an executable program is obtained with extension.EXE that can be transferred into the
module Z3/EV.
The communication with the Personal Computer and the module Z3 occurs through the serial line
RS232 and using a proper supplied cable (HALF MODEM):

Personal Computer Z3/EV


1 9
2 3
3 2
4 6
5 5
6 4
7 8

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 69 An-najah National University


Microprocessor Lab
APPENDIX A: Use of the application modules with module Z3/EV

The transmission is controlled by two programs, one for the transmission


of the program developed by the Personal Computer to the module Z3/EV
integrated into the development software and the other for the reception of
the same program by the module and for loading the sequence of
instructions into the proper zone of the RAM.

4) Select the serial TX icon in the development program menu. The


following selection is shown:

Select a Baud rate value of 9600.

5) Connect the serial cable between the PC and the module Z3/EV

6) In the module Z3/EV, select the LD-SER/6 key. The module enters
automatically a reception program of the files coming from the PC.

7) Select OK in the selection panel across point 4.

8) For the whole duration of the PC transmission the display of the module
Z3/EV shows this message:

Load Ser.: wait

If the program is received properly in the module Z3/EV, this message will
be shown:

TXend, chr:XYZ

where XYZ indicates the length in bytes of the specific transmitted file.

The file is memorized on the address 0000:0800 of the RAM of the module.

By Dr.Hanal Abuzant and Eng.Asmaa AfifiPage | 70 An-najah National University


Microprocessor Lab

APPENDIX A: Use of the application modules with module Z3/EV

Carry out the connection between the Ports A and B of the module Z3/EV and the used
moduleF04-X/EV and check that the module F04/EV is powered .
9) In the module Z3/EV select the RESET key and then RUN/8 to run the program.

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 71 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 72 An-najah National University


Microprocessor Lab

Appendix B: DESCRIPTION OF THE ELECTRICAL DIAGRAMS

o POWER SUPPLY

o 32 BIT MICROPROCESSOR

o MEMORY UNIT

o BINARY I-OUT A-D D-A COVERTER

o STRAIN GAGE AND TEPERATURE SENSOR

o ULTRASONIC TRANSMITTER AND RECEIVER

o DC MOTOR WITH OPTICAL ERVOLUTION SENSOR

o STEPPER MOTOR CONTROL

o CONTROL WORD 8255

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 73 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 74 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 75 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 76 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 77 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 78 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 79 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 80 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 81 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 82 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 83 An-najah National University


Microprocessor Lab

By Dr.Hanal Abuzant and Eng.Asmaa Afifi Page | 84 An-najah National University

Potrebbero piacerti anche