|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#11
|
|||
|
|||
|
Re: Servo 'smoothing'
Quote:
DON'T OVER OPTIMIZE A fixed point multiply takes two or three clock cycles to execute. A single precision floating point multiply takes three clock cycles to execute. A double precision floating point multiply takes four clock cycles to execute. In addition to the "execute" phase, each instruction must also go through fetch, decode/dispatch, and complete, which adds three more clock cycles. Simply put, the difference between single fixed or floating instructions just don't matter any more. What will matter is how many instructions. By converting to fixed point math (and adding the shift instructions), you actually slowed down the filter. To make things even more interesting, the processor is capable of dispatching up to 2 instructions per clock, but only if they are different types of instructions: You can dispatch a fixed point and a floating point instruction simultaneously, but you can't do the same with two fixed point instructions. This means that you are *much* better off allowing a compiler to order your instructions. Write what you mean, and trust in the compiler. - Eric (with a C) PS: Eliminating divides are almost worth your time. Fixed point divides take 20 cycles to execute. Floating point divides take 18 (single precision) or 33 (double precision) cycles to execute. For reference sake, a double precision divide on the cRIO takes about the same amount of time as an 8 bit fixed point instruction on the PIC. However, it will also be executing fixed point math while the FPU is working on the divide. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Data Smoothing | Lafleur | Programming | 3 | 14-01-2008 22:06 |
| Servo behavior question / advanced servo/PIC programming question | DanL | Electrical | 12 | 18-10-2005 18:33 |
| Servo Values | DanDon | Motors | 8 | 14-02-2005 15:49 |
| Buying Servo | Gamer930 | Motors | 4 | 13-02-2005 20:44 |
| Servo | MASherry | General Forum | 6 | 04-10-2004 22:46 |