Anda di halaman 1dari 12

AAMP5273 EMBEDDED SYTEMS DESIGN LABORATORY

INTEL 8088 MICROPROCESSOR SYSTEM DESIGN

Date: 19/8/1999 By: Lam Wai Hang ME3 (A)

Experiment Introduction: The experiment required us to build a traffic light control system like experiment 1 using 8088 Intel system. The basic idea of the system is basically same as experiment 1 but it only used different component, e.g.: used PPI of Intel instead of PIA of Motorola, used of 8088 instead of 6809, etc Problem description: It is required to control a set of traffic lights at crossroads between a main road and a side street. The following sequence for the light control is operated continuously unless an interrupt is detected from either of the two sensors located in the side street.

Normal sequence table: Sequence no: Main Side Time duration (sec) 1 Green Red 20 2 Amber Red 2 3 Red Red and Amber 2 4 Red Green 5 5 Red Amber 2 6 Red and Amber Red 2 If an interrupt occurs from a side street sensor during the first 15 seconds of the Main lights at Green (i.e. sequence 1) the lights are to remain as set for a further 5 seconds and then change. The program is to control this system by polling the sensor inputs. System Hardware Analysis The traffic lights are simulated using LEDs. The LEDs are buffered to port using TTL 7406 open-collector inverters. Logic high written to the selected bit at port will force that buffer output low and forward bias the LED. A limiting resistor of 150

limits the diode currents to 20mA. Sensor inputs are simulated using two debounced push-to-make biased switched. When the switch is operated, the RS bits table is reset when the switch returns to its biased position. The function of the sensors is to indicate any build up of the traffic in the side street and allow smooth flow. In practice the sensors would be pressure pads or Doppler radar, arranged with suitable counting circuits so that a signal can be sent to the controller when the vehicles waiting exceed a certain number. This counting could be done by software with relatively simple modification to the program. This times, instead of using 6821 PIA, we use 8255 PPI for interfacing the LED and the push button inputs. The connection are shown as below:

System Specification The specification of the Intel 8088 microprocessor-based traffic light control system is as below: Microprocessor unit MPU Project Board Intel 8088(MHS) Dimension: 16x17.5 cm

Power Requirement MPU System Board: +5V,1.0A The other components that are needed to implement this system are listed below: Resistor 1 x 10k 7 x 150 2 x 510 6 x low powered LEDs 1 x IN4001 1 x 0.1 F 1 x 12pF 1 x 4.7 F 1 x 14.31818Mhz 1 x Intel 8088 Microprocessor 1 x D8255AC-2 (NEC 8742P5023) 1 x 74LS245 (Goldstar GD74LS245) 2 x 74LS373 (SN 84LS373N XXAA9145) 3 x 74LS06 inverters 1 x 8284 (AMD P8284A 8744DP) 1 x personal computer 1 x EPROM emulator 1 x project board 1 x breadboard Wires

LED Diode Capacitors

Crystal oscillator ICs

Miscellaneous

System I/O Specification T1 - Side street sensor, connected to CA1 or CB1, an on state will enable the sensor. O1 Main Street LED, connected to PIA port A, high enable. O2 Side street LED, connected to PIA port B, high enable.

Procedure At first we construct the circuit shown in Figure, then we connect up the LEDs peripheral white board (constructed in experiment 1) to the PPI correct pins. After the construction we do some testing and debugging on the circuit, we spot some diagram error in the schematic diagram of manual and also the hardware part (PPI) connection is

contradict with the software address. After finished the testing, we connect up the missing PPI wiring (A0 and A1) and decide not to change any more with the circuit, so we made the change in the software to cope with the circuit. We also found that there are many failed 8088 CPU in the lab, after all the testing, we concluded that all of the 8088 chips with shinny surface are remarked chip, it is actually a 8155(peripheral interface with timer and Ram) chips. Many others 8088 chips can be operated in 2x-clock speed which need to change another type of 8284 clock generator. After finished with the hardware part, we try to write the traffic light program, besides the PPI address problem, we also indeed spot a minor error in the program that will cause the whole system stop functioning. After downloading the corrected program, everything works just fine and that was really an easy experiment with the aid of first experiment experience. The experiment is simple except the error part lead people to wasted some time on it. We manage to spot the error easily because we read the notes and compare the notes diagram with our manual one, the notes one provide a correct version of diagram, so we manage to become the first group to spot out the errors and finish with the experiment.

Discussion Hardware Introduction: Compare with the 6809 system, this 8088 system look more complicated, but actually it is quite simple also. The 8088 CPU doesnt have internal clock signal

