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 (DPLib)

Other Parts Discussed in Thread: CONTROLSUITE

Hello,
I try to use the assembly macro "ADCDRV_8ch" (but my problem is still there at the macro for .._4ch and ..._1ch).
The problem is that when I use the macro as it is written down in the "DPLib.pdf" at my project I get error messages like the following ones, because "_AdcResult" is undefined.

"../StopStart-ISR.asm", ERROR! at line 156: [E0009] Missing struct/union member or tag
MOV ACC,@_AdcResult.ADCRESULT:u:<<12
"../StopStart-ISR.asm", REMARK at line 156: [R0001] After symbol substitution the line became:
MOV ACC,@_AdcResult.ADCRESULT7<<12
"../StopStart-ISR.asm", ERROR! at EOF: [E0300] The following symbols are undefined:
_AdcResult

The error messages belong to the following code snippet of the "ADCDRV_8ch.asm" file:
 

MOVW DP, #_AdcResult ; load Data Page to read ADC results
MOV ACC,@_AdcResult.ADCRESULT:m:<<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
MOV ACC,@_AdcResult.ADCRESULT:n:<<12
MOVL *XAR1,ACC
MOV ACC,@_AdcResult.ADCRESULT:p:<<12
MOVL *XAR2,ACC

Does anyone know, at which program file I have to define the AdcResult structure or can anyone give me some other helpful hints for this problem?

Thank you! Piccolo Rookie

  • Hi Piccolo - or is it Rookie =:-o

    You need to add the peripheral header includes TI provides with controlSuite into your project. For you specific question, the bitfields are defined in the file DSP2802x_Adc.h.

    Best regards,
    Andreas

  • Maybe it´s Rookie with daily increasing skills :-O

    I already added the peripheral header "DSP2803x_Adc.h" where the bitfields are defined for the C- code at "ProjectName-Main.c". But that define isn´t guilty for the assembly code, where "ADCDRV_8ch.asm" works, isn´t it? Because of that I tried to add the "DSP2803x_Adc.h" at my ISR via cdecls. But when I do that I get error messages like "Int16 isn´t defined".

    This is the full context of the code with the error messages at "ADCDRV_8ch.asm":

    ;=============================
    ADCDRV_8ch  .macro m,n,p,q,r,s,t,u
    ;=============================
     
      MOVW    DP, #_ADCDRV_8ch_RltPtrA   ; Load Data Page
      MOVL    XAR0,@_ADCDRV_8ch_RltPtrA   ; Load Rlt1 Data Page Pointer in XAR0
      MOVL    XAR1,@_ADCDRV_8ch_RltPtrB   ; Load Rlt2 Data Page Pointer in XAR1
      MOVL    XAR2,@_ADCDRV_8ch_RltPtrC   ; Load Rlt3 Data Page Pointer in XAR2
      MOVL    XAR3,@_ADCDRV_8ch_RltPtrD   ; Load Rlt4 Data Page Pointer in XAR3
      MOVL    XAR4,@_ADCDRV_8ch_RltPtrE   ; Load Rlt5 Data Page Pointer in XAR4
      MOVL    XAR5,@_ADCDRV_8ch_RltPtrF   ; Load Rlt6 Data Page Pointer in XAR5
      MOVL    XAR6,@_ADCDRV_8ch_RltPtrG   ; Load Rlt7 Data Page Pointer in XAR6
      MOVL    XAR7,@_ADCDRV_8ch_RltPtrH   ; Load Rlt8 Data Page Pointer in XAR7
        
      MOVW  DP, #_AdcResult                     ; load Data Page to read ADC results
      MOV     ACC,@_AdcResult.ADCRESULT:m:<<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
      MOV     ACC,@_AdcResult.ADCRESULT:n:<<12
      MOVL    *XAR1,ACC
      MOV     ACC,@_AdcResult.ADCRESULT:p:<<12
      MOVL    *XAR2,ACC
      MOV     ACC,@_AdcResult.ADCRESULT:q:<<12
      MOVL    *XAR3,ACC
      MOV     ACC,@_AdcResult.ADCRESULT:r:<<12 
      MOVL    *XAR4,ACC       
      MOV     ACC,@_AdcResult.ADCRESULT:s:<<12
      MOVL    *XAR5,ACC
      MOV     ACC,@_AdcResult.ADCRESULT:t:<<12
      MOVL    *XAR6,ACC
      MOV     ACC,@_AdcResult.ADCRESULT:u:<<12
      MOVL    *XAR7,ACC  
      .endm
    ; end of file

    Is there any other reason for my problem? Thanks (Piccolo)-Rookie

  • Hi Andreas,

    thanks for your support. After including "PeripheralHeaderIncludes.h" (where DSP2803x_Adc.h is also included) with the command .cdecls C,NOLIST,"PeripheralHeaderIncludes.h" at the top of my ...-ISR.asm my program is running!

    Best regards, Piccolo Rookie