Connect with us

maths with PIC16Fxxx

Discussion in '8bit Microcontrollers' started by Wolfgang Roth, Apr 13, 2004.

Scroll to continue with content
  1. 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?

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day