#165547 - biolizard89 - Fri Dec 26, 2008 10:43 pm
I'm working on an Xport project which needs to process some data within interrupt code (the Xport triggers a cart interrupt when new data arrives, and it needs to be processed immediately). The data processing code has a few floating-point operations. Unfortunately, very weird things happen when the code runs (a variable which is supposed to count up to about 100, one step per interrupt, instead immediately stays constant at a value a bit above 1000). I found that removing the float code causes it to work again.
The float code works perfectly when I call it outside of an interrupt. I've tried using both the Xport cart interrupt as well as the VBlank interrupt, same results, both of them have the problem.
I'm on the Xport version of DevKitAdvance, and since I'm using the Xport, I cannot upgrade to DevKitARM.
Does anyone know if there are problems with doing floating-point math from within interrupt code, particularly with old versions of DevKitAdvance? Any ideas on how I could fix this?
Thanks.
Code: |
// The GetAnalog function returns a short. // This line causes a problem. ir_track_ranges[ir_track_index] = (short)(pow(GetAnalog(ir_track_ir_port)/16.0, -1.078867)*21417.2055); // Replacing the above with this line fixes the problem. ir_track_ranges[ir_track_index] = GetAnalog(ir_track_ir_port); |
The float code works perfectly when I call it outside of an interrupt. I've tried using both the Xport cart interrupt as well as the VBlank interrupt, same results, both of them have the problem.
I'm on the Xport version of DevKitAdvance, and since I'm using the Xport, I cannot upgrade to DevKitARM.
Does anyone know if there are problems with doing floating-point math from within interrupt code, particularly with old versions of DevKitAdvance? Any ideas on how I could fix this?
Thanks.