generator, so it need an external 8284 to generate the clock signal, this has a benefit of letting many CPU or devices sharing the same clock signal. Since the 8088 data bus and address bus are combined together, so we need a latch to address or data, to differentiate between them. We use 74LS373 and connect its LE line to the 8088 ALE line, when ALE is high, it will latch and hold the address until ALE is low. The 74LS245 (8-bit data transceivers) used as a direction selector, its DIR line is connected to 8088 DT/R line, and its OE line is connected to 8088 DEN line. This is used to control the transceiver that determines whether we need to use external program memory and the direction of data transmit/receive. 74LS373 used as a latch for the address line, it also function as data/address line separator. And the EPROM used to store our program and PPI as interfacing devices. 8284 clock generator: This clock generator is used to generate clock signal to 8088, 8086 processors, 82C64A-5 can generate 5MHz clock frequency and 82C84A generate 8 MHz clock frequency. The crystal frequency is three times the desired processor clock frequency. So in our experiment, since we used a 14.3 MHz crystal and 82C64A-5 chip, so we would expect to get a 4.77MHz clock frequency. If we want a 8MHz clock frequency, we should use 82C84A with a 24MHz crystal and the connection should slightly modified as below diagram:

8088 Intel Microprocessor: There are type of clock rates can be used in the 8088, which is 5MHz for 8088 and 8MHz for 8088-2, in our experiment we used 5MHz for 8088. If we want to used 8MHz clock frequency, we should only changed the use another 8284 clock generator with 24MHz crystal as shown in the 8284 part above, we dont have to change the 8088

since all 8088 in our lab support both clock frequency. The 8088 data and address sharing the same line, it can be differentiate by the ALE line, when ALE=1, the line is occupied by address, when ALE=0 the line occupied by data. So we need a latch (74LS373) to separate them out. The /WR and /RD is separated out (differ from 6809), because it may have some internal processing which is not read or write. All the interrupt line is connected to ground (disable) in our experiment because we do not use any hardware interrupt at all. IO/M is used to separate out the I/O devices address and memory address. So we have set of decoding circuit to decode the IO/M, /WR, /RW into /MEMW, /MEMR, /IOW, /IORD which is read/write for I/O and memory devices. The 8088 microprocessor has 20 address bus (AD0-AD19) which can address up to 1M location of memory space that is from $00000 to $FFFFF in term of hexadecimal address value. The function of the address will allow the microprocessor to select and activate any interfacing device or memory in the system. 2764 EPROM emulator: The overall decoding location for EPROM is $C0000-$FFFFF, but since 2764 EPROM only used A0-A12 address, but it can only accept $x000-$xFFF where x=1,3,5,7,9,B, D, F, which only is 8K EPROM, it means that location $1000, $3000, $5000. are all sharing the same memory location. Since the reset instruction of 8088 is at FFFF0, in order to match with the specification, we need to use address $E000 - $FFFF which is 8K in EPROM. Since the reset instruction is set at FFFF0, so the AD18 and AD19 is set when it first access the location, therefore the /CE line of our EPROM is always enable, and we do not need to set it in our program since it is set when accessing the program and will not change. Since we are using EPROM emulator to emulate the real 2764, so we have to beware that the address in emulator $0000-$1FFF represent the system address $E000$FFFF. 8255 PPI: The PPI stands for programmable Peripheral Interface. It is a 40-pin large-scale integrated circuit (LSI) designed to control parallel data transfer between the 8088 system

and external device. PPI is used to transfer data or commands when the equipment to be controlled is nearby and the lines are easily accommodated. It is a dual input/output (I/O) unit, which has three ports namely A, B and C. Each of this ports states can be initialized as input or output by modifying the control register (CR). PPI registers are treated as a set of memory locations by the 8088 system. Before any data transfer takes place via the PPI, its control register must be set accordingly to determine the type of operation mode used and the direction of the data flow. This is known as initialization. For our experiment, the port A and port B are set to control the LED whew each of them individually represents a traffic light. CS is connected to the 74LS373 address latchs pin 15(Q5). Due to the reason that the 74LS373s pin D5 is connected to 8088s AD15, therefore the PPI decoding address is: XX.. 1..0 XXXX XXXX XXXX , or corresponds to physical address of $8000-$8FFF. The A1 and A0 on the PPI are connected to microprocessors A0 and A1 respectively. As a result, the control register address for port A=$8000, port B=$8001, port C=$8002 and control register=$8003. (We didnt change the PPI decoding circuit to match with the program, so instead we change the program to match with the circuit)

Software Analysis: CSEG ASSUME ORG ENTRY: CODES SEGMENT CS:CSEG, DS:CSEG, SS:CSEG, ES:CSEG 0100H JMP DB DB DB SHORT INIT 24H, 09H, 14H 12H, 09H, 02H 09H, 18H, 02H ;SEQ1 MAIN, SIDE, TIME ;SEQ2 ;SEQ3

DB DB DB * INITIALIZATION INIT:

09H, 24H, 05H ;SEQ4 09H, 12H, 02H ;SEQ5 18H, 09H, 02H, 04H ;SEQ6

