Single chip multi-channel data acquisition assembly source program

Publisher:qin199099Latest update time:2014-01-22 Source: dqjsw Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The source program for the multi-channel data acquisition of the single-chip microcomputer is as follows
:
Single-channel acquisition program:
MOV DPTR, #0F8FFH
    MOV R0, #00H ; store the first address of the memory in the two registers R0 and R1
    MOV R1, #00H
    MOV R2, #200D ; set up the loop
    MOV R3, #4
    MOV R4, #8D

MAIN:
    CLR P1.1 ;Select ADC0809
    PUSH DPL ;Push DPTR into the stack
    PUSH DPH
    MOVX @DPTR,A ;Start AD conversion
    ACALL DELAY ;Delay 5ms to ensure the data acquisition frequency is 200HZ
    MOVX A,@DPTR ;Read data
    SETB P1.1 ;Select memory
    MOV DPL,R0 ;Give the address of the memory to DPTR
    MOV DPH,R1   
    MOVX @DPTR,A ;Store data
    INC DPTR ;Point to the next storage unit
    MOV R0,DPL ;Store the unit address back into the register
    MOV R1,DPH
    POP DPH ;Pop DPTR out of the stack
    POP DPL
   
    DJNZ R2,MAIN
    DJNZ R3,MAIN
    DJNZ R4,MAIN
    SJMP $
   
DELAY: ;Delay program delay 5ms         
    MOV R5,#100D
    MOV R6,#24D
 LA:DJNZ R5,$
    DJNZ R6,LA
    RET
    
    END
Loop acquisition program:
MOV 30H,#00H; Store the first addresses of the eight memories in 16 internal storage units from 30 to 3F respectively
      MOV 31H,#00H
      MOV 32H,#00H
      MOV 33H,#20H
       MOV 30H,#00H; Store the first addresses of the eight memories in 16 internal storage units from 30 to 3F respectively
      MOV 31H,#00H
      MOV 32H,#00H
      MOV 33H,#20H
      MOV 34H,#00H
      MOV 35H,#40H
      MOV 36H,#00H
      MOV 37H,#60H
      MOV 38H,#00H
      MOV 39H,#80H
      MOV 3AH,#00H
      MOV 3BH,#0A0H
      MOV 3CH,#00H
      MOV 3DH,#0C0H
      MOV 3EH,#00H
      MOV 3FH,#0E0H
     
      MOV R2,#200D ;Set the outer loop 200*40 for 8000 times in total
      MOV R3,#40D          
     
MAIN: MOV DPTR,#0F8FFH ;The address of channel 0
      MOV R0,#30H ;R0,R1 are intermediate variables of the memory address
      MOV R1,#31H
      MOV R4,#8 ;Set the inner loop
    
LOOP: CLR P1.1 ;Select ADC0809
      PUSH DPL ;DPTR is pushed into the stack
      PUSH DPH
      MOVX @DPTR,A ;Enter a number to start AD conversion
      ACALL DELAY ;Wait for delay to collect 200 data per second  
      MOVX A,@DPTR ;Read data 
      SETB P1.1 ;Select the memory
      MOV DPL,@R0 ;Give the address of the memory to DPTR
      MOV DPH,@R1   
      MOVX @DPTR,A ; store data
      INC DPTR ; point to the next storage unit
      MOV @R0,DPL ; store the unit address back into the internal data storage unit
      MOV @R1,DPH
      INC R0 ; point to the address of the next memory
      INC R0
      INC R1
      INC R1
      POP DPH ; DPTR pops the stack
      POP DPL
      INC DPH ; point to the next channel address
      DJNZ R4,LOOP ; inner loop
     
      DJNZ R2,MAIN ; outer loop
      DJNZ R3,MAIN
      SJMP $
     
 DELAY: ; delay program delay 600us         
      MOV R5,#100
      MOV R6,#3
   LA:DJNZ R5,$
      DJNZ R6,LA
      RET
     
      END    

Reference address:Single chip multi-channel data acquisition assembly source program

Previous article:Hardware debugging steps in the MCU development process
Next article:Design of Single Chip Microcomputer in Cable Tester

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号