当前位置:网站首页>16 channel water lamp experiment based on Proteus (assembly language)
16 channel water lamp experiment based on Proteus (assembly language)
2022-07-05 11:58:00 【**inevitable**】
be based on Proteus Of 16 Road water lamp experiment ( assembly language )
Experimental content
use proteus Simulation 16 Road running water lamp . Programming , send 8255 Of A Mouth and B All ports are output , Data lamp D8~D1 From left to right , Only one light at a time , Cycle show ,D16~D9 And D8~D1 On the contrary , From right to left , Only one light at a time , Cycle show .
Circuit connection diagram
Minimum system

General diagram of circuit connection

Program code
DATA SEGMENT
IOCON EQU 0B006H ;0000 1011 0000 0000 0110 ;8255 Control port address
IOA EQU 0B000H ;0000 1011 0000 0000 0000 ;8255 A Address
IOB EQU 0B002H ;0000 1011 0000 0000 0010 ;8255 B Address
IOC EQU 0B004H ;0000 1011 0000 0000 0100 ;8255 C Address
DATA ENDS
STACKS SEGMENT
DW 100h DUP(?)
STACKS ENDS
CODE SEGMENT
ASSUME CS:CODE,SS:STACKS,DS:DATA
START:
MOV DX,IOCON ; Input control word
MOV AL,80H ;1000 0000
; Sign bit is 1(D7=1),A Port mode selection mode 0(D6=0, D5=0)
;A output (D4=0)
;C Both input and output ports , Default output , namely D3=0 and D0=0
;B Port mode selection mode 0(D2=0), meanwhile B The mouth also outputs (D1=0)
OUT DX,AL
; Here we use BL and BH The purpose of is to save the port value
; Because I / O instructions (IN,OUT) The destination operand of can only be AL or AX
MOV BL, 01111111B ; initialization , This is because the low level is on , So the initial setting D8 bright
; Pay attention here 0111 1111 From left to right is the change from high to low , namely 0 It's high
MOV BH, 11111110B ; It's the same here , It's also initialization
;0 Bit lowest , Corresponding to D9 bright
ENDLESS:
MOV AL,BL ; take BL Value is assigned to AL, Easy to output
MOV DX,IOA ;A Port for output , Will be BL To output the value of
; For example, in the beginning BL The value is 0111 1111
; that A After output ,PA7~PA0 The values of are 01111111, Which makes D8 Light on
OUT DX,AL
MOV AL,BH ; take BH Value is assigned to AL, Easy to output
MOV DX,IOB ;B Port for output , Will be BH To output the value of
OUT DX,AL ; For example, in the beginning BH The value is 1111 1110, that B After output
;PB7~PB0 The values of are 11111110, Which makes D9 Light on
CALL DELAY0 ; Call delay subroutine
; The purpose is to allow a short stay time when two adjacent lights are on
MOV CL,1
ROR BL,CL ; take BL Cycle right one bit , Only one light is lit at a time
ROL BH,CL ; take BH Cycle one bit left , Only one light is lit at a time
; Here a loop shifts left , A cycle to the right is to achieve the opposite goal
JMP ENDLESS ; The cycle display light is on
DELAY0 PROC
PUSH CX
MOV CX,0
LOOP $
LOOP $
LOOP $
MOV CX,15000
LOOP $
POP CX
RET
DELAY0 ENDP
CODE ENDS
END START
Additional explanation
The definition of the port address in the program depends on the smallest system in the circuit connection diagram .
For example, in this minimal system built in this article ,8255A The control port address is 1011 0000 0000 0110 ,A The port address is 1011 0000 0000 0000 ,B The port address is 1011 0000 0000 0010 ,C The port address is 1011 0000 0000 0100 .
because 8255A CS ‾ \overline{\text{CS}} CS The next thing is IO3, Corresponding 74HC138 in A12,A13,A14 The corresponding value is 011, because 74HC138 The next thing is A15, therefore A15 The value of is 1, therefore 8255 The high value of each port 4 All places are 1011, And because of 8255A Chip A0 End sum A1 The termination is A1 and A2( Note that there 8255A Of A0 The termination is A1,A1 The termination is A2), So when selecting control port operation A1 and A2 by 11, When choosing A Port operation A1 and A2 by 00, When choosing B Port operation A1 and A2 by 01, When choosing C Port operation A1 and A2 by 10. In this way, the corresponding port values of different ports are obtained .
stay dosbox Corresponding to the smallest system in 8255A The control port address is 63H,A The port address is 60H,B The port address is 61H,C The port address is 62H. In the experimental box, there may be another address . To make a long story short , The chip port values corresponding to different systems are different , This needs attention .
Download resources
Resource link :proteus Simulation 16 Road water lamp experiment ( assembly language )
边栏推荐
- 汉诺塔问题思路的证明
- Network five whip
- Video networkState 属性
- JS for循环 循环次数异常
- 跨平台(32bit和64bit)的 printf 格式符 %lld 输出64位的解决方式
- 【load dataset】
- [loss functions of L1, L2 and smooth L1]
- [upsampling method opencv interpolation]
- leetcode:1200. Minimum absolute difference
- Use and install RkNN toolkit Lite2 on itop-3568 development board NPU
猜你喜欢

多表操作-自关联查询

XML parsing
![[cloud native | kubernetes] actual battle of ingress case (13)](/img/1a/9404f6dcedd15827fa45f8f6f4c093.png)
[cloud native | kubernetes] actual battle of ingress case (13)

iTOP-3568开发板NPU使用安装RKNN Toolkit Lite2

【yolov3损失函数】

Hiengine: comparable to the local cloud native memory database engine
![[pytorch pre training model modification, addition and deletion of specific layers]](/img/cb/aa0b1116ec9b98e3ee5725aa58f4fe.png)
[pytorch pre training model modification, addition and deletion of specific layers]

Sentinel sentinel mechanism of master automatic election in redis master-slave
![[pytorch modifies the pre training model: there is little difference between the measured loading pre training model and the random initialization of the model]](/img/ad/b96e9319212cf2724e0a640109665d.png)
[pytorch modifies the pre training model: there is little difference between the measured loading pre training model and the random initialization of the model]

Principle of persistence mechanism of redis
随机推荐
XML解析
Web API configuration custom route
[yolov3 loss function]
[leetcode] wild card matching
How to protect user privacy without password authentication?
C # implements WinForm DataGridView control to support overlay data binding
【TFLite, ONNX, CoreML, TensorRT Export】
POJ 3176 cow bowling (DP | memory search)
多表操作-子查询
阻止浏览器后退操作
How to make your products as expensive as possible
Linux Installation and deployment lamp (apache+mysql+php)
Pytorch linear regression
《增长黑客》阅读笔记
Liunx prohibit Ping explain the different usage of traceroute
Multi table operation - sub query
Redis集群的重定向
Pytorch weight decay and dropout
Redis集群(主从)脑裂及解决方案
abap查表程序