MOV AL, 89H MOV DX, 8003H OUT DX, AL MOV AX, CS MOV DS, AX LEA SI, CODES AL, [SI] AL, 4H BEGIN SI, CODES AL, [SI] DX, 8000H DX, AL SI AL, [SI] DX, 8001H DX, AL SI CL, [SI] CL, 5H NEXT DX, 8002H AL, DX DX, DX DL, CL AL, 3H NEXT DL, 5H ;ASSIGN THE BASE ADDRESS CS TO DS. ;GET DATA STARTING ADDRESS. ;LOAD DATA TO AL. ;IS THE END OF DATA? ;NO.GO TO BEGIN ;LIGHT UP THE MAIN STREET LIGHTS.

MAIN:

MOV CMP JNZ LEA MOV MOV OUT INC MOV MOV OUT INC MOV CMP JL MOV IN XOR MOV AND JZ MOV MOV MOV DEC JNZ DEC JNZ

BEGIN:

;LIGHT UP THE SIDE STREET LIGHTS.

DELAY:

;IS LAST FIVE SECONDS? ;YES. GO TO NEXT. ;POLLING INTERRUPT OF SIDE STREET ;CLEAR DX ;THROUGH PORT C.

NEXT: SEC1: SEC2:

CL, 01H ;APPROXIMATE ONE SECOND DELAY BX, 0E000H BX SEC2 CL SEC1

DEC JNZ INC JMP ORG DB DW DW CSEG

DL DELAY SI MAIN 1FF0H 0EAH 0100H 0FE00H

ENDS END ENTRY Since the 8088 reset instruction is located at $FFFF0 to $FFFFF, so we need to

insert so starting instruction into that location, $FFFF0 relative to EPROM emulator is at $1FF0. So insert a line of instruction JMP FE00:0100H into that location, this instruction in Intel hex is EA 00 01 00 FE(the address is reversed because this is Intel structure, it like to read the data in reverse way, even now Pentium also behave the same way.). The reason we jump to $FE00:0100 not $FE00:0000 is because in our PC .com file cannot start at location, maybe $0000 to $00FF contain some information about the command file, we use TASM to compile the program into .com file. At the first part of the program, we set the CS, DS, SS and ES sharing the same location, actually when we really want to do it, we should separate them out. Since in our program the data also store at the program memory location, so we set CS and DS start at same location. The stack segment and extended segment doesnt have any effect in our program, so we also set them to the same location, this can neglect some unwanted problem. Since the program start at 0100H, so when we download the program, we should download it to starting location = 0100. Then the program follows by a jump over the codes table to INIT. The codes part contain our main, side street and delay time data, which is same as experiment one.

The PPI is first initialized by making Port A and Port B as output and port C as input (mode 0).The 8003H is control register since by accessing 8003H, we set A0 and A1 pin of PPI to on, this will indicate data bus -> control register.

In the MAIN part, the data in the table is loaded into Al (lower byte of the ACCA) consecutively and then compared to 4H to determine whether the end of the table is reached. Subsequently in the BEGIN part, the PPI port A and port B are accessed and then the main and side street lights will light accordingly. In the DELAY part, the port C is polled whether the switch gas been detected. This is done by masking the port C value with 2H through instruction AND. If a zero flag is set, thats means no interrupt has occur and the basic sequence is kept going. Else if the zero flag is not set, the DL register will be initialized to value 5 and the subsequent time for the traffic light is change to be change to 5 seconds. The basic idea of this program is quite simple, it can be shown in the program flowchart. There is a minor error on the instruction: CMP AL, 4H JNG LEA BEGIN SI,CODES

Since the JNG will let it program jump if al smaller or equal to 4, this will lead the program keep on repeat the first sequence. The 24H, 09H, 14H are all bigger than 4H, so it will not jump and reload the first sequence in next instruction(LEA SI,CODES). Therefore we need to make some changed to the program into:

JNZ

BEGIN

This will make jump if al not equal to 4H, and the whole can therefore function normally. The sequence can only be repeat if al = 4H. As I said, we make didnt make change in the circuit to correct the PPI decoding error because we make change in the software. Our PPI decoding is 800XH instead of 8XH, but how to output data to extended address? there is a little trick to do that: MOV MOV OUT E.g.: MOV MOV OUT AL,<data to be output> DX,<16-bit address to be access> DX,AL AL, 89H DX, 8003H DX,AL ;initialize PPI control register

This is indirect extended accessing method.

Conclusion:
In the first two experiment, we didnt use any hardware interrupt, the circuit doesnt have RAM for stacking purpose. These experiment basically not very hard, just the error part took us some time to figure it out. For easy debugging purpose, when we construct the circuit, we measure the appropriate distant between the ICs and used different color wire for different purpose line. 8088 assembly language is a basic for us to learn more advance assembly language for Intel chip(e.g:80386,80486), if we manage them good, we can even use them to write program for nowadays Win95 platform.(MASM 6.1x and TASM 5.0 provide this features)

Anda mungkin juga menyukai