Page 1 of 1

PIC16F84A Questions

PostPosted: Thu Nov 17, 2022 8:35 am
by alp6
Hello everyone, I have couple questions which I couldn't solve. I would be very grateful if anyone could help me with the questions I shared below.

1- Assume X1 and X2 are 24 bit numbers. In your program, for each number allocate 3 bytes in RAM. Define a number for X1 greater than X2. Subtract X2 from X1.

2- Write an assembly program that counts the number of 1s in an 8-bit number, Y1. In your program, define the test value Y1 and hold the number of 1s in a register called RESULT.

3- Write a program that checks whether a number stored in Z1 is even or odd. If Z1 is even set a register R to 1 and otherwise, clear it.

Thanks. :)

Re: PIC16F84A Questions

PostPosted: Thu Nov 17, 2022 11:22 pm
by ric
This does look a lot like homework.
We won't just do it for you, but if you show what you have attempted, and explain which bit is a problem, we can guide.
Is this all to be in assembly language? Only the second one mentions a language.
If you are writing in assembly language, we need to know which version of MPLAB or MPLABX you are using. The syntax changed a lot when Microchip changed from MPASM to PIC-AS in MPLABX version 5.40