当前位置:网站首页>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 )
边栏推荐
- Troubleshooting of high memory usage of redis in a production environment
- [mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
- 【云原生 | Kubernetes篇】Ingress案例实战(十三)
- 1 plug-in to handle advertisements in web pages
- How to get a token from tokenstream based on Lucene 3.5.0
- 《增长黑客》阅读笔记
- 你做自动化测试为什么总是失败?
- Yolov 5 Target Detection Neural Network - Loss Function Calculation Principle
- Linux Installation and deployment lamp (apache+mysql+php)
- Programmers are involved and maintain industry competitiveness
猜你喜欢

【pytorch 修改预训练模型:实测加载预训练模型与模型随机初始化差别不大】

11. (map data section) how to download and use OSM data

13.(地图数据篇)百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换

【yolov3损失函数】

简单解决redis cluster中从节点读取不了数据(error) MOVED

redis 集群模式原理

redis主从模式

Yolov5 target detection neural network -- calculation principle of loss function

ABAP table lookup program
![[mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]](/img/1a/dd7453bc5afc6458334ea08aed7998.png)
[mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
随机推荐
Splunk configuration 163 mailbox alarm
调查显示传统数据安全工具在60%情况下无法抵御勒索软件攻击
Go language learning notes - first acquaintance with go language
ACID事务理论
【TFLite, ONNX, CoreML, TensorRT Export】
1.php的laravel创建项目
byte2String、string2Byte
【TFLite, ONNX, CoreML, TensorRT Export】
[pytorch pre training model modification, addition and deletion of specific layers]
JS for循环 循环次数异常
15 methods in "understand series after reading" teach you to play with strings
Multi table operation - sub query
Acid transaction theory
13. (map data) conversion between Baidu coordinate (bd09), national survey of China coordinate (Mars coordinate, gcj02), and WGS84 coordinate system
pytorch-softmax回归
Error modulenotfounderror: no module named 'cv2 aruco‘
1个插件搞定网页中的广告
如何让你的产品越贵越好卖
查看多台机器所有进程
Reading notes of growth hacker