[Menu]>[Guide to use the PIC]


Instruction spec (4) of PIC16 series


Instruction set


COMFComplement f
Form [label]COMFf, d
( label is omitable, shows SPACE code )
Operands f : Register file addesss ( 00(00h) to 127(7Fh) )
d : Destination select ( 0 or 1 )
Operation It executes the complementary operation of the contents of the f register.(Not 2's Complement)
d = 0 : store result in W
d = 1 : store result in f
(EX)
Flag When the result is 0, it sets 1 to the Z flag.
When the result is not 0, it sets 0 to the Z flag.
Instruction
cycles
1 cycle



DECFDecrement f
Form [label]DECFf, d
( label is omitable, shows SPACE code )
Operands f : Register file addesss ( 00(00h) to 127(7Fh) )
d : Destination select ( 0 or 1 )
Operation It subtracts 1 from the contents of the f register.
d = 0 : store result in W
d = 1 : store result in f
(EX)
Flag When the result is 0, it sets 1 to the Z flag.
When the result is not 0, it sets 0 to the Z flag.
Instruction
cycles
1 cycle


DECFSZDecrement f, Skip if 0
Form [label]DECFSZf, d
( label is omitable, shows SPACE code )
Operands f : Register file addesss ( 00(00h) to 127(7Fh) )
d : Destination select ( 0 or 1 )
Operation It subtracts 1 from the contents of the f register.
d = 0 : store result in W
d = 1 : store result in f
In case of the result of the subtraction is 0, it changes the following instruction into the NOP and executes it. (It executes the instruction of the present address +2.)
FlagNo change
Instruction
cycles
1 cycle
When skipping, it is 2 cycles.


GOTOGo to address
Form [label]GOTOk
( label is omitable, shows SPACE code )
Operandsk : literal field ( 000(000h) to 2047(7FFh) )
Operation It jumps unconditionally to the address which the literal field shows.
It sets the literal value to 11 bits of lower part of program counter (PC) and it sets the bit 3 and 4 of the PCLATH register to 2 bits of higher part.
FlagNo change
Instruction
cycles
2 cycles


Next instructions