5 – using the arithmetic and logic unit, 1 – selecting the active accumulator, 2 – enabling auto-increment and auto-decrement – Maxim Integrated DS4830A Optical Microcontroller User Manual

Page 193: Ds4830a user’s guide

Advertising
background image

DS4830A User’s Guide

193

Register bits may be set or cleared individually using the MOVE instruction as follows.


move IGE, #1

; set IGE (Interrupt Global Enable) bit

move APC.6, #0

; clear IDS bit (APC.6)

As with other instructions, prefixing is required to select destination registers beyond index 07h.

The MOVE instruction may also be used to transfer any one of the lowest 8 bits from a register source or any bit of
the active accumulator (Acc) to the Carry flag. There is no restriction on the source register module for the ‘MOVE C,
src.bit’ instruction.

move C, IIR.3

; copy IIR.3 to Carry

move C, Acc.7

; copy Acc.7 to Carry

Prefixing is required to select source registers beyond index 15h.


23.5 – Using the Arithmetic and Logic Unit
The DS4830A provides a 16-bit Arithmetic and Logic Unit (ALU) which allows operations to be performed between
the active accumulator and any other register. The DS4830A is equipped with sixteen 16-bit working accumulators.

23.5.1 – Selecting the Active Accumulator
Any of the sixteen accumulator registers A[0] through A[15] may be selected as the active accumulator by setting the
low four bits of the Accumulator Pointer Register (AP) to the index of the accumulator register you want to select.

move AP, #01h

; select A[1] as the active accumulator

move AP, #0Fh

; select A[15] as the active accumulator

The current active accumulator can be accessed as the Acc register, which is also the register used as the implicit
destination for all arithmetic and logical operations.

move A[0], #55h

; set A[0] = 0055 hex


move AP, #00h

; select A[0] as active accumulator

move Acc, #55h

; set A[0] = 0055 hex


23.5.2 – Enabling Auto-Increment and Auto-Decrement
The accumulator pointer AP can be set to automatically increment or decrement after each arithmetic or logical
operation. This is useful for operations involving a number of accumulator registers, such as adding or subtracting
two multibyte integers. If auto-increment/decrement is enabled, the AP register will increment or decrement after any
of the following operations:

• ADD src

(Add source to active accumulator)

• ADDC src

(Add source to active accumulator with carry)

• SUB src

(Subtract source from active accumulator)

• SUBB src

(Subtract source from active accumulator with borrow)

• AND src

(Logical AND active accumulator with source)

• OR src

(Logical OR active accumulator with source)

• XOR src

(Logical XOR active accumulator with source)

• CPL

(Bitwise complement active accumulator)

• NEG

(Negate active accumulator)

• SLA

(Arithmetic shift left on active accumulator)

• SLA2

(Arithmetic shift left active accumulator 2 bit positions)

• SLA4

(Arithmetic shift left active accumulator 4 bit positions)

• SRA

(Arithmetic shift right on active accumulator)

• SRA2

(Arithmetic shift right active accumulator 2 bit positions)

• SRA4

(Arithmetic shift right active accumulator 4 bit positions)

• RL

(Rotate active accumulator left)

• RLC

(Rotate active accumulator left through Carry flag)

• RR

(Rotate active accumulator right)

• RRC

(Rotate active accumulator right through Carry flag)

• SR

(Logical shift active accumulator right)

Advertising