Frequently Asked Questions

How much time do math operations take?

Unsigned 8 bit operations are quite fast and floating point is very slow. If possible consider fixed point instead of floating point. For example instead of "float cost_in_dollars;" do "long cost_in_cents;". For trig formulas consider a lookup table instead of real time calculations (see EX_SINE.C for an example). The following are some rough times on a 20 mhz, 14 bit PIC. Note times will vary depending on memory banks used.

8 bit add<1 us
8 bit multiply9 us
8 bit divide20 us
16 bit add2 us
16 bit multiply48 us
16 bit divide65 us
32 bit add5 us
32 bit multiply138 us
32 bit divide162 us
float add32 us
float multiply147 us
float divide274 us
exp()1653 us
Ln()2676 us
sin()3535 us

C-Aware IDE Demo
Embedded C Learners Kit
C Workshop Compiler