ADC0809 input voltage converted into LED light display program

Publisher:MysticalDreamerLatest update time:2018-01-11 Source: eefocusKeywords:ADC0809 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

ADC0809 input voltage converted into LED light display program

;Convert input voltage into LED display.                      
;//////////////////////////////////////////////     


;//define the connection port of ADC 
ad_cs equ P3.6 
ad_wr equ P3.2 
ad_rd equ P3.7 
ad_input_port equ p1 

    org 0000h 
    ajmp main 
    org 0030h 
main: 
    lcall adc_demo 
    ajmp main 
                 
;//============================================ 
;// Start AD conversion 
;//============================================= 
Adc_Start: 
    clr ad_cs 
    nop 
    clr ad_wr 
    nop 
    setb ad_wr 
    nop 
    setb ad_cs 
    nop 
    ret 
;//========================================== 
;// Read AD conversion 
;//====================================== 
Adc_Read: 
     MOV ad_input_port,#0ffh 
    clr ad_cs 
    nop 
    clr ad_rd 
    nop 
    nop 
     MOV a,AD_INPUT_PORT 
    nop 
    setb ad_rd 
    nop 
    setb ad_cs 
    ret 
;// ========================================== 
;// AD conversion read delay program, display the read value 
; //============================================= 
Adc_Demo: 
    lcall Adc_Start 
    lcall delay1ms 
    lcall adc_read 

    call l1 
     MOV r1,#100 
disp1: 
    call disp 
    djnz r1,disp1 
    ret 
l1: 
     MOV b,#10 
    mul ab 
     MOV r7,b 
     MOV r6,a 
     MOV r5,#00h 
     MOV r4,#51 
    lcall chu 
     MOV a,r6 
     MOV b,#10 
    div ab 
     MOV 31h,a 
     MOV 30h,b 
    ret 
disp: 
     MOV p2,#0fdh 
     MOV dptr,#tab 
     MOV a,31h 
     MOV c a,@a+dptr 
    anl a,#7fh 
     MOV p0,a 
    call delay 
     MOV p2,#0ffh 
     MOV a,30h 
     MOV c a,@a+dptr 
     MOV p2,#0feh 
     MOV p0,a 
    call delay 
    ret 
delay: 
     MOV r6,#10 
d1: 
     MOV r7,#248 
    djnz r7,$ 
    djnz r6,d1 
    ret 

     
chu: 
     MOV a,r5 
    jnz begin 
     MOV a,r4 
    jz over 
begin: 
    clr a 
     MOV r3,a 
     MOV r2,a 
     MOV r1,#10h 
div0: 
    acall rlc4 
     MOV a,r2 
    subb a,r4 
     MOV r0,a 
     MOV  a,r3 
    subb a,r5 
    jc next 
    inc r6 
     MOV  r3,a 
     MOV  a,r0 
     MOV  r2,a 
next: 
    djnz r1,div0 
     MOV  a,r3 
    rlc a 
    jc round 
     MOV  a,r2 
    rlc a 
     MOV  r2,a 
     MOV  a,r3 
    rlc a     
    subb a,r5 
    jc done 
    jnz round 
     MOV  a,r2 
    subb a,r4 
    jc done 
round: 
    acall add1 
done: 
    clr a 
    ret 
over: 
     MOV  a,#0ffh 
    ret 
rlc4: 
    clr c 
     MOV  a,r6 
    rlc a 
     MOV  r6,a 
     MOV  a,r7 
    rlc a 
     MOV  r7,a 
     MOV  a,r2 
    rlc a 
     MOV  r2,a 
     MOV  a,r3 
    rlc a 
     MOV  r3,a 
    ret 
add1: 
     MOV  a,r6 
    add a,#1 
     MOV  r6,a 
     MOV  a,r7 
    addc a,#0 
     MOV  r7,a 
    ret 

tab:db 0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h 
delay1ms: 
     MOV     r7,#10 
tta: 
     MOV     r6,#50 
    djnz    r6,$        ;2us 
    djnz    r7,tta 
    ret 
    end 


Keywords:ADC0809 Reference address:ADC0809 input voltage converted into LED light display program

Previous article:TIMER0 counting working mode program in MODE2
Next article:Two 8051 serial multiplexed data transmission program

Recommended ReadingLatest update time:2024-11-15 17:33

ADC0809 Conversion Program
Block Diagram Circuit   program                             ORG 05A0H 05A0    758153      SE11:  MOV    SP,#53H 05A3    757E00              MOV    7EH,#00H 05A6 757D08 MOV 7DH, #08H 05A9    757C00              MOV    7CH,#00H 05AC 757B09 MOV 7BH,#09H 05AF    757A10              MOV    7AH,#10H 05B2 757910 MOV 79
[Microcontroller]
ADC0809 Conversion Program
Single chip digital voltmeter (ADC0809)
1. Brief Introduction     The digital voltmeter is designed using the analog-to-digital conversion chip ADC0809. The digital voltmeter designed in the example can measure the input voltage value in the range of 0 to 5V, and display the collected voltage value through a 4-digit LED digital tube. The example measures
[Microcontroller]
Single chip digital voltmeter (ADC0809)
ADC0809 realizes the conversion of 8 analog signals in turn (displayed on the digital tube)
//----------------------------- Function: ADC0809 realizes the conversion of 8 analog signals in turn and       displays them on the digital tube; 1. P1 port is used as the segment code control terminal of the digital tube, and    P2 port is used as the bit code control terminal of the digital tube; 2. P2.7 port i
[Microcontroller]
MCU Experiment Board 2011_V1.1-ADC0809 Practice Program
    Schematic diagram:   ADC0809 control timing:       test program /************MCU teaching experiment board******************/ /*Function description: ADC0809 exercise */ /*Author: Zheng Wen */ /*Written on: 2011.3.1 */ /*Connect to external crystal oscillator 11.0592 MHZ */
[Microcontroller]
MCU Experiment Board 2011_V1.1-ADC0809 Practice Program
Design of smoke alarm based on 51 single chip microcomputer - ADC0809
1. Hardware Solution The fire alarm uses 51 single-chip microcomputer as the core controller, and realizes basic functions by using gas sensor MQ-2, ADC0809 analog-to-digital converter, DS18B20 temperature sensor, etc. Through these sensors and chips, when the concentration or temperature of combustible gas in the env
[Microcontroller]
Design of smoke alarm based on 51 single chip microcomputer - ADC0809
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号