Tool/software: Code Composer Studio
I have had some trouble with the CLA in regards to reading ADC values. I started my code based off of the ClaAdc example which originally,I adapted this example to read 3 adc values into simple integer variables, I then tried to store these values in 3 (adc) x 20 (array size) arrays, and this is where I ran into trouble. The values in the 1st array would update, however the others were not correct. I also tried adjusting the frequency of cla interrupts called, but this did not have any affect. The cla code is posted below.
_Cla1Task2: MMOVZ16 MR0, @_ConversionCount ;1 Current Conversion ;Ch0 MMOV16 MAR1, MR0, #_Ch0 ;2 Point MAR1 register to Ch0[ConversionCount] MNOP ;3 wait MNOP ;4 wait MNOP ;5 wait MNOP ;6 wait MNOP ;7 Wait till I8 to read result MMOVZ16 MR2, @_AdcResult.ADCRESULT0 ;8 Read ADCRESULT0 MMOV16 *MAR1, MR2 ;9 Store ADCRESULT0 using pointer to Ch0[ConversionCount] ;Ch1 MMOV16 MAR1, MR0, #_Ch1 ;2 Point MAR1 register to Ch1[ConversionCount] MNOP ;3 wait MNOP ;4 wait MNOP ;5 wait MNOP ;6 wait MNOP ;7 Wait till I8 to read result MMOVZ16 MR2, @_AdcResult.ADCRESULT0 ;8 Read ADCRESULT1 MMOV16 *MAR1, MR2 ;9 Store ADCRESULT1 using pointer to Ch1[ConversionCount] ;Ch2 MMOV16 MAR1, MR0, #_Ch2 ;2 Point MAR1 register to Ch1[ConversionCount] MNOP ;3 wait MNOP ;4 wait MNOP ;5 wait MNOP ;6 wait MNOP ;7 Wait till I8 to read result MMOVZ16 MR2, @_AdcResult.ADCRESULT0 ;8 Read ADCRESULT1 MMOV16 *MAR1, MR2 ;9 Store ADCRESULT1 using pointer to Ch1[ConversionCount]
MADDF32 MR0, MR0, #1.0 ; Add 1 to ConversionCount MCMPF32 MR0, #NUM_DATA_POINTS.0 ; Compare ConversionCount to max MF32TOUI16 MR0, MR0 ; Convert count to Uint16 MNOP MNOP MBCNDD _RestartCount, GEQ ; If count >= NUM_DATA_POINTS MMOVIZ MR1, #0.0 ; Preload MR1 with 0 MNOP MNOP MMOV16 @_ConversionCount, MR0 ; If branch not taken, store current count MSTOP _RestartCount MMOV16 @_ConversionCount, MR1 ; If branch taken, restart count MSTOP MNOP MNOP MNOP _Cla1T2End:
Is there anyone help? thank u