Current location - Quotes Website - Personality signature - Who can give me an experimental lecture on the principle of computer composition?
Who can give me an experimental lecture on the principle of computer composition?
Experiment 1 of AEDK experimental instrument in ISA bus configuration mode

Interface technology and programming environment of the implementation

First, the experimental purpose

1, familiar with the interface technology and programming environment realized in ISA bus configuration mode of AEDK experimental instrument. And understand the other two: single board computer configuration mode and serial port monitoring configuration mode.

2. Learn to expand new interface chips outside PC through 60-core bus, driver, decoder, etc.

3. Understand the programming method of programming control programmable interface.

Second, the test equipment

Hardware: PC compatible machine

AEDK experimental instrument

Software: operating system MS-DOS or WINDOWS.

MASM .. the extension of the executable program.

LINK.EXE's debugging and editing editors.

Third, the experimental content

1, review the relevant contents of assembly language and microcomputer principle, and understand the addressing methods of bus and port addresses (unified addressing and independent addressing). Familiar with the method of generating CS signal.

2. Master the methods of editing, assembling, linking and debugging programs in assembly language. Proficient in the command and use of debugging programs.

3, familiar with the structure of the experimental instrument panel, master the principle, in order to better use and do a good job in development.

Four. Requirements and instructions

1, abide by the rules and regulations of the laboratory, and take good care of the experimental instruments (the method of signing and recording the man-machine check number);

2. Achievement composition: Usually, experiments and reports account for 70%, exams account for 65,438+00%, and the use, management and recycling of experimental instruments account for 20% (in order to cultivate a good experimental style, the total score will be deducted from the first error warning with 65,438+00, 20 and 40 points);

3. In this experiment, 8253 counter/timer is used, and the port addresses are 200H, 20 1H, 202H and 203H, corresponding to COUNT0, COUNT 1, COUNT2 and control ports.

Verb (abbreviation of verb) assembler structure

data field

.

.

.

ed

code segment

Suppose CS: code, DS: data.

Start:

.

.

.

End of code

End start

Six, the source program generation steps

1. Edit the source program with an editor.

C> edit the file name. ASM (file name defined by user)

2. Use the macro assembler MASM to assemble the source program and generate the target program.

C & gtMASM file name. air-to-ground/air-to-surface guided missile

If there is no error after assembly, proceed to step 3 in sequence; Otherwise, repeat step 1-2 to record and analyze the cause of the error.

3. Use Linker Link

C> link file name. OBJ (extension. OBJ can be omitted)

4. Debug the program with the debugger.

C> debug file name. Extensions of executable programs

Pay attention to observe and record various phenomena during debugging.

5. Connect the hardware correctly, instruct the teacher to check the circuit connection, turn on the power switch of the experimental instrument and run the program. Using DEBUG to run in a single step, observe and record the phenomenon and state of chip selection signal CS of bus signal interface chip when executing input, output, memory-register transfer and register-memory transfer instructions. (It is recommended to draw a waveform diagram)

Seven. Reporting requirements

1, talk about constructive suggestions on this experimental course, views on teaching methods and the goals you want to achieve;

2. Designated topics or better experimental schemes such as 8253, 8255, 825 1 8259, A/D, D/A can be done in the experimental class. How to treat this kind of teaching reform?

Experiment 2 8253 Timer/Timer

First, the experimental purpose

1. Further learn to expand new interface chips outside PC through 62-core bus, driver, decoder, etc.

2. Master the programming principle of 8253 counter, and observe the waveform or frequency relationship in different modes with oscilloscope or LED.

Second, the test equipment

Hardware: PC compatible machine

Microcomputer experimental instrument

oscilloscope

LED3

Software: operating system MS-DOS

MASM .. the extension of the executable program.

LINK.EXE

Third, the content of the exam

1. Use 8253 to form a square wave generator and a frequency divider to complete the connection as shown in the figure.

1 & gt; Connect the CLKO of 8253 with the frequency of 2.5 kHz-20 kHz (different instruments are different) output by one of Q0-Q3 terminals of the experimental instrument.

2>, OUT0 is connected to CLK 1, OUT 1 is connected to CLK2, and OUT0, OUT 1 and OUT2 are respectively connected to the LED anode.

3>, GATE0, GATE 1 and GATE2 are connected to +5v.

4 > Chip selection CS jack is connected to 200 h ~ 207 h D flip-flop and LED can be selected to detect the status of CS signal. See Experiment 1 for the connection mode.

2. To complete programming, set counters 0 and 1 to mode 3 (square wave) and timer 2 to mode 2 (frequency division). The output pulse of counter 0 is used as the clock input of counter 1, and the output pulse of counter 1 is used as the clock input of counter 2. Modify the initial counting parameters in the program, change the square wave width and frequency division signal period, observe the output frequency relationship of counters 0, 1 2 with LED, and draw the waveform of frequency relationship diagram.

Initial count value =F in/F out = T in/T out.

Fourth, programming skills

The address of the 1 and 8253 control ports is 203H.

The address of counter 0 is 200H.

The address of the counter 1 is 201h.

The address of counter 2 is 202H.

Control word of 2.8253:

3, program block diagram

Verb (abbreviation for verb) refers to the list of programs.

data field

TS DB' observe phenomena and record output waveform relationship', OAH, ODH,' $'

ed

code segment

Suppose CS: code, DS: data.

Start: MOV axe, data

MOV DS,AX

LEA DX,TS

MOV, 9

INT 2 1H

MOV DX,203H

MOV· Al, 36H

Output DX, AL

MOV DX,200H

MOV· al

Output DX, AL

Output DX, AL

MOV DX,203H

MOV· Al, 56H

Output DX, AL

MOV DX,20 1H

MOV· al, 8 years old

Output DX, AL

MOV DX,203H

MOV· Al, 94H

Output DX, AL

MOV DX,202H

MOV· al, 6 years old

Output DX, AL

MOV, 4CH

INT 2 1H

End of code

End start

Sixth, the test steps

1. Edit the source program with an editor.

C> edit the file name. ASM (file name defined by user)

Note: At the end of editing, you must save the established source program before quitting editing.

2. Use the macro assembler MASM to assemble the source program and generate the target program.

C & gtMASM file name. air-to-ground/air-to-surface guided missile

If there is no error after assembly, proceed to step 3 in sequence; Otherwise, repeat step 1-2 to record and analyze the cause of the error.

3. Use Linker Link

C> link file name. OBJ (extension. OBJ can be omitted)

4. Debug the program with the debugger.

C> debug file name. Extensions of executable programs

Pay attention to observe and record various phenomena during debugging.

5. Instruct the teacher to check the correct circuit connection, then turn on the power switch of the experimental instrument and run the program. Use DEBUG to run in a single step, and observe and record the phenomenon and state of the OUT terminal after each counter writes the working mode control word and the initial count value.

Counter 0 Counter 1 Counter 2

Working mode counting initial value output f or t Working mode initial value output f or t Working mode initial value output f or t

Execute the instruction OUT0 OUT 1 OUT2.

Note: record the waveform.

6. Discussion and improvement

1 & gt; Please change the working mode control word in the source program and count the initial value, and observe and analyze the running results.

2 & gtLED What is the difference between LED observation and CRT observation? Why?

3> tried to design the physical counting device of the production line with a pair of infrared emitting and receiving tubes and 8253 counter, and sent the collected data to CPU for processing.

4> put forward some suggestions to improve the experiment.

Experiment 3 8255 Parallel Interface (Keyboard Control) Experiment

First, the experimental purpose

1. Learn how to expand I/O interface in PC system. Master the programming principle of 8255 parallel interface and realize the flexibility and convenience of programmable interface design.

2. Understand the structural characteristics of non-coding keyboard, and learn the programming method and hardware structure of scanning and reading keyboard key values and displaying them on CRT.

Second, the experimental equipment

Hardware: PC compatible machine

Microcomputer experimental instrument

The software is the same as experiment 1.

Third, the experimental content

1. Use 8255 parallel interface to control a keypad with 16 key (line scanning method or inversion method can be used), and connect according to the diagram:

1 & gt; Connect PA0—PA7 to jacks RL0—RL7 with wires to control keyboard row data.

2> connect PB0 and PB 1 to jacks Y0 and Y 1 with wires to control keyboard column data. Unplug all short-circuit bushings on K 10.

3>, choose CS connection 2 18h-2 1fh.

2. Write a program. When running the program, the keyboard will hand over control. After pressing the key on the keyboard, the computer screen will display the read key name. When the keyboard presses "F", it returns to DOS, and the keyboard resumes control.

Fourth, programming skills

1, identify the closed keys on the keyboard, usually by line scanning or inversion.

Line scanning makes one line on the keyboard low and the other lines high. Then read the column values, if one of the column values is low level, it means that the key at the intersection of the column and the row is pressed, compare the column value+row value = key value with the key value table stored in the cache, and then find out the character corresponding to the key name and display it on the microcomputer screen or return to DOS;; Otherwise, scan the next line until all lines are scanned.

The line inversion method connects the line to the parallel port and works in output mode. The column line is connected to another parallel port and works in input mode. This program makes the CPU send a low level from the output port to all the row lines, and then read in the values of the column lines. If you press a key at this time, it will definitely make a column of rows have a value of 0. Then the program sets the mode of two parallel ports, so that the row line works in the input mode and the column line works in the output mode, outputs the column line value just read from the parallel port connected with the column line, and then reads the input value of the row line. Then, due to the key pressure on the line where the key is turned off, the line value must be 0. Therefore, when a key is pressed, a pair of unique key values (column value+row value) can be read.

2. When programming, the key name of each key can be defined by the user, and the key code (column value+row value) corresponding to each key is determined by the interface arrangement. Line sum

The number of intersections of columns is the number of keys, and both key names and key values are stored in the key table of the data segment. The program determines which key was pressed by looking up a table.

Verb (abbreviation of verb) refers to the program list (reverse method)

data field

Tables DW 0 10 1H, 0 102H, 0 104H, 0 108H, 010h, 010h.

DW 020 1H,0202H,0204H,0208H,02 10H,0220H,0240H,0280H

Character database' 89ABCDEF0 1234567'

TS DB' Press any key on the keyboard, it will be displayed on the CRT, and press F key, the program will push out', 0DH, 0AH,' $'.

ed

code segment

Suppose CS: code, DS: data.

Main process is far away

Start: MOV axe, data

MOV DS,AX

LEA DX,TS

MOV, 9

INT 2 1H

KY: call key

CMP DL,' F '

JNZ KY

MOV, 4CH

INT 2 1H

Soak in water to soften

Main ENDP

The key is approaching.

INI: MOV DX,2 1BH

MOV· Al, 82H

Output DX, AL

Wait 1:MOV DX, 2 18H

MOV· al, 0

Output DX, AL

MOV DX,2 19H

In Al, DX

MOV, al

And AL, 03H

CMP aluminum, 03H

JZ wait 1

MOV· al, ah

MOV, 0

Push axe

Push axe

MOV CX, 1000H

DLY: ring DLY

MOV DX,2 1BH

MOV· Al, 90H

Output DX, AL

MOV DX,2 19H

Bangalore torpedo

Output dx, al

MOV DX,2 18H

In Al, DX

Pop bx

MOV, BL

Not Al.

MOV SI, offset table

MOV DI, offset character

MOV CX, 16

Skip: CMP AX, [SI]

JZ·DISP

December CX

JZ ini

Add SI, 2

Company DI

JMP· skip

DISP:MOV

MOV, 2

INT 2 1H

Push DX

MOV DX,2 1BH

MOV· Al, 82H

Output DX, AL

Wait 2:MOV DX, 2 18H.

MOV· al, 0

Output DX, AL

MOV DX,2 19H

In Al, DX

And AL, 03H

CMP aluminum, 03H

JNZ Wait 2

Popular DX

Soak in water to soften

Base ENDP

End of code

End start

Sixth, the experimental steps

1. Edit, assemble, link and debug the source program.

2. Connect the circuit correctly, and turn on the power only after the teacher checks and confirms that it is correct.

3. Run the program and measure the states of PA0—PA7 and PB0-Pb1with LED respectively. Observe and record the experimental phenomena.

Keyboard: When there is no key, a key is pressed.

Pa0-pa7pb0-pb 1 key name pa0-pa7pb0-pb 1

Keyboard:

4. Discussion and improvement

1 & gt; What is the phenomenon of measuring PA0—PA7 with LED, and why?

2 & gtLED What is the difference between PB0 and PB 1 measured by LED with or without buttons? Why?

3> Can I use the keyboard when the keypad is active? If you press 16 times on the keyboard, please record what happens to the CRT.

4> 16-bit key can be controlled by 8-bit port A and 2-bit port B. If 8255 interface is selected, how many keys can be controlled by group A 12 and group B 12? Can 8255 control 104 standard keyboard?

5> Annotate each module of the source program and draw the flow chart.

Experiment 4 8259A Interrupt Controller Experiment

First, the experimental purpose

1, master the working principle of 8259A interrupt controller, and be familiar with the usage of interrupt mask register IMR and interrupt service register ISR in 8259A involved in the experiment.

3. Master the introduction of external interrupt sources and learn to write interrupt handlers.

Second, the experimental equipment

Hardware: PC compatible machine

Microcomputer experimental instrument

The software is the same as experiment 1.

Third, the experimental content

1. Using positive and negative monopulse as external interrupt source, interrupt requests can be generated randomly (or timed external interrupt requests can be generated by 8253 counter). Interrupt request is input to internal 8259 through IRQ2 terminal of PC/XT 62 core bus, and 8259 sends an INTA signal to the bus. After the bus responds, the INTA response signal is given. Switch to the interrupt service program.

2. Write a program that requires the host to start the 8255 parallel interface every time it responds to the external interrupt IRQ2. The 4-bit signal input to the button switch group is collected by PC7-4, and output from PC3-0 to four led displays. Select the button switch combination before each interrupt request, and after the interrupt response, LED displays the status of the combination switch. After ten interruptions, the program exits.

Fourth, programming skills

1. The 8259A chip in PC is used in this experiment. When the host is started, the first 5 bits of the 8259A interrupt control register have been initialized to 0000 1. Therefore, the interrupt number of IRQ2 is 000 10 10b = 0ah, and the interrupt number of IRQ5 is 000 168. The host computer reserves IRQ2 for users, and other external interrupts are occupied by the system clock, keyboard, etc. Therefore, avoid the interrupt request number that the system has used when programming. Just clear the bit corresponding to IRQ2 in the IMR register (make ICW3 =11111b), remove the interrupt mask of IRQ2, and allow IRQ2 to interrupt.

2. 8259A in 2.PC is initialized to normal end mode. When the external interrupt ends, the corresponding bit in the interrupt service register ISR must be cleared by using the interrupt end command. (MOV AL,20H OUT 20H,AL OCW2=00 100000B).

3. When the program exits, close the IRQ2 interrupt and set the corresponding position in the IMR to 1 (make ocw1=1111/.

3. The address of 8259A port in 3.PC system: even address 20H, odd address 21h..

Verb (abbreviation for verb) refers to the list of programs.

data field

TS 1 dB' press the single pulse key in combination with the button switch setting code, observe the LED display, and pay attention to the rising edge or falling edge trigger', 0DH, 0AH,' $'

Ts2db' parallel interface 8255 C collects data and displays it, please observe and record it',' $'

ed

code segment

Suppose CS: code, DS: data.

Start: MOV AX, CS

MOV DS,AX

LEA DX,INTPROG

MOV, 25H.

MOV· Al, 0AH

INT 2 1H

Coin indicator (short for coin-levelindicator) command line interface for batch scripting.

MOV DX,2 1H

In Al, DX

There is also AL,111101b.

Output DX, AL

MOV BX, 10

MOV SI,004 1H

Sexually transmitted infection

MOV axe, data

MOV DS,AX

LEA DX,TS 1

MOV, 9

INT 2 1H

YY: NOP

JMP·YY

INTPROG:

MOV axe, data

MOV DS,AX

LEA DX of TS2

MOV, 9

INT 2 1H

MOV·CX,05H

MOV DL,20H

MOV, 2

XH0: INT 2 1H

Cycle XH0

MOV DX,SI

MOV, 2

INT 2 1H

MOV DL,0DH

INT 2 1H

MOV DL,0AH

INT 2 1H

MOV DX,2 1BH

MOV· Al, 88 hours

Output DX, AL

MOV DX,2 1AH

In Al, DX

MOV CL,4

Roald, CL

Not Al.

Output DX, AL

MOV DX,20H

MOV· Al, 20H

Output DX, AL

December BX

JNZ, go on

MOV DX,2 1H

In Al, DX

Or AL, 04

Output DX, AL

Sexually transmitted infection

MOV, 4CH

INT 2 1H

Continue: company SI

IRET

End of code

End start

Sixth, the experimental steps

1. Edit, assemble, link and debug the source program.

2. Connect the circuit correctly, and turn on the power only after the teacher checks and confirms that it is correct.

3. Run the program. After CRT displays the prompt, select the code of the combination button, press the plus button, observe the display of CRT and the code of PC3-0 displayed by LED, and analyze whether the rising edge or falling edge of INTR signal is valid. Observe and record the experimental phenomena. How to detect?

4. Observe whether the interrupt request register IRR of the 8259A interrupt controller has the function of recording interrupt requests. How to prove it?

Experiment 5 Direct DMA Transfer from Memory

First, the experimental purpose

1. Understand the working principle of DMA and the usage of DMA controller 8237a-5.

2. Master DMA data transmission by programming in PC environment, and understand DMA working sequence.

Second, the experimental equipment

Hardware: PC compatible machine

Microcomputer experimental instrument

The software is the same as experiment 1.

Third, the experimental content

1. Write a program to send the contents of PC memory 60000h-6 1FFH to the external memory 62256 of the experimental instrument through DMA reading, and then write back to the area of 70000-7 1FFH through DMA writing.

2. Use 74LS 154 integrated 4D flip-flop to detect the states of DREQ and DACK signals.

3. Fill the storage area of 60000h-6 1fffh with debugging program. After DMA operation, read out the data in the area of 70000h-7 1fffh, and check whether there is any error in the sent data.

Fourth, the description of the experiment

1. In this experiment, the DMA controller in PC is used, and some agreed conditions of PC must be observed:

DMA controller 8237-A is in PC system. Of the four DMA channels, channel 0 is used for RAM refresh (refresh request signal is generated by the 8253 counter channel 1 in the system, once every 15. 13 microseconds), channel 1 is reserved for users, channel 2 is used for floppy disk data transmission, and channel 3 is used for hard disk data transmission. The addressing range of 8237-A is 00H—0FH, and the page address of the corresponding channel 1 is 83H.

When the PC BIOS is initialized, the control register is set to 00H, that is, DREQ is active at high level, DACK is active at low level, the priority is fixed, the timing is normal, and there is no extended write mode. All four channels abide by this convention, so it is suggested that the contents of the control register need not be set to avoid system setup confusion.

2. When using DMA, you should pay attention to:

1 & gt; Make sure that the RAM refresh of channel 0 runs normally, otherwise it will crash. For the three DMA transfer modes, only single-byte transfer mode is supported in PC environment, and the other two modes crash because they occupy the bus for too long, resulting in the failure to refresh the RAM in time. The fixed priority mode is set in the system to ensure the priority of dynamic RAM refresh. Since the ROM—BIOS has used channel 0 for dynamic RAM refresh, and the user cannot change it, although channel 0 and 1 have memory-to-memory DMA transfer functions, the PC does not support memory-to-memory DMA transfer.

2 > The software request mode corresponds to the block transfer mode. In order not to affect the RAM refresh, direct transfer mode is recommended. When transmitting multiple bytes, it should be realized by loop program.

2. Short-circuit sleeves JP0, JP 1, JP2, JP3 and JP4 jump to the DMA side (left side), and K 1 1 2 are dialed to the DMA side, and the HALT key is also used as a DMA button.

3. The bus signals DREQ 1 and DACK 1 are connected to the S terminal and the R terminal of the D flip-flop respectively, and the Q terminal is connected to the LED.

Verb (abbreviation for verb) program list

data field

Ts1db' press DMA(HALT) key, and request to directly transfer 32KB data in the memory source data area to the external memory 62256 (as a peripheral), and observe the signals of DREQ 1 and DACK 1 displayed by the LED. ’,0DH,0AH,' $ '

Ts2db' Press the DMA(HALT) key to request that 32KB data in the external memory 62256 (as a peripheral) be directly transferred to the memory target area, and observe the signals of DREQ 1 and DACK 1 displayed by the LED. ,0DH,0AH,' $ '

Direct transmission of Ts3db' DMA is completed. Please enter DEBUG and use D command to check whether the 32KB data in the memory target area is correct', 0DH, 0AH,' $'.

ed

Stack segment

STA DW 50 DUP(? )

Top EQU length STA

End of stack

code segment

Suppose cs; Code, DS: data, SS: stack, ES: data.

Start: MOV axe, data

MOV DS,AX

MOV axe, stack

MOV SS, axe

MOV SP, top

MOV· al, 5 years old

Get out, Al; Set the channel 1 mask word

OUT 0CH,AL; Clear sequence trigger

MOV El, 0 100 100 1B

OUT 0BH,AL; Set the mode word to single byte read transmission.

MOV·BX, 0000 hours

MOV L.

Out of 02H, aluminum

MOV Ltd.

Out of 02H, aluminum

MOV· Al, 06H

OUT 83H,AL; The starting address is 6000h: 0.

MOV· al

OUT 03H,AL

MOV Al, 07FH

OUT 03H,AL; The number of bytes transmitted is 7FFFH(32KB).

Moval, 0 1H

Get out, Al.

LEA DX,TS 1

MOV, 9

INT 2 1H

Push axe

Bangalore torpedo

Wait 0: In aluminum, 08H

And aluminum, 02H.

JZ waits for 0

MOV· El, 05H

Get out, Al; Set the channel 1 mask word

OUT 0CH,AL; Clear sequence trigger

Moval, 0 1000 10 1B

OUT 0BH,AL; Set the mode word to single byte write transmission.

MOV L.

Out of 02H, aluminum

Out of 02H, aluminum

MOV· Al, 07H

OUT 83H,AL; The destination address is memory 7000h: 0.

MOV· al

OUT 03H,AL

MOV Al, 7FH

OUT 03H,AL; The transmission byte is 7FFFH(32KB).

MOV El, 0 1

Get out, Al; Remove the mask of channel 1.

LEA DX of TS2

MOV, 9

INT 2 1H

Push axe

Bangalore torpedo

WAIT 1: In AL, 08H.

And aluminum, 02H.

JZ wait 1

LEA DX of TS3

MOV, 9

INT 2 1H

MOV, 4CH

INT 2 1H

End of code

End start

Sixth, the experimental steps

1. Edit, assemble, link and debug the source program.

2. Connect the circuit correctly, and turn on the power only after the teacher checks and confirms that it is correct.

3. Enter the DEBUG, run the d command to check the data within the range of 6000 h: 0000-6000 h: 7 fffh, and fill in the data within this range with the f command. Then use the d command to check whether the area is filled with data.

4. Run the program, press the pause key to request DMA transmission according to the program prompt, and observe the states of DREQ 1, DACK 1, MEMR and IOW signals. The data in the memory is transferred to the external expansion memory 62256.

5. According to the program prompt, press the HALT key again to request DMA transmission, and observe the states of DREQ 1, DACK 1, MEMW and IOR signals. The data in that external expansion memory 62256 is transfer to the memory.

6. Enter the DEBUG and run the d command to check the data in the range of 7000h: 0000—7000h: 7FFFH, and compare it with the data in the source data area to see if there is any error. If yes, please analyze the reasons.

Experiment 6 Communication Experiment of 8251Programmable Serial Interface

First, the experimental purpose

1, master the chip structure, working principle and initialization programming of 825 1.

2. Understand the hardware environment, data format protocol and data exchange protocol of serial communication.

3. Learn the programming method of PC communication.

Second, the test equipment

Hardware: PC compatible machine

Microcomputer experimental instrument

4 LED4 4

74LS74 or 74LS 175 IC 1 chip

Software: operating system MS-DOS

MASM .. the extension of the executable program.

LINK.EXE

Third, the experimental content

1. Edit, assemble, link and debug the assembler. By initializing 825 1, data formats and data exchange protocols such as serial transmission character frame format and baud rate factor are set.

2. Programming with query method, inputting data from keyboard, automatically receiving 825 1, observing the serial transmission of 825 1 and displaying the transmitted data on CRT.