当前位置:网站首页>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 )
边栏推荐
- [pytorch modifies the pre training model: there is little difference between the measured loading pre training model and the random initialization of the model]
- Multi table operation - Auto Association query
- 【L1、L2、smooth L1三类损失函数】
- 跨平台(32bit和64bit)的 printf 格式符 %lld 输出64位的解决方式
- 阻止瀏覽器後退操作
- 【TFLite, ONNX, CoreML, TensorRT Export】
- Multi table operation - sub query
- Unity Xlua MonoProxy Mono代理类
- Shell script file traversal STR to array string splicing
- 谜语1
猜你喜欢
iTOP-3568开发板NPU使用安装RKNN Toolkit Lite2
【yolov3损失函数】
Linux Installation and deployment lamp (apache+mysql+php)
【Win11 多用户同时登录远程桌面配置方法】
多表操作-自关联查询
一次生产环境redis内存占用居高不下问题排查
redis的持久化机制原理
Simply solve the problem that the node in the redis cluster cannot read data (error) moved
Principle of persistence mechanism of redis
ABAP table lookup program
随机推荐
一类恒等式的应用(范德蒙德卷积与超几何函数)
Wireless WiFi learning 8-channel transmitting remote control module
阻止瀏覽器後退操作
Principle of redis cluster mode
Web API configuration custom route
Intern position selection and simplified career development planning in Internet companies
调查显示传统数据安全工具在60%情况下无法抵御勒索软件攻击
12. (map data) cesium city building map
【L1、L2、smooth L1三类损失函数】
pytorch-线性回归
12.(地图数据篇)cesium城市建筑物贴图
Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
Redis master-slave mode
【上采样方式-OpenCV插值】
Codeforces Round #804 (Div. 2)
[leetcode] wild card matching
报错ModuleNotFoundError: No module named ‘cv2.aruco‘
Unity xlua monoproxy mono proxy class
leetcode:1200. Minimum absolute difference
石油化工企业安全生产智能化管控系统平台建设思考和建议