Jeremy Leach
Senior Member
Hi all. I've finally written up a little set of PICAXE routines that may prove useful in performing more accurate maths. It is all based on a simple number format using fractions.
In addition, there is a 'macro' facility to allow complex equations to be calculated, for instance PID algorithms.
I must admit, that although I've tested the Demo code in the simulator, I haven't used it in real life yet - so I can't be sure it is completely error-free. However I thought I'd post it rather than hold onto it, because it might come in handy.
I've also written up an explanation in the accompanying pdf. Some of it is a little deep but I've tried to explain it as best I can.
Oh, and PS, the simulator seems to throw a wobbly when left free-running through the Division part of the demo, saying 'stack overflow', but it simulates ok when single stepping - not sure what's going on here but perhaps it's a Sim issue (saying 'perhaps' because maybe it's my code still!).
In addition, there is a 'macro' facility to allow complex equations to be calculated, for instance PID algorithms.
I must admit, that although I've tested the Demo code in the simulator, I haven't used it in real life yet - so I can't be sure it is completely error-free. However I thought I'd post it rather than hold onto it, because it might come in handy.
I've also written up an explanation in the accompanying pdf. Some of it is a little deep but I've tried to explain it as best I can.
Oh, and PS, the simulator seems to throw a wobbly when left free-running through the Division part of the demo, saying 'stack overflow', but it simulates ok when single stepping - not sure what's going on here but perhaps it's a Sim issue (saying 'perhaps' because maybe it's my code still!).
Attachments
-
53.1 KB Views: 428
-
14.7 KB Views: 288