ADD W,fr |
|
Description: | Add fr into W |
Operation: | W += fr |
Flags affected: | C DC Z |
Registers affected: | W |
Sources referenced: | fr |
Cycles: | 1 |
Opcode: | |
Details: | SX Users Manual page # 70 |
Microchip PIC syntax: | ADDWF fr,0 |
Notes: |
This instruction adds the contents of the specified file register to the contents of W and writes the 8- bit result into W. The file register is left unchanged. The register contents are treated as unsigned values.
If the result of addition exceeds FFh, the C flag is set and the lower eight bits of the result are written to W. Otherwise, the C flag is cleared.
If there is a carry from bit 3 to bit 4, the DC (digit carry) flag is set. Otherwise, the flag is cleared.
If the result of addition is 00h, the Z flag is set. Otherwise, the flag is cleared. An addition result of 100h is considered zero and therefore sets the Z flag.
Affected by the the CF_ bit in FUSEX (DEVICE CARRYX).: If the CF bit in the FUSEX register has been programmed to 0, this instruction also adds the C flag as a carry- in input: W = W + fr + C
Cycles: 1
Example: add W,$ 12
This example adds the contents of file register 12h to W. For example, if the file register contains 81h and W contains 82h, this instruction adds 81h to 82h and writes the lower eight bits of the result, 03h, into W. It sets the C flag because of the carry out of bit 7, and clears the DC flag because there is no carry from bit 3 to bit 4. The Z flag is cleared because the result is nonzero.
See also:
file: /Techref/scenix/inst/addwfr.htm, 3KB, , updated: 2004/4/5 17:35, local time: 2024/11/30 07:49,
3.144.90.236:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/scenix/inst/addwfr.htm"> SX Embedded Controller Instruction - ADD W,fr</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.