Question

Write some PIC code to count how many file registers contain the value 0. Do this...

Write some PIC code to count how many file registers contain the value 0. Do this by examining each file register (0x00 - 0xff) using indirect addressing. At the end of the code, the W register should contain the count of registers containing 0.

Homework Answers

Answer #1

Answer :- The code has been written below-

CountLoop EQU 0x00 ;store value 0 in counter variable
Count1 EQU 0x00 ;store value 0 in counter variable
MOVLW 0x00 ;W = 0
MOVWF FSR ;FSR = 0
Loop1: ;label name Loop1
MOVF INDF, W ;read location value stored in FSR and keep in W, so W = value at the location in FSR
ANDLW 0xFF ;W = W & 0xFF
BTFSC STATUS, 2 ;check if zero flag is clear then skip next statement
GOTO CountZero ;goto label CountZero
Back1:
INCF FSR ;increase the FSR value to next location
INCFSZ CountLoop ;increment the counter, skip next line if zero
GOTO Loop1 ;goto Loop1

Here : GOTO Here ;end of the code

CountZero:
INCF Count1 ;increment the counter value
MOVF Count1, W ;set W = counted zero value
GOTO Back1 ;go to label named as Back1

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write an assembly program that reads characters from standard input until the “end of file” is...
Write an assembly program that reads characters from standard input until the “end of file” is reached. The input provided to the program contains A, C, T, and G characters. The file also may have new line characters (ASCII code 10 decimal), which should be skipped/ignored. The program then must print the count for each character. You can assume (in this whole assignment) that the input doe not contain any other kinds of characters.  the X86 assembly program that simply counts...
QUESTION 1 During a single clock tick, how many 64-bit values can be written to an...
QUESTION 1 During a single clock tick, how many 64-bit values can be written to an input of a register file with 8 64-bit registers (i.e. an 8x64 register file)? QUESTION 2 Suppose you are designing a processor that contains a register file with 32 32-bit registers (i.e. a 32x32 register file). What is the minimum number of bits required in order to select which register is being written to? QUESTION 3 If the decimal value, 30, is shifted to...
1.      Create 100 text files automatically; in each file write a random number from 1 to 10....
1.      Create 100 text files automatically; in each file write a random number from 1 to 10. Use outputstreams (fileoutputstream, buffredwriter….) 2.      Read the content of the 100 files and combine them into a 1 single file. 3.      Write java code to do the following: a.      To write the following text into a text file EEEESAAA@23SDCFSAWERF%WASDFGHWERTRQW b.      Read the file using a java program c.      Find how many D’s in the file d.      Extract the text between the @ and the # 1. Create 100 text files...
How do I make this code not include negative numbers in the total or average if...
How do I make this code not include negative numbers in the total or average if they are entered? (C++) For example, if you enter 4, 2, and -2, the average should not factor in the -2 and would be equal to 3. I want the code to factor in positive numbers only. ----- #include using namespace std; int main() {    int x, total = 0, count = 0;       cout << "Type in first value ";   ...
How do you write x86 assembly code for the above main procedure and Addarrays function? Main()...
How do you write x86 assembly code for the above main procedure and Addarrays function? Main() {      int A[100];      int   B[100];      // initialization etc.      length = 100;      Call Addarrays(A, B, length) } Addarrays(int[] X, int[] Y, count) {    i = 0;    while (i < count) {        X[i] = X[i] + Y[i];         I++    } }
Please provide commenting of code so I can understand how to solve this problem. Please provide...
Please provide commenting of code so I can understand how to solve this problem. Please provide text files. Using C++ Write a program that reads a given file, and then outputs the contents of it to another file. It should also print out the number of lines and the number of times each alphabetic character appears (regardless of case) in the input file at the end of the output file. It should prompt the user for the input and output...
Write an ARM assembly language program that counts the number of 1’s for any value in...
Write an ARM assembly language program that counts the number of 1’s for any value in R0. The program must assemble/compile in KEIL and must be able to run in the KEIL simulator. Generally, R0 may contain any value, but for purpose of this exercise, you may move 0x2345ABCD into R0. The number in R0 does not need be preserved. You may use any other registers as you need. The result, total count of 1’s in R0, should be in...
Q1) Write a Python function partial_print, which takes one parameter, a string, and prints the first,...
Q1) Write a Python function partial_print, which takes one parameter, a string, and prints the first, third, fifth (and so on) characters of the strings, with each character both preceded and followed by the ^ symbol, and with a newline appearing after the last ^ symbol. The function returns no value; its goal is to print its output, but not to return it. Q2) Write a Python function called lines_of_code that takes a Path object as a parameter, which is...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import java.io.*; //This imports input and output (io) classes that we use 3 //to read and write to files. The * is the wildcard that will 4 //make all of the io classes available if I need them 5 //It saves me from having to import each io class separately. 6 /** 7 This program reads numbers from a file, calculates the 8 mean (average)...
The following code to run as the described program on python. The extra test file isn't...
The following code to run as the described program on python. The extra test file isn't included here, assume it is a text file named "TXT" with a series of numbers for this purpose. In this lab you will need to take a test file Your program must include: Write a python program to open the test file provided. You will read in the numbers contained in the file and provide a total for the numbers as well as the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT