Multiplying in a microcontroller

el3ktr1k

el3ktr1k

@el3ktr1k-Tt5S33 Oct 21, 2024

I'm doing a project with a PIC16F877 and I was wondering how I can multiply by a decimal number. Suppose for example I wanted to do 10*2.73. It seems like this pic doesn't have any instructions for multiplication. Thanks for any help

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • sauravgoswami

    sauravgoswami

    @sauravgoswami-UAfTlI Jul 16, 2008

    r u using assembly language???,if yes then it sure must have or simply use C-lang for programmingit will be easier

  • el3ktr1k

    el3ktr1k

    @el3ktr1k-Tt5S33 Jul 16, 2008

    Yes I was doing this in assembly. I got the microcontroller to control motors without any feedback but now that I need to implement a PI controller, I may have to switch to programming in C. Do you know of any free C compilers that will work with the pic16F877?

  • sauravgoswami

    sauravgoswami

    @sauravgoswami-UAfTlI Jul 16, 2008

    use keil,its very versatile and popular

  • sauravgoswami

    sauravgoswami

    @sauravgoswami-UAfTlI Jul 16, 2008

    When you say MPLAB, do you mean assembly or C18? MPLAB is a design environment pkg, not a language, compiler, or assembler itself.

    C18 has a floating point lib already available. As noted, fp is extremely cycle-intensive and rarely necessary. If it's essential, fine, but it rarely is. Even the task you mention would seem better served by understand the task well enough to fit the numbers into 32 bit integers. These will be hundreds of times faster than fp.

    If you're doing assembly, making your own 64 bit integer data type is possible if you modify your math routines. That'll still be much faster.
    #-Link-Snipped-#

    why dont ya try PICBASIC PRO #-Link-Snipped-#