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.
I am calling task1 from an ISR as follow:
__interrupt void
adc_isr1(void)
{
ADCValue_PWM1B = AdcResult.ADCRESULT0;
Cla1ForceTask1();
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; /* Clr ADCINT1 flag for next SOC */
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; /* Acknowledge interrupt to PIE */
}
in the CLA I am modifying the ADC value as follow:
__interrupt void
Cla1Task1 (void)
{
__mdebugstop();
ADCValue1= ADCValue_PWM1B*3;
}
However, the value of ADCValue1 does not change in main, I always read zero. Can anyone advise on how to share variables between CPU and CLA.
here is how I defined my variables inside shared_data.c:
#pragma DATA_SECTION(ADCValue_PWM1B,"CpuToCla1MsgRAM");
Uint16 ADCValue_PWM1B;
#pragma DATA_SECTION(ADCValue1,"Cla1ToCpuMsgRAM");
Uint16 ADCValue1;
I Think I am having issues with data types here:
__interrupt void
Cla1Task1 (void){
__mdebugstop();
ADCValue1= (float)ADCValue_PWM1B*2;
}
With the debugger, I find that ADCValue_PWM1B=485( which is what I expect from my ADC) but when I step further I get a value of: 1905092393 for ADCValue1.
here are my variables declarations again:
#pragma DATA_SECTION(ADCValue_PWM1B,"CpuToCla1MsgRAM");
long ADCValue_PWM1B;
#pragma DATA_SECTION(ADCValue1,"Cla1ToCpuMsgRAM");
long ADCValue1;
unsigned long y;
Any comments?
I have assigned an ADC to trigger an CLA task: AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; I have noticed that the CLA is called only once? can any one tells me what I might be missing?
__interrupt void
Cla1Task1 (void)
{
__mdebugstop();
ADCValue_PWM1B = AdcResult.ADCRESULT0;
ADCValue1= ADCValue_PWM1B*2;
}
__interrupt void
cla1_task1_isr(void)
{
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
PieCtrlRegs.PIEACK.bit.ACK11 = 1;
}