Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a subroutine in HC12 to return the product (multiplication) of two positiv

ID: 648531 • Letter: W

Question

Write a subroutine in HC12 to return the product (multiplication) of two positive eight bit binary numbers (these numbers will be prameters for the subroutine passed in via the stack). Although there is an multiplication command in HC12 (MUL), you are not allowed to use the command for this question (hint: try using a loop and addition command). in your main program, you should test your subroutine by passing in two parameters of your choosing and finally storing the result in memory location $0000. Write a subroutine in HC12 to return the product (multiplication) of two positive eight bit binary numbers (these numbers will be prameters for the subroutine passed in via the stack). Although there is an multiplication command in HC12 (MUL), you are not allowed to use the command for this question (hint: try using a loop and addition command). in your main program, you should test your subroutine by passing in two parameters of your choosing and finally storing the result in memory location $0000. Write a subroutine in HC12 to return the product (multiplication) of two positive eight bit binary numbers (these numbers will be prameters for the subroutine passed in via the stack). Although there is an multiplication command in HC12 (MUL), you are not allowed to use the command for this question (hint: try using a loop and addition command). in your main program, you should test your subroutine by passing in two parameters of your choosing and finally storing the result in memory location $0000.

Explanation / Answer

#include<conio.h>

#include<stdio.h>

int mult(int n1,int n2)

{return(n1*n2);

}

long int convert(long int bn)

{long int rm,num,a=0,b=1;

num=bn;

    while (num > 0)

    {

        rm = num % 10;

        a = a + rm * b;

        b = b * 2;

        num = num / 10;

    }

return a;}

long int convertRes(int bn)

{

void main()

{long int bn1, bn2,mul;

int a,b,res;

printf(

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote