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 intel 8088 16 bit code,(The 8088 includes has four 16-bit data registers (AX,...
Write an assembly intel 8088 16 bit code,(The 8088 includes has four 16-bit data registers (AX, BX, CX and DX). BX can also be used as an address register for indirect addressing. The most/least significant byte of each register can also be addressed directly) using push, pop, and stack print the array 9,10,1,2,3,4,5,6,7,8 please show the output .
First clear all your general purpose registers by moving the value “0” into them. Initialize a...
First clear all your general purpose registers by moving the value “0” into them. Initialize a variable for a BYTE, WORD, DWORD storage size each with any desired value in the data segment. Initialize another variable called Result with the size of a DWORD and make the value as an uninitialized value. In the code segment, create a label called L1 that moves the variables in the appropriate sized register and making sure NOT to overwrite them in the process....
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...
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 ";   ...
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...
C++ Goals:Practicing arrays Create a program that will read whole numbers from a file called Labs4-7Mu.dat...
C++ Goals:Practicing arrays Create a program that will read whole numbers from a file called Labs4-7Mu.dat (posted on Canvas)and store it into an array. The number of values in the file is less than 300 and all the values are whole numbers. The actual number of values stored in the file should be determined. Your program should then prompt the user to enter another whole number between 2 and 20 (you may assume the user enters a valid value) and...
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...
Each part of this lab will use the same input file, named “lab3-in.dat.” This file will...
Each part of this lab will use the same input file, named “lab3-in.dat.” This file will be located in the same directory as the executables (do not specify a path for the file in the Select statements). This file is a roster of animals in a travelling carnival. The record format for the file is as follows: Field Description Length Data Type Name 12 String Gender 1 String Species 15 String The end result of each part of this assignment...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT