Forum : 8051
Post Information | Post |
---|---|
October 23, 2007 - 7:54pm
|
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 long period_A; void main(void) //init ccu & ports while(1) RPM_B = (unsigned int) (rpm_conversion/period_B); // 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 |
It could be timing related to reading the TPU registers. The execution timing will be different for the 2 compilers