⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 potreada.asm

📁 主要是8051源代码
💻 ASM
字号:
;  PotReada - Read the Pot Values And Output a Pulse Showing What Was Read 
;
;  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.
;
;  PotReada uses P1.2 and P1.3 due to Interactions Between the Other Pins.  The
;   Pins Are Connected to 10K Pots that are connected to a 0.1 uF Cap to Vcc.  
;   The time required to charge the cap is measured. 
;
;  Myke Predko
;  98.05.11
;
;  Hardware Notes:
;  89C2051 Running at 10 MHz
;  P1.2 is Connected to a Joystick Pot via the Circuit Described Above.
;  P1.3 is Connected to a Joystick Pot via the Circuit Described Above.
;  P1.6 is Used as the Pulse Output for P1.2
;  P1.7 is Used as the Pulse Output for P1.3


;  Variable Declarations

 org 0
Mainline:                       ;  Program Mainline

  mov    P1,#%00111111          ;  Allow Both to Charge

;  mov    R0,#0FFh               ;  Let the Cap Discharge
Loop1:
;  djnz   R0,Loop1

  mov    P1,#%01111011          ;  Now, Wait for the P1.2 Cap to Discharge

Loop2:                          ;  Loop Until the the Line Becomes High
  jb     P1.2,Loop2

  mov    P1,#%00111111          ;  Drop the P1.3 Line and Wait for it to Go Low

;  mov    R0,#0FFh               ;  Let the Cap Discharge
Loop3:
;  djnz   R0,Loop3

  mov    P1,#%10110111          ;  Now, Wait for the Cap to Charge

Loop4:                          ;  Loop Until the the Line Becomes High
  jb    P1.3,Loop4

  mov   P1,#%00111111           ;  Finished, Drop the P1.7 Line to Indicate it's Done

  ajmp   Mainline               ;  Loop Back Around to the Mainline

⌨️ 快捷键说明

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