Page 1 of 1

Multiplication with PIC18F458

Posted: 15 May 2014 20:38
by Assia
HELLO,
Here's my problem:
i'd like to do a multiplication with PIC18F448 only, so i've two variabls X1 configured on PORTB 8bits & X2 configured on PORTC 4bits,
i've got to read whats on X1 & X2 first then do M=X1*X2; as 0*1, 0*....til 15*255 so i need 4 digit seven segments display maximum, on PORTA.
All i knw is
VAR X1,X2 : byte; M: word;
Begin
trisB:=0;
trisc:=0;
trisa:=0;
For x1:= 0 to 255 do
begin
For x2:= 0 to 15 do
begin
M:=x1*x2;
porta:=M; setbit(), delay_ms(1000); clearbit()// dont know how to configur this too :oops:
end;
end;

end.

i dnt knw how to decode all that for the 4 digits,,shoud i use
Function decode(M:word):word;
begin
if M:=o then decode:=$c0;
if M:=1 then decode:=$f9;


if M:=3225 then decode:=$0C99;
end;

but its toooo loo...ooong :roll:
All i've is a pic18F458 & 4digits seven segments display,,

Thanks in advance. :)

Re: Multiplication with PIC18F458

Posted: 16 May 2014 14:36
by marina.petrovic
Hi,

Did you take a look at simple Seven Segment Display example from compiler:
...\mikroPascal PRO for PIC\Examples\Development Systems\EASYPIC7\Seven Segment Display

You can adjust the example for microcontroller that you use and test it on your hardware.

Best regards,
Marina

Re: Multiplication with PIC18F458

Posted: 16 May 2014 15:45
by Assia
Hi,
Thank u for u answer but can u send me a direct link please ,,i'm kind of lost!!

Kind regards,,
Assia.

Re: Multiplication with PIC18F458

Posted: 20 May 2014 08:48
by marina.petrovic
Hi,

In my previous answer I send you path in compiler where you can find the example.
There is no direct link for the example that I mentioned.

Best regards,
Marina