I am currently facing a multiplication problem in my Xgate ISR routine. In one of the PIT interrupts , I have written a statement for multiplyiing a variable and #define. The Problem now is , the value is not getting updated correctly.
eg:My ISR routine which calls a function FadeOut() - its defined below
#define CLOCK_MHZ 50 ( done in Xgate.h)
interrupt void Xgate_PIT3(void) {
static unsigned char count1s =0;
p_D_PITTF.p_S_Bits_t.ptf3_u1 = 1;
if(count1s >= 60) {
p_D_PITCE.p_S_Bits_t.pce3_u1= 0;
p_D_PITINTE.p_S_Bits_t.pinte3_u1= 0;
FadeOut();
}
else{
count1s++;
}
}
void FadeOut(){
unsigned long MulRegVal = 0;
MulRegVal = CLOCK_MHZ * (unsigned long)ChargingDutyCycle_u16;
if(MulRegVal > 256){
p_D_PITMTLD0.byte_u8 = 256-1;
p_D_PITLD1.word_u16 = ((MulRegVal/256)-1);
}
else{
p_D_PITMTLD0.byte_u8 = (MulRegVal-1);
p_D_PITLD1.word_u16 = 0;
}
}
say ChargingDutyCycle_u16 = 250
Here the varible MulRegVal does not get the value (50*250) ... but only 250 ...
And additionally , when the statement the executed in the TRUE TIME SIMULATOR, and stepped in one step further, it goes into a function called LMULU(). I have defined the LMULU() as
void LMULU{
}
Why is this function being called? Why is not the value being updated? When I removed the function, its gievin compilation error saying that particular function is missing.
Please Help
Thanks in Advance
已解决! 转到解答。
I'm using CW IDE and don't know how to modify makefile. But paths to XGATE libraries are as follows:
<CW root>\lib\xgatec\lib\ansi_xgi.lib <- no floating point support
<CW root>\lib\xgatec\lib\ansi_xg.lib <- full library, including floating point runtime
Thanks Kef. I dont use CW IDE. So including the library is difficult coz I dont know how. I tried compiling the rtsxgate.cxgate along with the project and but it showed duplicate declaration with rtshc12.c. So I have run out of ideas now.
Please Help
Duplicates for what symbols? A lot of symbols, or just those few you have defined in your code, like LMUL? If many, then maybe XGATE library is already added? If just a cople, then just remove or rename conflicting objects from your code.