Tomás Ó hÉilidheemail (remove spam text)
> is it possible to do multiplication or division on two registers, instead of
> one being a literal constant?
Ehm I sure hope so, otherwise I think you'd have a crippled processor.
Take the following simple code for instance:
int i = GetInputFromPortOrWhatever();
int j = GetInputFromPortOrWhatever();
PORTC = i * j;
> lets say i have a routine that flashes an led
> "x" number of times with "t" amount of time between flashes. i would like to
> write a routine that instead of feeding the first routine t; it would take
> the "total time" (in ms) i want the flashing routine to run for, and divide
> it by "x", to get "t". so each time it is executed, "x" and "total time" may
> me different.
I did something very similar to this in my Connect4 project. Reading
your paragraph above I can only assume that the LED is on for the same
amount of time that it's off.
(Disclaimer: Rushed, unchecked code likely to contain a bug or two)
void FlashLED(unsigned const amount_flashes, long unsigned const
long unsigned const delay = duration / amount_flashes / 2;
RA0 = 1;
RA0 = 0;
} while (--amount_times);
In reply to: <email@example.com>
See also: www.piclist.com/techref/microchip/math/index.htm?key=multiplication
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the