Multiplication with PIC18F458

Please check the frequently asked questions before posting to the forum.
Post Reply
Author
Message
Assia
Posts: 3
Joined: 15 May 2014 19:53

Multiplication with PIC18F458

#1 Post by Assia » 15 May 2014 20:38

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. :)

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Multiplication with PIC18F458

#2 Post by marina.petrovic » 16 May 2014 14:36

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

Assia
Posts: 3
Joined: 15 May 2014 19:53

Re: Multiplication with PIC18F458

#3 Post by Assia » 16 May 2014 15:45

Hi,
Thank u for u answer but can u send me a direct link please ,,i'm kind of lost!!

Kind regards,,
Assia.

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Multiplication with PIC18F458

#4 Post by marina.petrovic » 20 May 2014 08:48

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

Post Reply

Return to “mikroPascal FAQ”