Question
Write a PIC24 assembly program!! to count the number of bits being set to 1 in a given data field. Your program should do the
Write a PIC24 assembly program!! to count the number of bits being set to 1 in a given data field.
Your program should do the followings:
- Allocate an 8-bit variable called "count"
- Allocate an 8-bit variable called "len"
- Allocate a space called "id" with enough bytes to hold a studentID. (For example, 001234567 needs 9 bytes, 1 per decimal digit).
- Store YOUR studentID to "id" and set "len" to the correct value. (For example, the above student ID can be saved as: 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07)
- Write a loop to read in the bytes in "id" and count the number of bits being set to 1. (In the example above, for ID 001234567, the total number of bits set to 1 is: 12).
- Save the total number of bits being set to 1 in variable "count"
You must submit the followings:
- source file (.s)
- screenshot of successful result when you assemble your program
- screenshot of final SFR showing all working registers used in the program
- screenshot of Register Files showing "count", "len", "id" and their final values
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started