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

📄 dacout.s

📁 采用IAR在线调试ADI公司基于ARM7内核的ADUC7026的DAC代码
💻 S
字号:
;Filename: DacOut.s79
;Part: ADuC7020,ADuC7024,ADuC7026.
;Created: 15/04/2004
;Updated: 28/06/2005
;Author: Eckart Hartmann.
;This file is in beta sampling.

#include        <ADuC702x.IAR.equ>
; DacOut==========Writes a value to a DAC.
; C Function prototype: int DacOut(int iChan, int iValue);
;iChan:{0,1,2,3}
;iValue:{0-0x0fff0000}
; Description of Function: Sets the DAC output.
; User interface: Set iChan to required channel.
;       Put the required output value in iValue.
;           iValue is scaled such that a value of 0xfffffff results in
;           full scale output as selected by DacRng().
;       Call DacOut().
;           If iValue > 0xfffffff iValue is set to 0xfffffff.
;           If iValue < 0 iValue is set to 0.
;               iValue is written to the DACn data register.
;       Returns value in DAC data register DACnDAT.
; Robustness:  If iChan is invalid wrong channel may be used.
; Side effects: Corrupts r1 and r3.
;

                RSEG CODE
                MODULE DacOut
                PUBLIC DacOut
                CODE32

DacOut: and     r0,r0,#3                ;Isolate channel bits.   
        ldr     r3,=DAC0CON+4           ;r3 = &DACnL.
        add     r3,r3,r0,LSL#3
        cmp     r1,#0                   ;if(iValue<0)
        movlt   r1,#0                   ; iValue = 0;
        cmp     r1,#0x0fffffff          ;if(iValue>0x0fffffff)
        mvngt   r1,#0x0f0000000         ; iValue = 0x0fffffff;
        str     r1,[r3]                 ;Write to DACn.
        ldr     r0,[r3]                 ;return DACn.
        bx      lr


                 ENDMOD DacOut 

                 END
        

⌨️ 快捷键说明

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