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.
Hello,
The sample code from :
c:\ti\controlSUITE\development_kits\TMDSIACLEDCOMKIT_v1.1\IsoACLighting-F28035-PLC_CENA\IsoACLighting-DPL-CLA.asm
Has poor comments/explanations:
.if(INCR_BUILD = 2)
ADCDRV_1ch_CLA 9
;ADCDRV_1ch_CLA 2
CNTL_2P2Z_CLA 1
.ref _tsPtrCLA
MI16TOF32 MR0, @_tsPtrCLA
MADDF32 MR0, #1.0, MR0
MF32TOI16 MR1, MR0
MCMPF32 MR0, #2.0
MMOV16 @_tsPtrCLA, MR1
MNOP
MNOP
MBCNDD TS2_CLA, EQ ;compare done
MNOP ;will happen regardless of branch result
MNOP ;will happen regardless of branch result
MNOP ;will happen regardless of branch result
MCMPF32 MR0, #4.0 ;branch done
MNOP
MNOP
MNOP
MBCNDD TS4_CLA, EQ ;compare done
MNOP ;will happen regardless of branch result
MNOP ;will happen regardless of branch result
MNOP ;will happen regardless of branch result
MCMPF32 MR0, #6.0 ;branch done
MNOP
MNOP
MNOP
MBCNDD TS6_CLA, EQ ;compare done
MNOP ;will happen regardless of branch result
MMOVF32 MR1,#0.0L ;will happen regardless of branch result
MF32TOI16 MR1,MR1 ;will happen regardless of branch result
MBCNDD TS_END, UNCF ;branch done, did not take branch, so leave ISR
MNOP
MNOP
MNOP
TS2_CLA:
ADCDRV_1ch_CLA 10
ADCDRV_1ch_CLA 11
CNTL_2P2Z_CLA 2
...
Question1:
Please give me a detailed explanation of the role of variable tsPtrCLA?
Question2:
Can you indicate, please, a documentation/application note about "tips and tricks" for writting CLA code in ASM language?
Thanks,
Andrei
Hi Andrei,
1) tsPtrCLA is used to time slice the ISR so that only certain tasks are run each ISR - the LLC control loop should run every ISR, each LED control loop only runs 1:6 ISRs. This was done because it was decided that the LED lighting power stages did not require as much control bandwidth.
Because the PWM update macro always contains the PWM updates for two control loops, we chose not to further separate the tasks.
See below for a rough flowchart.
2) I don't know that a 'tips and tricks' document exists for writing in CLA assembly. At the time that this project was developed, the C-compiler for the CLA had not been released. Now that it is has, it is simpler and often just as efficient to write your code for the CLA in C.
(obviously if someone is good at writing assembly, one can still find more efficiency using assembly - but you have to still spend some time to do better than the compiler)
If writing CLA code in assembly, I would note a few things:
1) as seen in the TMDSIACLEDCOMKIT code, doing a comparison or a branch takes time. If you construct your code carefully, it may be possible to complete useful instructions in the delay slots.
2) There are CLA instructions to do things like add and move in parallel. It is advantageous to use these, if possible, for obvious reasons.
3) The following guide will give more details on the CLA - section 5 and 6 will be quite helpful.
http://www.ti.com/lit/spruge6
Hopefully this helps!
Thank you,
Brett