ADD fr,W |
|
Description: | Add W into fr |
Operation: | fr += W |
Flags affected: | C DC Z |
Registers affected: | fr |
Sources referenced: | W |
Cycles: | 1 |
Opcode: | 0001 111f ffff |
Details: | SX Users Manual page # 69 |
Microchip PIC syntax: | ADDWF fr,1 |
Notes: |
This instruction adds the contents of W to the contents of the specified file register and writes the 8- bit result into the same file register. W 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 the file register. 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 configuration register has been programmed to 0, this instruction also adds the C flag as a carry- in input:
fr = fr + W + C
Cycles: 1
Example: add $12, W
This example adds the contents of W to file register 12h. For example, if the file register contains 7Fh and W contains 02h, this instruction adds 02h to 7Fh and writes the result, 81h, into the file register; and clears the C and Z flags. It sets the DC flag because of the carry from bit 3 to bit 4.
If fr is 2 (the program counter) on the SX 18 and 28, no carry of the addition from bit 7 to bit 8 is performed. This means that relative jumps are restricted to the half page of 256 instructions from which the jump originates. Also, as far as I can tell, despite this not being documented anywhere, adding an 8 bit value to the PC results in CLEARING the 9th bit (bit 8) of the PC. So you can only do relative jumps intp the first half page of each page. Just like calls
file: /Techref/scenix/inst/addfrw.htm, 4KB, , updated: 2004/4/5 17:35, local time: 2024/11/8 14:20,
3.147.66.72:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©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://sxlist.com/techref/scenix/inst/addfrw.htm"> SX Embedded Controller Instruction - ADD fr,W</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.