# SAM3S ACC

## Analog Comparator Controller (ACC) User Interface

### Registers

Register Mapping
Address | Register | Name | Access | Reset
--- | --- | --- | --- | ---
0x40040000 | Control Register | ACC_CR | write-only | -
0x40040004 | Mode Register | ACC_MR | read-write | 0x00000000
0x40040024 | Interrupt Enable Register | ACC_IER | write-only | -
0x40040028 | Interrupt Disable Register | ACC_IDR | write-only | -
0x4004002C | Interrupt Mask Register | ACC_IMR | read-only | 0x00000000
0x40040030 | Interrupt Status Register | ACC_ISR | read-only | 0x00000000
0x40040094 | Analog Control Register | ACC_ACR | read-write | 0x00000000
0x400400E4 | Write Protect Mode Register | ACC_WPMR | read-write | 0x00000000
0x400400E8 | Write Protect Status Register | ACC_WPSR | read-only | 0x00000000

### Register Fields

#### ACC Control Register

Name: ACC_CR

Access: write-only

Address: 0x40040000

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | SWRST

- SWRST: SoftWare ReSeT

  Value | Name | Description
  --- | --- | ---
  0 | - | no effect.
  1 | - | resets the module.

#### ACC Mode Register

Name: ACC_MR

Access: read-write

Address: 0x40040004

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | FE | SELFS | INV | - | EDGETYP | ACEN
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | SELPLUS | - | SELMINUS

- SELMINUS: SELection for MINUS comparator input

  Value | Name | Description
  --- | --- | ---
  0x0 | TS | SelectTS
  0x1 | ADVREF | Select ADVREF
  0x2 | DAC0 | Select DAC0
  0x3 | DAC1 | Select DAC1
  0x4 | AD0 | Select AD0
  0x5 | AD1 | Select AD1
  0x6 | AD2 | Select AD2
  0x7 | AD3 | Select AD3

- SELPLUS: SELection for PLUS comparator input

  Value | Name | Description
  --- | --- | ---
  0x0 | AD0 | Select AD0
  0x1 | AD1 | Select AD1
  0x2 | AD2 | Select AD2
  0x3 | AD3 | Select AD3
  0x4 | AD4 | Select AD4
  0x5 | AD5 | Select AD5
  0x6 | AD6 | Select AD6
  0x7 | AD7 | Select AD7

- ACEN: Analog Comparator ENable

  Value | Name | Description
  --- | --- | ---
  0 | DIS | Analog Comparator Disabled.
  1 | EN | Analog Comparator Enabled.

- EDGETYP: EDGE TYPe

  Value | Name | Description
  --- | --- | ---
  0x0 | RISING | only rising edge of comparator output
  0x1 | FALLING | falling edge of comparator output
  0x2 | ANY | any edge of comparator output

- INV: INVert comparator output

  Value | Name | Description
  --- | --- | ---
  0 | DIS | Analog Comparator output is directly processed.
  1 | EN | Analog Comparator output is inverted prior to being processed.

- SELFS: SELection of Fault Source

  Value | Name | Description
  --- | --- | ---
  0 | CF | the CF flag is used to drive the FAULT output.
  1 | OUTPUT | the output of the Analog Comparator flag is used to drive the FAULT output.

- FE: Fault Enable

  Value | Name | Description
  --- | --- | ---
  0 | DIS | the FAULT output is tied to 0.
  1 | EN | the FAULT output is driven by the signal defined by SELFS.

#### ACC Interrupt Enable Register

Name: ACC_IER

Access: write-only

Address: 0x40040024

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | CE

- CE: Comparison Edge

  Value | Name | Description
  --- | --- | ---
  0 | - | no effect.
  1 | - | enables the interruption when the selected edge (defined by EDGETYP) occurs.

#### ACC Interrupt Disable Register

Name: ACC_IDR

Access: write-only

Address: 0x40040028

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | CE

- CE: Comparison Edge

  Value | Name | Description
  --- | --- | ---
  0 | - | no effect.
  1 | - | disables the interruption when the selected edge (defined by EDGETYP) occurs.

#### ACC Interrupt Mask Register

Name: ACC_IMR

Access: read-only

Address: 0x4004002C

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | CE

- CE: Comparison Edge

  Value | Name | Description
  --- | --- | ---
  0 | - | the interruption is disabled.
  1 | - | the interruption is enabled.

#### ACC Interrupt Status Register

Name: ACC_ISR

Access: read-only

Address: 0x40040030

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
MASK | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | SCO | CE

- CE: Comparison Edge

  Value | Name | Description
  --- | --- | ---
  0 | - | no edge occurred (defined by EDGETYP) on analog comparator output since the last read of ACC_ISR register.
  1 | - | a selected edge (defined by EDGETYP) on analog comparator output occurred since the last read of ACC_ISR register.

- SCO: Synchronized Comparator Output

-

- MASK

  Value | Name | Description
  --- | --- | ---
  0 | - | The CE flag is valid.
  1 | - | The CE flag and SCO value are invalid.

#### ACC Analog Control Register

Name: ACC_ACR

Access: read-write

Address: 0x40040094

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | HYST | ISEL

- ISEL: Current SELection

  Value | Name | Description
  --- | --- | ---
  0 | LOPW | low power option.
  1 | HISP | high speed option.

- HYST: HYSTeresis selection

-

#### ACC Write Protect Mode Register

Name: ACC_WPMR

Access: read-write

Address: 0x400400E4

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
WPKEY
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
WPKEY
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
WPKEY
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | WPEN

- WPEN: Write Protect Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | disables the Write Protect if WPKEY corresponds to 0x414343 ("ACC" in ASCII).
  1 | - | enables the Write Protect if WPKEY corresponds to 0x414343 ("ACC" in ASCII).

- WPKEY: Write Protect KEY

-

#### ACC Write Protect Status Register

Name: ACC_WPSR

Access: read-only

Address: 0x400400E8

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | WPROTERR

- WPROTERR: Write PROTection ERRor

  Value | Name | Description
  --- | --- | ---
  0 | - | no Write Protect Violation has occurred since the last read of the ACC_WPSR register.
  1 | - | a Write Protect Violation (WPEN = 1) has occurred since the last read of the ACC_WPSR register.