# mcp3424

mcp342, 18-bit, multi-channel delta-sigma AD converter with I2C output

Author | Eur van Andel, eur@fiwihex.nl Copyright © 2010
Adapted-by | William Welch
Compiler | =2.4n

Description

    this library works with the MCP3424 AD converter from Microchip with up to 18 bits accuracy
    Datasheet: DS22088B

Dependencies

No dependency found

## Summary

### Global variables/contants

- `var byte mcp3424_config[8]`

### Procedures

### Functions

- `mcp3424_set_channel(byte in address, byte in channel) return bit`
- `mcp3424_get_18_status(byte in address, byte out status) return sdword`
- `mcp3424_get_16(byte in address) return sword`
- `mcp3424_get_18(byte in address) return sdword`
- `mcp3424_set_gain(byte in address, byte in gain) return bit`
- `mcp3424_get_16_status(byte in address, byte out status) return sword`
- `mcp3424_set18bits(byte in address) return bit`
- `mcp3424_millivolt(sdword in tcvalue, byte in gain) return sword`
- `mcp3424_microvolt(sdword in tcvalue, byte in gain) return sdword`

## API details

### Global variables/contants

- `var byte mcp3424_config[8]`

  No documentation found

### Procedures

### Functions

- `mcp3424_set_channel(byte in address, byte in channel) return bit`

      channel should be 1 .. 4, as per datasheet DS22088B page 18
      if channel = 0, 1 is assumed. If channel is > 4, 4 is assumed

- `mcp3424_get_18_status(byte in address, byte out status) return sdword`

      get 18-bit adc reading, return status/config_reg read-back to caller

- `mcp3424_get_16(byte in address) return sword`

      get 16-bit adc reading, no status returned to caller. legacy routine.

- `mcp3424_get_18(byte in address) return sdword`

      get 18-bit adc reading, no status returned to caller. legacy routine.

- `mcp3424_set_gain(byte in address, byte in gain) return bit`

      gain should be 1, 2, 4, 8, as per datasheet DS22088B page 18
      gain = 0,1 -> 1 / 2 -> 2, 3,4 -> 4 / 5..255 -> 8

- `mcp3424_get_16_status(byte in address, byte out status) return sword`

      get 16-bit adc reading, return status/config_reg read-back to caller

- `mcp3424_set18bits(byte in address) return bit`

      initialize mcp3424 for 18-bit samples and continuous conversion mode.
      NB: also sets G=1, channel=0. These may be modified by other functions (see below)

- `mcp3424_millivolt(sdword in tcvalue, byte in gain) return sword`

      gain should be 1, 2, 4, 8, as per datasheet DS22088B page 18
      if gain = 0,1 -> 1 / 2 -> 2, 3,4 -> 4 / 5..255 -> 8
      FIXME: this routine only handles 18-bit samples.

- `mcp3424_microvolt(sdword in tcvalue, byte in gain) return sdword`

      gain should be 1, 2, 4, 8, as per datasheet DS22088B page 18
      if gain = 0,1 -> 1 / 2 -> 2, 3,4 -> 4 / 5..255 -> 8
      FIXME: this routine only handles 18-bit samples.

## Related samples

No sample found