??? 11/27/04 11:24 Read: times |
#82069 - Shortcuts Responding to: ???'s previous message |
Assuming you know the numeric range of the values you're dealing with, you can make assumptions and thus ease your number problems. The usual method is to have an implied decimal point. For example:your coefficients are normally 0..1, multiply them by a fixed amount, say 100 if you need two decimal places or 1000 if you need 3 decimal places. What you have to watch that is the maximum values of your numbers will fit into the variable type. Normally one would use 'long' (32 bit). Do all your multiplies first then divisions last so you don't loose precision. Be aware of the 'c' rules when mixing different size variables (char,int,long). Also be careful of rounding errors - I fell foul of that one the other day! When debugging, put lots of printf's so you can see where problems occur in your calcs. |
Topic | Author | Date |
help about pid | 01/01/70 00:00 | |
Floating point? | 01/01/70 00:00 | |
Keil floating-point performance | 01/01/70 00:00 | |
Search the forum | 01/01/70 00:00 | |
Floating Point Vs Mixed point | 01/01/70 00:00 | |
You mean Fixed Point | 01/01/70 00:00 | |
Mixed not Fixed | 01/01/70 00:00 | |
Warnings about Floating Point | 01/01/70 00:00 | |
Shortcuts | 01/01/70 00:00 | |
Implied aka Fixed point | 01/01/70 00:00 | |
Another Shortcut | 01/01/70 00:00 | |
Answering the question | 01/01/70 00:00 | |
Autotunning? | 01/01/70 00:00 | |
PID Tricks and Tuning | 01/01/70 00:00 | |
Great Stuff ! | 01/01/70 00:00 | |
I followed your idea... | 01/01/70 00:00 | |
Another couple tricks | 01/01/70 00:00 | |
tests | 01/01/70 00:00 | |
limit cycle tuning![]() | 01/01/70 00:00 | |
PID to control a Peltier | 01/01/70 00:00 | |
An idea to try | 01/01/70 00:00 | |
very fast 20ms ??? | 01/01/70 00:00 | |
20.000, not 2000. | 01/01/70 00:00 | |
very fast 20ms ??? | 01/01/70 00:00 | |
in points... | 01/01/70 00:00 |