Write code for the PIC16F1829 Problem solving using shift and byte-test-skip ins
ID: 3868270 • Letter: W
Question
Write code for the PIC16F1829
Problem solving using shift and byte-test-skip instructions: The following C code counts the number of "1" bits in j and returns the answer in k. The operation j & 0 times 01 tests the value of the LSb of j. k = 0;//init bit count for (i = 0: i! = 8: i++) {//do for 8 bits if (j & 0 times 01) { k++;//LSb = 1, increment count j = j > > 1;//look at next bit } Write an assembly program and single step the program to verify the result. You need to assign an initial number for the file register j.Explanation / Answer
Micro Processor 8085 code :-
MVI B, 00H
MVI C, 08H
MOV A, D
BACK: RAR
JNC SKIP
INR B
SKIP: DCR C
JNZ BACK
HLT
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.