2.1 Example 1 – Basic Usage

The first example shows an assembly code that reads the port B input value and multiplies this value with a constant (5) before storing the result in register pair R17:R16.
in r16,PINB ; Read pin values
ldi r17,5 ; Load 5 into r17
mul r16,r17 ; r1:r0 = r17 * r16
movw r17:r16,r1:r0 ; Move the result to the r17:r16 register pair

Note the use of the MOVW instruction. This example is valid for all of the multiply instructions.

Figure 2-1. Register Restrictions