Multiplication on MPLAB - PIC16F84A

Status
Not open for further replies.

dannyelloko20

Newbie level 5
Joined
Mar 25, 2015
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
65
I need some help on how to multiply a hex value five times using asm code. Im stuck and cant start my project.

Thanks in advance.
 

Good stuff! However im dealing with a PIC16F84A and the instructions on the link above are different. Thanks though i can actually use the examples they have to get a better idea as to how the logic works.
 

??? those ARE instructions the 16F84A understands. MPLAB creates aliases for the 'skp' instructions, they are mentioned in the MPLAB help files and earlier in the web link.

Trick: if you know the RESULT is going to fit in 8 bits (no greater than 255), you can do it in fewer instructions:

1. enter with the value in W.
2. copy W to a memory location.
3. shift it to the left (now holds 2 * value)
4. shift it to the left (now holds 4 * value)
5. add W to the memory location.

Depending on whether you set W or the memory as the destination, it now holds (value + (value * 4)) = value * 5.

Brian.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…