Maker Pro
Maker Pro

maths with PIC16Fxxx

W

Wolfgang Roth

Jan 1, 1970
0
Hey,

I am doing a little project, where i need to calculate timing
parameters for the Timer0...

I want to set up a sub routine, which can take following parameters:

* min border (i.e. 0.8ms -> d'80' in one byte)
* zero (i.e. 1.5ms -> d'150' in one byte)
* max border (i.e. 2.2ms -> d'220' in one byte)
* control value (should be a percentage between -150% and +150%,
so it seems that I need 2 Bytes for it?)

with these 4 Parameters I want to get out a result that tells me how
to set the preload value of timer0 if it is run at 4Mhz and prescaled
by 128:1

I need addition, subtraction, multiplication and division.
I cant see a method of using assembler mnemonics to write the code.

What would you suggest? Writing a 16Bit Integer routine with 'C' and
trying to convert it into assembler?

Or does anybody have these methods in a library?

greetings
Wolfgang
 
Top