📄 potreadc.asm
字号:
; PotReadc - Read the Pot Values Using a 74LS125
;
; This Application Reads Resistance Values by Allowing a Capacitor
; Wired to a Pot to Charge and then Measure the Time the Cap takes
; To Discharge. Instead of using the AT89C2051's I/O Ports, a 74LS125 is
; used to Control the State of the I/O Pins Rather than the AT89C2051.
;
; PotReadc Reads Two Pots
;
; Myke Predko
; 98.05.11
;
; Hardware Notes:
; 89C2051 Running at 10 MHz
; P1.6 is Connected to the Elevator R/C Charge/Discharge Circuit
; P1.7 is Connected to the Aileron R/C Charge/Discharge Circuit
; P1.0 is Connected to the R/C Voltage which is the Pulse State
; Between the Capacitor and Resistor for the Elevator
; P1.1 is Connected to the R/C Voltage which is the Pulse State
; Between the Capacitor and Resistor for the Aileron
; Variable Declarations
org 0
mov TMOD,#%00000010 ; Put Timer0 in Mode 2
mov TH0,#173
mov TL0,#173
setb TCON.4 ; Start the Timer Running
Loop: ; Wait for the Timer to Overflow
jnb TCON.5,Loop
nop ; How Long does it take to Get here?
Mainline: ; Program Mainline
mov P1,#%00111111 ; Allow the Capacitors to Discharge
mov R0,#0FFh ; Let the Cap Discharge
mov R1,#010h ; For 10 msecs
Loop1:
djnz R0,Loop1
djnz R1,Loop1
mov P1,#%01111111 ; Now, Wait for the Elevator Capacitor to Charge
Loop2: ; Loop Until the the Line Becomes High
jnb P1.0,Loop2
mov P1,#%11111111 ; Now, Wait for the Aileron Capacitor to Charge
Loop3: ; Loop Until the the Line Becomes High
jnb P1.1,Loop3
ajmp Mainline
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -