CrazyEngineers
  • Multiplying in a microcontroller

    el3ktr1k

    Member

    Updated: Oct 21, 2024
    Views: 1.0K
    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
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • sauravgoswami

    MemberJul 16, 2008

    r u using assembly language???,if yes then it sure must have or simply use C-lang for programmingit will be easier
    Are you sure? This action cannot be undone.
    Cancel
  • el3ktr1k

    MemberJul 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?
    Are you sure? This action cannot be undone.
    Cancel
  • sauravgoswami

    MemberJul 16, 2008

    use keil,its very versatile and popular
    Are you sure? This action cannot be undone.
    Cancel
  • sauravgoswami

    MemberJul 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-#
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register