This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TIMER_setPreScaler code bug

Other Parts Discussed in Thread: MOTORWARE

Hello,

in timer.c, (as supplied with motorware_13, unchanged from earlier versions):

    timer->TPR |= ((uint32_t)(preScaler & 0xFF00) << 16) | ((uint32_t)(preScaler & 0x00FF) << 8);

I think this should be:

    timer->TPR = ((uint32_t)(preScaler & 0xFF00) << 8) | ((uint32_t)(preScaler & 0x00FF));

To get the correct bitshift, and also do not *OR* as that will give strange results when modifying  a non-zero prescaler.

Regards,

Harry