Question

In: Electrical Engineering

Explain following instructions with an example Goto RRF SWAPF XORLW

  1. Explain following instructions with an example
    1. Goto

  1. RRF
  1. SWAPF
  1. XORLW

Solutions

Expert Solution

a) Goto - It stands for "Go to address". This command sends the program flow directly to the other mentioned program line or label.

For ex:- The most simple example

ORG 0x00h; position 0 in the program memory.
BCF PCLATH, 4 ;
BSF PCLATH, 3 ;These two instructions will select page 1.
GOTO Label_1; This command sends program to Label_1 i.e. another page than original position of this instruction
.
.
.
ORG 0xA00h; position 0xA00 in the program memory.
Label_1
.
.
In the above case when the program reaches at GOTO command, it will not execute commands after GOTO but will jump directly to the Label_1 line of the program and will continue from there.

b) RRF - It stands for "Rotate right f through carry bit". Register ' f ' contents are rotated through the Carry Flag one bit to the right.

Ex:- (Syntax - RRF f,d)

(The result will be put in the W register if 'd ' is 0. If 'd ' is 1 the value is returned to the ' f ' register.)

RRF REG1 , 0

Before Instruction
REG1= 1110 0110
W = xxxx xxxx
C = 0
After Instruction
REG1= 1110 0110
W = 0111 0011
C = 0

c) SWAPF - It stands for " Swap nibbles in f ". Nibbles (upper and lower) of register ' f ' are exchanged.

Ex:- (Syntax - SWAPF f , d )

The result will be put in W register if 'd ' is 0. If 'd ' is 1 the result is set in the ' f ' register.

SWAPF REG, 0
Before Instruction
REG1= 0xA5
After Instruction
REG1= 0xA5
W = 0x5A

d) XORLW - It stands for "Exclusive OR Literal with W". The W register's contents are XOR'ed with the 8 bit literal ' k. ' The output will be stored in the W register.

Ex:- (Syntax - XORLW k )

XORLW 0xAF ; 1010 1111 (0xAF)
Before Instruction ;
W = 0xB5 ;     1011 0101 (0xB5)
After Instruction ; --------------------------------
W = 0x1A ; 0001 1010 (0x1A)
Z = 0;

NOTE - Register Z is the register with affected status due to this command.


Related Solutions

Suppose rRF = 8%, rM = 9%, and bi = 1.6. Now suppose rRF decreases to...
Suppose rRF = 8%, rM = 9%, and bi = 1.6. Now suppose rRF decreases to 7%. The slope of the SML remains constant. How would this affect rM and ri? What is ri, the required rate of return on Stock i? Round your answer to two decimal places.   % 1. Now suppose rRF increases to 9%. The slope of the SML remains constant. How would this affect rM and ri? Both rM and ri will remain the same. Both...
Suppose rRF = 3%, rM = 12%, and bi = 1.2. 2. Now suppose rRF decreases...
Suppose rRF = 3%, rM = 12%, and bi = 1.2. 2. Now suppose rRF decreases to 2%. The slope of the SML remains constant. How would this affect rM and ri? -Select-IIIIIIIVVItem 3 What is ri, the required rate of return on Stock i? Round your answer to one decimal place.   % 1. Now suppose rRF increases to 4%. The slope of the SML remains constant. How would this affect rM and ri? Both rM and ri will remain...
Suppose rRF = 3%, rM = 12%, and bi = 1.4. 2. Now suppose rRF decreases...
Suppose rRF = 3%, rM = 12%, and bi = 1.4. 2. Now suppose rRF decreases to 2%. The slope of the SML remains constant. How would this affect rM and ri? -Select-IIIIIIIVVItem 3 What is ri, the required rate of return on Stock i? Round your answer to one decimal place.   % 1. Now suppose rRF increases to 4%. The slope of the SML remains constant. How would this affect rM and ri? Both rM and ri will decrease...
Suppose rRF = 4%, rM = 11%, and bi = 1.5. 2. Now suppose rRF decreases...
Suppose rRF = 4%, rM = 11%, and bi = 1.5. 2. Now suppose rRF decreases to 3%. The slope of the SML remains constant. How would this affect rM and ri? -Select-IIIIIIIVV What is ri, the required rate of return on Stock i? Round your answer to one decimal place. % 1. Now suppose rRF increases to 5%. The slope of the SML remains constant. How would this affect rM and ri? rM will remain the same and ri...
Suppose rRF = 7%, rM = 9%, and bi = 2.2. 2. Now suppose rRF decreases...
Suppose rRF = 7%, rM = 9%, and bi = 2.2. 2. Now suppose rRF decreases to 6%. The slope of the SML remains constant. How would this affect rM and ri? -Select-IIIIIIIVVItem 3 What is ri, the required rate of return on Stock i? Round your answer to two decimal places.   % 1. Now suppose rRF increases to 8%. The slope of the SML remains constant. How would this affect rM and ri? rM will increase by 1% and...
Suppose rRF = 6%, rM = 12%, and bi = 1.7. 2. Now suppose rRF decreases...
Suppose rRF = 6%, rM = 12%, and bi = 1.7. 2. Now suppose rRF decreases to 5%. The slope of the SML remains constant. How would this affect rM and ri? -Select-IIIIIIIVVItem 3 What is ri, the required rate of return on Stock i? Round your answer to one decimal place.   % 1. Now suppose rRF increases to 7%. The slope of the SML remains constant. How would this affect rM and ri? rM will remain the same and...
Suppose rRF = 3%, rM = 12%, and bi = 1.6. 2. Now suppose rRF decreases...
Suppose rRF = 3%, rM = 12%, and bi = 1.6. 2. Now suppose rRF decreases to 2%. The slope of the SML remains constant. How would this affect rM and ri? -Select What is ri, the required rate of return on Stock i? Round your answer to one decimal place.   % 1. Now suppose rRF increases to 4%. The slope of the SML remains constant. How would this affect rM and ri? Both rM and ri will remain the...
Suppose rRF = 4%, rM = 10%, and bi = 1.8. 2. Now suppose rRF decreases...
Suppose rRF = 4%, rM = 10%, and bi = 1.8. 2. Now suppose rRF decreases to 3%. The slope of the SML remains constant. How would this affect rM and ri? -Select-IIIIIIIVVItem 3 What is ri, the required rate of return on Stock i? Round your answer to one decimal place.   % 1. Now suppose rRF increases to 5%. The slope of the SML remains constant. How would this affect rM and ri? rM will remain the same and...
10. Suppose rRF = 6%, rM = 11%, and bi = 1.3. 2. Now suppose rRF...
10. Suppose rRF = 6%, rM = 11%, and bi = 1.3. 2. Now suppose rRF decreases to 5%. The slope of the SML remains constant. How would this affect rM and ri? -Select-IIIIIIIVVItem 3 What is ri, the required rate of return on Stock i? Round your answer to two decimal places. % 1. Now suppose rRF increases to 7%. The slope of the SML remains constant. How would this affect rM and ri? Both rM and ri will...
Suppose rRF = 7%, rM = 11%, and bi = 1.9. 2. Now suppose rRF decreases...
Suppose rRF = 7%, rM = 11%, and bi = 1.9. 2. Now suppose rRF decreases to 6%. The slope of the SML remains constant. How would this affect rM and ri? -Select-IIIIIIIVVItem 3 What is ri, the required rate of return on Stock i? Round your answer to two decimal places.   % 1. Now suppose rRF increases to 8%. The slope of the SML remains constant. How would this affect rM and ri? rM will increase by 1% and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT