当前位置:网站首页>Experiment 6 8255 parallel interface experiment [microcomputer principle] [experiment]
Experiment 6 8255 parallel interface experiment [microcomputer principle] [experiment]
2022-06-28 15:10:00 【Sun star moon cloud】
experiment 6 8255 Parallel interface experiment 【 Microcomputer principle 】【 experiment 】
Preface
The following contents are derived from the microcomputer principle experiment guide
For learning and communication only
Please read the article statement , By default, I agree with this statement
recommend
8255 Parallel interface experiment
3.2 8255 Parallel interface experiment
3.2.1 The experiment purpose
1、 master 8255A Parallel connection 1 The basic structure and working principle of the chip .
2、 master 8255A Operation mode 0 The characteristics and usage of .
3、 master 8255A The port of A Or port B Work in a way 1 The characteristics and usage of ; Master the way 1 Input or output port C Definition and function of pin used as contact signal .
4、 The method of solidifying and running the program offline .
3.2.2 Experimental content
1、 Basic input and output experiments . Programming , send 8255A Of A The mouth is the output ,B The mouth is the input , Complete the data transmission from the toggle switch to the data lamp . As long as the switch is turned , The display of the data lamp changes .
2、 Water lamp display experiment . Programming , send 8255 Of A Mouth and B All ports are output , Realization 16 Relative cycle display of bit data lamp .3、( Choose to do ) The way 1 I / O experiment . Programming , send 8255 Work in the way 1 Under control A I want to input ,B output .
3.2.3 Experimental principle
The parallel interface is based on the byte of data I/O Transfer information between devices or controlled objects .CPU Data transfer between and interfaces is always parallel . That is, it can be transmitted at the same time 8 position 、16 position 、32 I'm waiting for you .8255 The programmable peripheral interface chip is Intel The general parallel produced by the company I/O Interface chip , It has A、B、C Three parallel interfaces , use +5V Single power supply , Can work in the following three ways : The way 0– Basic input / Output mode 、 The way 1- Strobe input / output mode 、 The way 2- Two way strobe working mode .8255 The internal structure and pins of the are shown in the figure 3-2-1 Shown ,8255 Working mode control word and C The mouth is positioned according to the position / The format of reset control word is shown in the figure 3-2-2 Shown .


8255 The circuit diagram of the experimental unit is shown in the figure 3-2-3 Shown .
3.2.4 Experiment description and steps
1、 Basic input and output experiments
This experiment makes 8255 port A Work in the way 0 And as an output port , port B Work in the way 0 And as an input port . Use a set of switch signals to access the port B, port A The output line is connected to a group of data lamps , And then through the right 8255 Chip programming to achieve input and output functions . The specific experimental steps are as follows , Among them the first (4) Step to step (6) The step curing function can be selected as :
(1) The experimental wiring diagram is shown in Figure 3-2-4 Shown , Connect the experimental circuit diagram according to the figure .
(2) Write the experimental program , Compiled 、 Load the system after the connection is correct .
------------ Theoretical knowledge -----------
1、 Confirm the port address
IO Base address 0600H
XR1---A0
XR2---A1
Address range 600H~603H
port A Address :0600H
port B Address :0602H
port C Address :0604H
Control register port address :0606H
2、 Determine how it works
port A Work in a way 0, Basic output mode
port B Work in a way 0, Basic input mode
3、 Determine the control word
1 00 0 x 0 1 x
4、 Initializer
A EQU 0600H
B EQU 0602H
C EQU 0604H
S EQU 0606H
CODE SEGMENT
ASSUME CS:CODE
START:
; Set port A, The way 0 Output
; Set port B, The way 0 Input
MOV AL,10000010B
MOV DX,S ; Send control word
OUT DX,AL
NEXT:
; from B Read the switch status through the port
; Will be taken from B The switch state read by the port
; Send to port A Output
MOV DX,B ; read B The starting data sent by the port ,B I want to input
IN AL,DX
MOV DX,A ; Write A The starting data sent by the port ,A output
OUT DX,AL
; Press the no key
MOV AH,1
INT 16H
JNZ QUIT
JMP NEXT
QUIT:
MOV AH,4CH
INT 21H
CODE ENDS
END START
------------ Theoretical knowledge -----------
------------ Concrete practice -----------
8255 Parallel interface experiment
IOY0 EQU 0600H ;8255 Of CS Pin connection IOY0 Corresponding port start address
MY8255_A EQU IOY0+00H*2 ; ;8255 The port of A Address
MY8255_B EQU IOY0+01H*2 ;8255 The port of B Address
MY8255_C EQU IOY0+02H*2 ;8255 The port of C Address
MY8255_MODE EQU IOY0+03H*2 ;8255 Control register address of
CODE SEGMENT ; Define code snippets
ASSUME CS:CODE
START: MOV DX,MY8255_MODE ;8255 The control port address is 3006H
MOV AL,82H ; Set up 8255 Mode control word ,A、B How mouth works 0,A output ,B I want to input
OUT DX,AL
LOOP1: MOV DX,MY8255_B ; read B The starting data sent by the port ,B I want to input
IN AL,DX
MOV DX,MY8255_A ; Write A The starting data sent by the port ,A output
OUT DX,AL
MOV AH,1 ; Determine whether a key is pressed
INT 16H
JZ LOOP1 ; If there is no key, it will jump back to continue the cycle , If there is one, quit
QUIT: MOV AX,4C00H ; End program exit
INT 21H
CODE ENDS
END START
------------ Concrete practice -----------
(3) Run the program , Change the observation after the toggle starts LED Show , Verify program functions
(4) Click on “ debugging ” In the drop-down menu “ Curing process ” term , Solidify the program into the system memory
(5) take 386EX Short circuit jumper of single board computer system JDBG Every control to RUN End , Then press the reset button , Observe whether the program works normally ; Turn off the power supply of the test box , After a while, open the tester again , See whether the solidified segment sequence is running , Verify program functions
(6) After the experiment , Please place the short-circuit jumper DRG The short-circuit block of is short circuited to DBG End , To facilitate the next online experiment .
tip :I386E CPU The single board computer supports online debugging mode and offline independent operation mode . The switching between the two modes is through I386EX CPU The short-circuit jumper at the lower substrate at the lower right corner of the single board computer unit JDBG To achieve , The short circuit block is short circuited to DBG When ,CPU In online debugging mode with the software , In this mode , Through the software industry, we can find CPU Download the program , Single step 、 The breakpoint 、 Continuous operation and other commissioning , Through the curing function menu , Can be loaded into CPU The solidified program in the memory of a single board computer goes to FLASH In the memory . After curing , Short the short-circuit block to RUN files , And reset or power on ,CPU Will start FLASH The program in memory runs independently , here I386EX CPU The single board computer works in the offline independent operation mode

2、 Water lamp display experiment
send 8255 Of A Mouth and B All ports are output , Data lamp D7 ~ D0 From left to right , Only one light at a time , Cycle show ,D15~ D8 And D7~D0 Just the opposite , From right to left , Only one light at a time , Cycle show . The experimental wiring diagram is shown in Figure 4.3.5 Shown . The experimental steps are as follows :
(1) According to the figure 3-2-5 Connect the experimental circuit diagram .
(2) Write the experimental program , Compiled 、 Load the system after the link is correct .
------------ Theoretical knowledge -----------
1、 Confirm the port address
IO Base address 0600H
XR1---A0
XR2---A1
Address range 600H~603H
port A Address :0600H
port B Address :0602H
port C Address :0604H
Control register port address :0606H
2、 Determine how it works
port A Work in a way 0, Basic output mode
port B Work in a way 0, Basic output mode
3、 Determine the control word
1 00 0 x 0 0 x
4、 Initializer
A EQU 0600H
B EQU 0602H
C EQU 0604H
S EQU 0606H
CODE SEGMENT
ASSUME CS:CODE
START:
; Set port A、B The way 0 Output
MOV AL,10000000B
MOV DX,S ; Send control word
OUT DX,AL
INIT:
MOV BL,7FH
MOV CL,0FEH
;A Input the value through the port 1(7FH)
;B Input the value through the port 2(FEH)
NEXT:
MOV DX,A
MOV AL,BL
OUT DX,AL
MOV DX,B
MOV AL,CL
OUT DX,AL
; Press the no key
MOV AH,1
INT 16H
JNZ QUIT
; The number 1 Move right , The number 2 Move left
ROR BL,1
ROR CL,1
JZ INIT
JNZ NEXT
QUIT:
MOV AH,4CH
INT 21H
CODE ENDS
END START
------------ Theoretical knowledge -----------
------------ Concrete practice -----------
8255 Do the running water lamp experiment
CODE SEGMENT
ASSUME CS:CODE
START:
MOV DX,606H
MOV AL,80H;A Port selection 00 The way ,B mouth 0 The way
OUT DX,AL; Send control word
MOV CL,80H ; Assign initial value to
MOV BL,1H ; Assign initial value to
AA1:
MOV DX,600H
MOV AL,CL
OUT DX,AL
MOV DX,602H
MOV AL,BL
OUT DX,AL
CALL DELAY ; Delayed action
ROL BL,1H ; Cycle one bit left
ROR CL,1H ; Cycle right one bit
JMP AA1
DELAY:
PUSH CX
MOV CX,0FFFFH
AA2:PUSH AX
POP AX
LOOP AA2
POP CX
RET
CODE ENDS
END START
------------ Concrete practice -----------
(3) Run the program , Observe LED The light shows , Verify program functions .
(4) Change the way of running water lamp by yourself , Programming .
(5) Solidify the program and run it offline ( Optional ).

3、 The way 1 I / O experiment ( Optional )
This experiment makes 8255 port A Work in the way 0 And as an output port , port B Work in the way 1 And as input , Then port C Of PC2 Become a strobe signal input STBB,PC0 Become the interrupt request signal output terminal INTRB, When B After the port data is ready , By sending STBB Signal to request CPU Read port B Data is sent to the port A The output shows . Use a set of switch signals to access the port B, port A The output line is connected to a group of data lamps . The specific experimental steps are as follows :

(1) According to the figure 3-2-6 Connect the experimental circuit diagram .
(2) Write the experimental program , Compiled 、 Load the system after the link is correct .
------------ Theoretical knowledge -----------
1、 Confirm the port address
IO Base address 0600H
XR1---A0
XR2---A1
Address range 600H~603H
port A Address :0600H
port B Address :0602H
port C Address :0604H
Control register port address :0606H
2、 Determine how it works
port A The way 0 Output
port B The way 1 Input
3、 Determine the control word
1 00 0 x 1 1 1
4、 Initializer
A EQU 0600H
B EQU 0602H
C EQU 0604H
S EQU 0606H
CODE SEGMENT
ASSUME CS:CODE
START:
; Set port A, The way 0 Output
; Set port B, The way 1 Input
MOV AL,10000111B
MOV DX,S ; Send control word
OUT DX,AL
MOV DX,B
IN AL,DX
MOV DX,A
OUT DX,AL
MOV AH,4CH
INT 21H
CODE ENDS
END START
------------ Theoretical knowledge -----------
(3) Run the program , Then change the toggle switch , When you're ready , Press KK1, At the same time, observe the data lamp display , It shall be consistent with the switchpack signal
3.2.5 Experimental tips
1、 The flow chart of basic input and output experiment procedure is shown in Figure 3-2-5 Shown ;
2、 The flow chart of the flow lamp display experiment procedure is shown in Figure 3-2-6 Shown :

Last
Please read the article statement , By default, I agree with this statement
Reward channels 
边栏推荐
- ROS21讲
- R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses regression coefficients and their standard errors to calculate the
- Leetcode (167) -- sum of two numbers II - input ordered array
- 教育行业SaaS应用管理平台解决方案:助力企业实现经营、管理一体化
- 第四大运营商,难成「鲶鱼」
- 厨卫电器行业S2B2C系统网站解决方案:打造S2B2C平台全渠道商业系统
- Express template engine
- SAP MTS/ATO/MTO/ETO专题之九:M+M模式前后台操作,策略用50,提前准备原材料和半成品
- 【mysql学习笔记24】索引设计原则
- C#/VB. Net to convert PDF to excel
猜你喜欢

WPF 视频硬解码渲染播放(无空域)(支持4K、8K、高帧率视频)
MySQL主从切换的超详细步骤
![[C language] implementation of binary tree and three Traversals](/img/9f/384a73fb82265a76fc5eef884ce279.png)
[C language] implementation of binary tree and three Traversals

halcon 基础总结(一)裁切图片并旋转图像

Successful cases of rights protection of open source projects: successful rights protection of SPuG open source operation and maintenance platform
Oracle11g database uses expdp to back up data every week and upload it to the backup server

动力电池,是这样被“瓜分”的

使用Karmada实现Helm应用的跨集群部署

5000倍回报,南非报业投资腾讯赚了一个省

抽奖动画 - 鲤鱼跳龙门
随机推荐
ORACLE中dbms_output.put_line输出问题的解决过程
Case driven: a detailed guide from getting started to mastering shell programming
seata-server 1.5.0 如何支持mysql8.0?
Softing epGate PB系列网关-可将PROFIBUS总线集成到EtherNet/IP网络
兼顾企业抗疫和发展的5个解决方案,来自IBM
With 120billion yuan, she will ring the bell for IPO again
[C language] implementation of binary tree and three Traversals
Functools: high order functions and operations on callable objects (continuous updating ing...)
What is the renewal fee for PMP certificate?
Not being a meta universe now is like not buying a house 20 years ago!
The latest pycharm activation cracking code in 2022 is permanent_ Detailed installation tutorial (applicable to multiple versions)
[collection of excellent articles on Digital IC] nearly 500 articles | learning route | basic knowledge | interface | bus | scripting language | chip job search | security | EDA | tools | low power de
坐拥1200亿,她又要IPO敲钟了
R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses regression coefficients and their standard errors to calculate the
sql语句 练习题
[C language] nextday problem
How to solve the following problems in the Seata database?
石油化工行业供应链系统驱动管理模式创新升级,强化企业内部管理
C#/VB. Net to convert PDF to excel
Leike defense: 4D millimeter wave radar products are expected to be mass produced and supplied by the end of the year