PIC18 cheatsheet

MULLW

Detailed reference for the MULLW instruction in PIC18 ISA.

Description

Multiply the contents of WREG by an 8‑bit literal value and store the 8‑bit product back into WREG. The upper byte of the 16‑bit product is discarded.

Examples

; Multiply W by 2, result in W
MULLW 0x02  ; W = W * 2
; Multiply W by 16, result in W
MULLW 0x10  ; W = W * 16
; Multiply W by 255, overflow truncates the high byte
MULLW 0xFF  ; W = W * 255
; Multiply W by 0, zero out W
MULLW 0x00  ; W = 0
; Load W with 0x03, then multiply by 5 => W = 0x03 * 5
MOVLW 0x03
MULLW 0x05  ; W = 0x03 * 5