View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12829 Members
Join this group to post and comment.
el3ktr1k
el3ktr1k • Jul 15, 2008

Multiplying in a microcontroller

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
r u using assembly language???,if yes then it sure must have or simply use C-lang for programmingit will be easier
el3ktr1k
el3ktr1k • 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?
use keil,its very versatile and popular
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.
https://www.winpicprog.co.uk

why dont ya try PICBASIC PRO https://www.melabs.com/products/pbp.htm

Share this content on your social channels -