chipKIT® Development Platform

Inspired by Arduino™

Last edit: 2021-03-21 22:37 by Majenko

AnalogReference

  1. Synopsis

  2. Description

  3. Modes

  4. Return Value

  5. Conforming To

  6. Example

  7. See Also

Synopsis

void analogReference(uint8_t mode);

Description

The analogReference() function allows you to specify different combinations of internal and external voltage references for use during analog-to-digital conversion using analogRead(). mode can be one of: EXTERNAL, EXTMINUS, EXTPLUSMINUS or DEFAULT.

Modes

  • EXTERNAL This uses the external Aref+ pin as the positive voltage reference. The negative voltage reference is internally connected to ground.

  • EXTMINUS This uses the external Aref- pin (may not be provided on the board) as the negative voltage reference. The positive voltage reference is internally connected to Vdd.

  • EXTPLUSMINUS This uses both the external Aref+ and Aref- pins for the positive and negative voltage references respectively.

  • DEFAULT This connects the positive voltage reference to Vdd and the negative voltage reference to Vss. This is, as the name implies, the default operating mode.

Return Value

None

Conforming To

The analogReference() function conforms to the Arduino 1.6.x specification with the following exceptions:

  • No support for INTERNAL, INTERNAL1V1 or INTERNAL2V56 voltage reference sources
  • Additional support for negative voltage reference sources (Vref-)

Example

Set the analog reference to use the external Aref+ pin with ground as the negative reference:

analogReference(EXTERNAL);

See Also

analogRead(), analogWrite()