This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

请问 ADCDRV_1ch Q格式问题



This assembly  macro  reads  a  result  from  the  internal  ADC  module  Result Register:n:  and  delivers  it  in  Q24  format to the  output  terminal,  where  :n:  is the  instance  number.  The  output  is  normalized  to  0-1.0  such  that  the minimum input voltage will generate nominally 0.0 at the driver output, and a
maximum full  scale  input voltage  read  +1.0.  The  result  is  then  stored  in  the memory location pointed to by the net terminal pointer.

上面的红色文字是说把输出结果归一化到0-1.0这个范围,但是下面汇编没有看到如何把输入电压结果归一化的。

ADCDRV_1ch_INIT    .macro n
;================================
_ADCDRV_1ch_Rlt:n:    .usect "ADCDRV_1ch_Section",2,1,1    ; output terminal 1

; publish Terminal Pointers for access from the C environment
        .def     _ADCDRV_1ch_Rlt:n:

        MOVL    XAR2, #ZeroNet                        ; "ZeroNet" is initialised to 0 in ISR
        MOVW    DP, #_ADCDRV_1ch_Rlt:n:
        MOVL    @_ADCDRV_1ch_Rlt:n:, XAR2            ; zero output terminal pointer
        .endm

ADCDRV_1ch        .macro    n
;=============================
         MOVW    DP, #_ADCDRV_1ch_Rlt:n:                ; Load Data Page
        MOVL    XAR0,@_ADCDRV_1ch_Rlt:n:            ; Load Rlt Data Page Pointer in XAR0
        
        MOVW     DP, #_AdcResult                     ; load Data Page to read ADC results
        MOV     ACC,@_AdcResult.ADCRESULT:n:<<12    ; read and shift the 12 bit ADC result by 12 bits to get Q24 value
       
        MOVL    *XAR0,ACC                            ; store result in output pointer location
        .endm
这个汇编程序如何把结果变成Q24格式的呢?这里结果左移12位不是变成Q12格式了吗?

谢谢