|Description:||Add W into fr|
|Operation:||fr += W|
|Flags affected:||C DC Z|
|Opcode:||0001 111f ffff|
|Details:||SX Users Manual page # 69|
|Microchip PIC syntax:||ADDWF fr,1|
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
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
SX Instruction ADD fr,#lit +
|file: /Techref/scenix/inst/addfrw.htm, 4KB, , updated: 2004/4/5 18:35, local time: 2020/10/21 03:26,
|©2020 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://www.piclist.com/techref/scenix/inst/addfrw.htm"> SX Embedded Controller Instruction - ADD fr,W</A>
|Did you find what you needed?|
PICList 2020 contributors:
o List host: MIT, Site host massmind.org, Top posters @20201021 Bob Blick, RussellMc, madscientistatlarge, Jason White, Neil, David C Brown, Sean Breheny, Harold Hallikainen, James Cameron, Allen Mulvey,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!