Control Law Accelerator (CLA)
C2000 Microcontroller Workshop - Control Law Accelerator
10 - 15
CLA Task Assembly Code Example
.cdecls
"Lab.h"
.sect
"Cla1Prog"
_Cla1Prog_Start:
_Cla1Task1:
; FIR filter
MUI16TOF32 MR2, @_
AdcResult.ADCRESULT0
MMPYF32 MR2, MR1, MR0
MADDF32 MR3, MR3, MR2
MF32TOUI16 MR2, MR3
MMOV16 @_ClaFilteredOutput, MR2
MSTOP
; End of task
;-------------------------------------
_Cla1Task2:
MSTOP
;-------------------------------------
_Cla1Task3:
MSTOP
ClaTasks.asm
.cdecls directive used
to include the C
header file in the CLA
assembly file
.sect directive used to
place CLA assembly
code in its own
section
C Peripheral Register
Header File references
can be used in CLA
assembly code
MSTOP instruction
used at the end of the
task
CLA Initialization Code Example
#include "
F2806x_Cla_typedefs.h
"
#include “
F2806x_Device.h
"
extern Uint16
Cla1Prog_Start
;
extern interrupt void
Cla1Task1
();
extern interrupt void
Cla1Task2
();
extern interrupt void
Cla1Task8
();
Lab.h
#include "Lab.h"
// Symbols used to calculate vector address
Cla1Regs.MVECT1 =
(Uint16)((Uint32)&
Cla1Task1
-
(Uint32)&
Cla1Prog_Start
);
Cla1Regs.MVECT2 =
(Uint16)((Uint32)&
Cla1Task2
-
(Uint32)&
Cla1Prog_Start
);
Cla.c
Defines data types and
special registers
specific to the CLA
Defines register bit
field structures
Symbol for start of CLA
program RAM defined
in Lab.cmd
CLA task prototypes
are prefixed with the
‘interrupt’ keyword
CLA task symbols are
visible to all C28x CPU
and CLA code
MVECTx contains the offset address from the start of the CLA Program RAM
Summary of Contents for C2000 Piccolo LaunchPad
Page 74: ...Interrupts 4 18 C2000 Microcontroller Workshop Reset and Interrupts ...
Page 100: ...Lab 5 System Initialization 5 26 C2000 Microcontroller Workshop System Initialization ...
Page 218: ...Lab 8 IQmath FIR Filter 8 42 C2000 Microcontroller Workshop Numerical Concepts ...
Page 334: ...F28069 controlCARD A 4 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 ...
Page 336: ...F28035 controlCARD A 6 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 SW3 ...