CLRW Data Movement

Set the W register to zero.

SyntaxCLRW
Operandsnone
Operation00h → W, 1 → Z
Status bitsZ
Words / cycles1 word, 1 cycle
Encoding00 0001 0xxx xxxx

How it works

CLRW clears W and sets Z. MOVLW 0 also zeroes W but leaves Z alone, so pick CLRW when later code tests Z.

Example

; CLRW example from picsimulator.com/instructions/clrw.html
    list p=16f84a
    include <p16f84a.inc>

    org 0
    movlw 0x55
    clrw              ; W = 0, Z = 1

W is 0 and Z is set.

Open this example in the simulator

Related instructions