Hi,
The CLAsin function from CLAmath library didn't work properly in my project, so I did a few simple experiments.
Here is the testing conditions:
Note: I only used Task1 in my experiments, and CLA_isr was triggered by EPWM1A
========================================================================================
In the Main source file:
#pragma DATA_SECTION(sineStep, "CpuToCla1MsgRAM");
float sineStep;
#pragma DATA_SECTION(SinePointCounter, "Cla1DataRAM");
Uint16 SinePointCounter;
Main ( )
{
Initialize the system and everything necessary.
.............................................
SinePointCounter = 1;
.............................................
Initialize CLA registers
( note: Cla1Regs.MMEMCFG.bit.RAM1E = 1; )
.............................................
sineStep = 0.0138396;
..............................................
Enable the things necessary.
}
=============================================================================================
In the "CLAShared.h" file:
extern Uint16 SinePointCounter;
extern float sineStep;
................................
==============================================================================================
In the "CLA.asm" file:
.cdecls C,LIST,"CLAShared.h"
.include "CLAmathLib_type0.inc"
CLA_DEBUG .set 1
.sect "Cla1Prog"
.align 2
_Cla1Prog_Start:
_Cla1Task1:
.if CLA_DEBUG == 1
MDEBUGSTOP
.endif
..................................................................................................
Experiments Content ---- See bottom
.................................................................................................
MSTOP ; end of task (20)
MNOP
MNOP
MNOP
_Cla1T1End:
===================================================================================================
Experiments Content
experiment1:
MMOV32 MR0, @_SinePointCounter
CLAsin result, sineStep
.......................................................
In the watch window, SinePointCounter is equal to 1 ( correct), and result is also correct.
experiment2:
MMOV32 MR0, @_SinePointCounter
MMOV32 @_SinePointCounter, MR0
CLAsin result, sineStep
.........................................................................................
In the watch window, SinePointCounter is equal to 1 ( correct), and result is also correct.
experiment3:
MMOV32 MR0, @_SinePointCounter
CLAsin result, sineStep
MMOV32 @_SinePointCounter, MR0
.........................................................................................
In the watch window, SinePointCounter is equal to 0 ( Wrong ) , and result is correct.
I hope someone could help me understand why Experiment #3 didn't work.
Thank you.