Topic : Math Calc Issue in Raisonance

Forum : 8051

Original Post
Post Information Post
October 23, 2007 - 7:54pm
Guest

I have some code I developed using the eval Keil 8051 compiler. I've now purchased the Raisonance compiler and am experiencing a problem in a calculation. This calc worked fine in the eval Keil compiler.

The code uses input captures on an NXP LPC936 to measure input pulse periods for two spinning motors (1 pulse per revolution), and the calculations convert the periods to equivalent RPM's. In Keil both the measured periods and calculated RPM's are very stable. In Raisonance the period measurements are stable, but the calculated RPM's fall out and jump dramatically. It appears the calculations are getting messed up, since the period values are stable.

Partial Code:

#define rpm_conversion 230400*60 (ccu freq x 60 sec/min = ccu counts/min)

unsigned int RPM_A;
unsigned int RPM_B;

unsigned long period_A;
unsigned long period_B;

void main(void)
{

//init ccu & ports

while(1)
{
RPM_A = (unsigned int) (rpm_conversion/period_A);
// ccu counts/min x 1 rev/ccu counts per period = rev/min

RPM_B = (unsigned int) (rpm_conversion/period_B);
// ccu counts/min x 1 rev/ccu counts per period = rev/min

// print period & rpm to LCD display
}

}

This code is rock solid compiled in Keil, but with Raisonance the RPM values are inconsistent. The RPM calcs are correct, then occassionally they drop or go to 0, and then return to being correct. Meanwhile, the period values remain steady.

Any thoughts?

Thanks

Replies
Post Information Post
+1
0
-1
October 24, 2007 - 8:20pm
Guest

It could be timing related to reading the TPU registers. The execution timing will be different for the 2 compilers