potreadb.asm

来自「主要是8051源代码」· 汇编 代码 · 共 37 行

ASM
37
字号
;  PotReadb - 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. 
;
;  Myke Predko
;  98.05.11
;
;  Hardware Notes:
;  89C2051 Running at 10 MHz
;  P1.6 is Connected to the R/C Charge/Discharge Circuit
;  P1.7 is Connected to a 74LS174 Output which is the Pulse State
;   Between the Capacitor and Resistor


;  Variable Declarations

 org 0
Mainline:                       ;  Program Mainline

  mov    P1,#%10111111          ;  Allow the Capacitor to Discharge

  mov    R0,#0FFh               ;  Let the Cap Discharge
  mov    R1,#010h               ;  For 10 msecs
Loop1:
  djnz   R0,Loop1
  djnz   R1,Loop1

  mov    P1,#%11111111          ;  Now, Wait for the Capacitor to Charge

Loop2:                          ;  Loop Until the the Line Becomes High
  jnb    P1.0,Loop2

  ajmp   Mainline

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?