English
Language : 

C8051F120 Datasheet, PDF (171/356 Pages) Silicon Laboratories – Mixed Signal ISP Flash MCU Family
C8051F120/1/2/3/4/5/6/7
C8051F130/1/2/3
The example below implements the equation:
(0.5 × 0.25) + (0.5 × –0.25) = 0.125 – 0.125 = 0.0
MOV MAC0CF, #0Ah
MOV MAC0AH, #40h
MOV MAC0AL, #00h
MOV MAC0BH, #20h
MOV MAC0BL, #00h
MOV MAC0BH, #E0h
MOV MAC0BL, #00h
NOP
NOP
NOP
; Set to Clear Accumulator, Use fractional numbers
; Load MAC0A register with 4000 hex = 0.5 decimal
; Load MAC0B register with 2000 hex = 0.25 decimal
; This line initiates the first MAC operation
; Load MAC0B register with E000 hex = -0.25 decimal
; This line initiates the second MAC operation
; After this instruction, the Accumulator should be equal to 0,
; and the MAC0STA register should be 0x04, indicating a zero
; After this instruction, the Rounding register is updated
Figure 12.5. Multiply and Accumulate Example
The example below implements the equation:
4660 × –292 = –1360720
MOV MAC0CF, #01h
MOV MAC0AH, #12h
MOV MAC0AL, #34h
MOV MAC0BH, #FEh
MOV MAC0BL, #DCh
NOP
NOP
NOP
; Use integer numbers, and multiply only mode (add to zero)
; Load MAC0A register with 1234 hex = 4660 decimal
; Load MAC0B register with FEDC hex = -292 decimal
; This line initiates the Multiply operation
; After this instruction, the Accumulator should be equal to
; FFFFEB3CB0 hex = -1360720 decimal. The MAC0STA register should
; be 0x01, indicating a negative result.
; After this instruction, the Rounding register is updated
Figure 12.6. Multiply Only Example
Rev. 1.3
173