prog39.asm

来自「包括了各种常用的8051单片机的程序」· 汇编 代码 · 共 38 行

ASM
38
字号
;  PROG39 - Comparing Voltage Inputs
;
;  This Application Compares the voltages on Pins P1.0 and P1.1 and
;   Lights an LED when the Voltage on P1.0 is greater.
;
;  For the Voltage Sources, Two LDRs are Used, with one terminal at
;   Ground and the other connected to P1.0/1.  One LDR isconnected to a 4.7 K
;   Pullup and the other connected to a 10K Pot Pull Up.  
;
;  Myke Predko
;  98.04.05
;
;  Hardware Notes:
;  AT89C2051 is used as the Microcontroller
;   - Oscillator Speed is 4 MHz
;  Voltage "1" is on P1.0
;  Voltage "2" is on P1.1
;   - Comparator Output Taken from P3.6
;  LED is Connected to P3.7

;  Constant Declarations

;  Variable Declarations


;  Macros


;  Mainline
 org 0                          ;  Execution Starts Here

Loop:                           ;  Just Loop Around the Voltage Read

  mov     C,P3.6                ;  Read the Comparator
  mov     P3.7,C                ;  Output the Comparator Value
  
  ajmp    Loop

⌨️ 快捷键说明

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