| RTOS_MSPM0 1.1 ECE445M starter code

Macros | Functions
ADCTimer.h File Reference
ADC

Initialize 12-bit ADC0. More...

`#include <ti/devices/msp/msp.h>`

Go to the source code of this file.

## Macros
#define | ADCVREF_INT 0x200
| using ADCVREF_INT means choose internal 2.5V reference for accuracy
#define | ADCVREF_EXT 0x100
| using ADCVREF_EXT means choose external reference not tested
#define | ADCVREF_VDDA 0x000
| using ADCVREF_VDDA means choose power line 3.3V reference for 0 to 3.3V range. This is the mode we use in ECE319K

## Functions
void | ADC0_TimerG0_Init (uint32_t channel, uint32_t reference, uint16_t period, uint32_t prescale, uint32_t priority)
| Initialize 12-bit ADC0. More...
void | ADC1_TimerG8_Init (uint32_t channel, uint32_t reference, uint16_t period, uint32_t prescale, uint32_t priority)
| Initialize 12-bit ADC1. More...

## Detailed Description

Initialize 12-bit ADC0.

ADC input, timer trigger, 12-bit conversion
The ADC allows two possible references: 2.5V or 3.3V.
The internal 2.5V reference is lower noise, but limits the range to 0 to 2.5V.
The other possibility is to use the analog voltage supply at 3.3V, making the ADC range 0 to 3.3V. In this driver, the 3.3V range is selected. There are several configurations (each with initialization and a read ADC with software trigger, busy-wait function)

Version
  ECE319K v1.3

Author
  Daniel Valvano and Jonathan Valvano

Copyright
  Copyright 2025 by Jonathan W. Valvano, valva.nosp@m.no@m.nosp@m.ail.u.nosp@m.texa.nosp@m.s.edu,

Warning
  AS-IS

Note
  For more information see http://users.ece.utexas.edu/~valvano/

Date
  May 23, 2025

  ADC pins on the MSPM0G3507
  Pin | ADC channel | Sensor
  --- | --- | ---
  PA27 | ADC0 channel 0 | J1.8 also MKII light interrupt
  PA26 | ADC0 channel 1 | J1.6 MKII microphone in
  PA25 | ADC0 channel 2 | J1.2 MKII Joystick X
  PA24 | ADC0 channel 3 | J3.27 free
  PB25 | ADC0 channel 4 | J19.7 (insert 0ohm R74, no U3 OPA2365)
  PB24 | ADC0 channel 5 | J1.5 also MKII joystick select button
  PB20 | ADC0 channel 6 | J4.36 free
  PA22 | ADC0 channel 7 | J24 MKII Accelerometer Y
  PA15 | ADC1 channel 0 | J3.30 (also DACout)
  PA16 | ADC1 channel 1 | J3.29 free
  PA17 | ADC1 channel 2 | J3.28 free
  PA18 | ADC1 channel 3 | J3.26 MKII Joystick Y
  PB17 | ADC1 channel 4 | J2.18 free
  PB18 | ADC1 channel 5 | J3.25 MKII Accelerometer Z
  PB19 | ADC1 channel 6 | J3.23 MKII Accelerometer X
  PA21 | ADC1 channel 7 | J17.8 (insert R20, remove R3)

  note to students****
  the data sheet says the ADC does not work when clock is 80 MHz however, the ADC seems to work on my boards at 80 MHz I suggest you try 80MHz, but if it doesn't work, switch to 40MHz