![]() |
LPCOpen Platform for LPC18XX/43XX microcontrollers
18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
|
Data Structures | |
| struct | LPC_ADC_T |
| 10 or 12-bit ADC register block structure More... | |
| struct | ADC_CLOCK_SETUP_T |
Macros | |
| #define | ADC_ACC_10BITS |
| #define | ADC_MAX_SAMPLE_RATE 400000 |
| #define | ADC_DR_RESULT(n) ((((n) >> 6) & 0x3FF)) |
| ADC register support bitfields and mask. More... | |
| #define | ADC_CR_BITACC(n) ((((n) & 0x7) << 17)) |
| #define | ADC_DR_DONE(n) (((n) >> 31)) |
| #define | ADC_DR_OVERRUN(n) ((((n) >> 30) & (1UL))) |
| #define | ADC_CR_CH_SEL(n) ((1UL << (n))) |
| #define | ADC_CR_CLKDIV(n) ((((n) & 0xFF) << 8)) |
| #define | ADC_CR_BURST ((1UL << 16)) |
| #define | ADC_CR_PDN ((1UL << 21)) |
| #define | ADC_CR_START_MASK ((7UL << 24)) |
| #define | ADC_CR_START_MODE_SEL(SEL) ((SEL << 24)) |
| #define | ADC_CR_START_NOW ((1UL << 24)) |
| #define | ADC_CR_START_CTOUT15 ((2UL << 24)) |
| #define | ADC_CR_START_CTOUT8 ((3UL << 24)) |
| #define | ADC_CR_START_ADCTRIG0 ((4UL << 24)) |
| #define | ADC_CR_START_ADCTRIG1 ((5UL << 24)) |
| #define | ADC_CR_START_MCOA2 ((6UL << 24)) |
| #define | ADC_CR_EDGE ((1UL << 27)) |
| #define | ADC_SAMPLE_RATE_CONFIG_MASK (ADC_CR_CLKDIV(0xFF) | ADC_CR_BITACC(0x07)) |
Enumerations | |
| enum | ADC_STATUS_T { ADC_DR_DONE_STAT, ADC_DR_OVERRUN_STAT, ADC_DR_ADINT_STAT } |
| ADC status register used for IP drivers. More... | |
| enum | ADC_CHANNEL_T { ADC_CH0 = 0, ADC_CH1, ADC_CH2, ADC_CH3, ADC_CH4, ADC_CH5, ADC_CH6, ADC_CH7 } |
| enum | ADC_RESOLUTION_T { ADC_10BITS = 0, ADC_9BITS, ADC_8BITS, ADC_7BITS, ADC_6BITS, ADC_5BITS, ADC_4BITS, ADC_3BITS } |
| enum | ADC_EDGE_CFG_T { ADC_TRIGGERMODE_RISING = 0, ADC_TRIGGERMODE_FALLING } |
| enum | ADC_START_MODE_T { ADC_NO_START = 0, ADC_START_NOW, ADC_START_ON_CTOUT15, ADC_START_ON_CTOUT8, ADC_START_ON_ADCTRIG0, ADC_START_ON_ADCTRIG1, ADC_START_ON_MCOA2 } |
Functions | |
| void | Chip_ADC_Init (LPC_ADC_T *pADC, ADC_CLOCK_SETUP_T *ADCSetup) |
| Initialize the ADC peripheral and the ADC setup structure to default value. More... | |
| void | Chip_ADC_DeInit (LPC_ADC_T *pADC) |
| Shutdown ADC. More... | |
| Status | Chip_ADC_ReadValue (LPC_ADC_T *pADC, uint8_t channel, uint16_t *data) |
| Read the ADC value from a channel. More... | |
| Status | Chip_ADC_ReadByte (LPC_ADC_T *pADC, ADC_CHANNEL_T channel, uint8_t *data) |
| Read the ADC value and convert it to 8bits value. More... | |
| FlagStatus | Chip_ADC_ReadStatus (LPC_ADC_T *pADC, uint8_t channel, uint32_t StatusType) |
| Read the ADC channel status. More... | |
| void | Chip_ADC_Int_SetChannelCmd (LPC_ADC_T *pADC, uint8_t channel, FunctionalState NewState) |
| Enable/Disable interrupt for ADC channel. More... | |
| STATIC INLINE void | Chip_ADC_Int_SetGlobalCmd (LPC_ADC_T *pADC, FunctionalState NewState) |
| Enable/Disable global interrupt for ADC channel. More... | |
| void | Chip_ADC_SetStartMode (LPC_ADC_T *pADC, ADC_START_MODE_T mode, ADC_EDGE_CFG_T EdgeOption) |
| Select the mode starting the AD conversion. More... | |
| void | Chip_ADC_SetSampleRate (LPC_ADC_T *pADC, ADC_CLOCK_SETUP_T *ADCSetup, uint32_t rate) |
| Set the ADC Sample rate. More... | |
| void | Chip_ADC_SetResolution (LPC_ADC_T *pADC, ADC_CLOCK_SETUP_T *ADCSetup, ADC_RESOLUTION_T resolution) |
| Set the ADC accuracy bits. More... | |
| void | Chip_ADC_EnableChannel (LPC_ADC_T *pADC, ADC_CHANNEL_T channel, FunctionalState NewState) |
| Enable or disable the ADC channel on ADC peripheral. More... | |
| void | Chip_ADC_SetBurstCmd (LPC_ADC_T *pADC, FunctionalState NewState) |
| Enable burst mode. More... | |
| #define ADC_ACC_10BITS |
Definition at line 44 of file adc_18xx_43xx.h.
| #define ADC_CR_BITACC | ( | n | ) | ((((n) & 0x7) << 17)) |
Number of ADC accuracy bits
Definition at line 65 of file adc_18xx_43xx.h.
| #define ADC_CR_BURST ((1UL << 16)) |
Repeated conversions A/D enable bit
Definition at line 70 of file adc_18xx_43xx.h.
| #define ADC_CR_CH_SEL | ( | n | ) | ((1UL << (n))) |
Selects which of the AD0.0:7 pins is (are) to be sampled and converted
Definition at line 68 of file adc_18xx_43xx.h.
| #define ADC_CR_CLKDIV | ( | n | ) | ((((n) & 0xFF) << 8)) |
The APB clock (PCLK) is divided by (this value plus one) to produce the clock for the A/D
Definition at line 69 of file adc_18xx_43xx.h.
| #define ADC_CR_EDGE ((1UL << 27)) |
Start conversion on a falling edge on the selected CAP/MAT signal
Definition at line 80 of file adc_18xx_43xx.h.
| #define ADC_CR_PDN ((1UL << 21)) |
ADC convert is operational
Definition at line 71 of file adc_18xx_43xx.h.
| #define ADC_CR_START_ADCTRIG0 ((4UL << 24)) |
Start conversion when the edge selected by bit 27 occurs on ADCTRIG0
Definition at line 77 of file adc_18xx_43xx.h.
| #define ADC_CR_START_ADCTRIG1 ((5UL << 24)) |
Start conversion when the edge selected by bit 27 occurs on ADCTRIG1
Definition at line 78 of file adc_18xx_43xx.h.
| #define ADC_CR_START_CTOUT15 ((2UL << 24)) |
Start conversion when the edge selected by bit 27 occurs on CTOUT_15
Definition at line 75 of file adc_18xx_43xx.h.
| #define ADC_CR_START_CTOUT8 ((3UL << 24)) |
Start conversion when the edge selected by bit 27 occurs on CTOUT_8
Definition at line 76 of file adc_18xx_43xx.h.
| #define ADC_CR_START_MASK ((7UL << 24)) |
ADC start mask bits
Definition at line 72 of file adc_18xx_43xx.h.
| #define ADC_CR_START_MCOA2 ((6UL << 24)) |
Start conversion when the edge selected by bit 27 occurs on Motocon PWM output MCOA2
Definition at line 79 of file adc_18xx_43xx.h.
| #define ADC_CR_START_MODE_SEL | ( | SEL | ) | ((SEL << 24)) |
Select Start Mode
Definition at line 73 of file adc_18xx_43xx.h.
| #define ADC_CR_START_NOW ((1UL << 24)) |
Start conversion now
Definition at line 74 of file adc_18xx_43xx.h.
| #define ADC_DR_DONE | ( | n | ) | (((n) >> 31)) |
Mask for reading the ADC done status
Definition at line 66 of file adc_18xx_43xx.h.
| #define ADC_DR_OVERRUN | ( | n | ) | ((((n) >> 30) & (1UL))) |
Mask for reading the ADC overrun status
Definition at line 67 of file adc_18xx_43xx.h.
| #define ADC_DR_RESULT | ( | n | ) | ((((n) >> 6) & 0x3FF)) |
ADC register support bitfields and mask.
Mask for getting the 10 bits ADC data read value
Definition at line 64 of file adc_18xx_43xx.h.
| #define ADC_MAX_SAMPLE_RATE 400000 |
Definition at line 46 of file adc_18xx_43xx.h.
| #define ADC_SAMPLE_RATE_CONFIG_MASK (ADC_CR_CLKDIV(0xFF) | ADC_CR_BITACC(0x07)) |
Definition at line 81 of file adc_18xx_43xx.h.
| enum ADC_CHANNEL_T |
The channels on one ADC peripheral
| Enumerator | |
|---|---|
| ADC_CH0 |
ADC channel 0 |
| ADC_CH1 |
ADC channel 1 |
| ADC_CH2 |
ADC channel 2 |
| ADC_CH3 |
ADC channel 3 |
| ADC_CH4 |
ADC channel 4 |
| ADC_CH5 |
ADC channel 5 |
| ADC_CH6 |
ADC channel 6 |
| ADC_CH7 |
ADC channel 7 |
Definition at line 93 of file adc_18xx_43xx.h.
| enum ADC_EDGE_CFG_T |
Edge configuration, which controls rising or falling edge on the selected signal for the start of a conversion
| Enumerator | |
|---|---|
| ADC_TRIGGERMODE_RISING |
Trigger event: rising edge |
| ADC_TRIGGERMODE_FALLING |
Trigger event: falling edge |
Definition at line 117 of file adc_18xx_43xx.h.
| enum ADC_RESOLUTION_T |
The number of bits of accuracy of the result in the LS bits of ADDR
| Enumerator | |
|---|---|
| ADC_10BITS |
ADC 10 bits |
| ADC_9BITS |
ADC 9 bits |
| ADC_8BITS |
ADC 8 bits |
| ADC_7BITS |
ADC 7 bits |
| ADC_6BITS |
ADC 6 bits |
| ADC_5BITS |
ADC 5 bits |
| ADC_4BITS |
ADC 4 bits |
| ADC_3BITS |
ADC 3 bits |
Definition at line 105 of file adc_18xx_43xx.h.
| enum ADC_START_MODE_T |
Start mode, which controls the start of an A/D conversion when the BURST bit is 0.
Definition at line 123 of file adc_18xx_43xx.h.
| enum ADC_STATUS_T |
ADC status register used for IP drivers.
| Enumerator | |
|---|---|
| ADC_DR_DONE_STAT |
ADC data register staus |
| ADC_DR_OVERRUN_STAT |
ADC data overrun staus |
| ADC_DR_ADINT_STAT |
ADC interrupt status |
Definition at line 86 of file adc_18xx_43xx.h.
| void Chip_ADC_DeInit | ( | LPC_ADC_T * | pADC | ) |
Shutdown ADC.
| pADC | : The base of ADC peripheral on the chip |
Definition at line 142 of file adc_18xx_43xx.c.
| void Chip_ADC_EnableChannel | ( | LPC_ADC_T * | pADC, |
| ADC_CHANNEL_T | channel, | ||
| FunctionalState | NewState | ||
| ) |
Enable or disable the ADC channel on ADC peripheral.
| pADC | : The base of ADC peripheral on the chip |
| channel | : Channel to be enable or disable |
| NewState | : New state, should be:
|
Definition at line 222 of file adc_18xx_43xx.c.
| void Chip_ADC_Init | ( | LPC_ADC_T * | pADC, |
| ADC_CLOCK_SETUP_T * | ADCSetup | ||
| ) |
Initialize the ADC peripheral and the ADC setup structure to default value.
| pADC | : The base of ADC peripheral on the chip |
| ADCSetup | : ADC setup structure to be set |
Definition at line 120 of file adc_18xx_43xx.c.
| void Chip_ADC_Int_SetChannelCmd | ( | LPC_ADC_T * | pADC, |
| uint8_t | channel, | ||
| FunctionalState | NewState | ||
| ) |
Enable/Disable interrupt for ADC channel.
| pADC | : The base of ADC peripheral on the chip |
| channel | : ADC channel to read |
| NewState | : New state, ENABLE or DISABLE |
Definition at line 176 of file adc_18xx_43xx.c.
| STATIC INLINE void Chip_ADC_Int_SetGlobalCmd | ( | LPC_ADC_T * | pADC, |
| FunctionalState | NewState | ||
| ) |
Enable/Disable global interrupt for ADC channel.
| pADC | : The base of ADC peripheral on the chip |
| NewState | : New state, ENABLE or DISABLE |
Definition at line 198 of file adc_18xx_43xx.h.
| Status Chip_ADC_ReadByte | ( | LPC_ADC_T * | pADC, |
| ADC_CHANNEL_T | channel, | ||
| uint8_t * | data | ||
| ) |
Read the ADC value and convert it to 8bits value.
| pADC | : The base of ADC peripheral on the chip |
| channel,: | selected channel |
| data | : Storage for data |
Definition at line 247 of file adc_18xx_43xx.c.
| FlagStatus Chip_ADC_ReadStatus | ( | LPC_ADC_T * | pADC, |
| uint8_t | channel, | ||
| uint32_t | StatusType | ||
| ) |
Read the ADC channel status.
| pADC | : The base of ADC peripheral on the chip |
| channel | : ADC channel to read |
| StatusType | : Status type of ADC_DR_* |
Definition at line 156 of file adc_18xx_43xx.c.
Read the ADC value from a channel.
| pADC | : The base of ADC peripheral on the chip |
| channel | : ADC channel to read |
| data | : Pointer to where to put data |
Definition at line 150 of file adc_18xx_43xx.c.
| void Chip_ADC_SetBurstCmd | ( | LPC_ADC_T * | pADC, |
| FunctionalState | NewState | ||
| ) |
Enable burst mode.
| pADC | : The base of ADC peripheral on the chip |
| NewState | : New state, should be:
|
Definition at line 234 of file adc_18xx_43xx.c.
| void Chip_ADC_SetResolution | ( | LPC_ADC_T * | pADC, |
| ADC_CLOCK_SETUP_T * | ADCSetup, | ||
| ADC_RESOLUTION_T | resolution | ||
| ) |
Set the ADC accuracy bits.
| pADC | : The base of ADC peripheral on the chip |
| ADCSetup | : ADC setup structure to be modified |
| resolution | : The resolution, should be ADC_10BITS -> ADC_3BITS |
Definition at line 215 of file adc_18xx_43xx.c.
| void Chip_ADC_SetSampleRate | ( | LPC_ADC_T * | pADC, |
| ADC_CLOCK_SETUP_T * | ADCSetup, | ||
| uint32_t | rate | ||
| ) |
Set the ADC Sample rate.
| pADC | : The base of ADC peripheral on the chip |
| ADCSetup | : ADC setup structure to be modified |
| rate | : Sample rate, should be set so the clock for A/D converter is less than or equal to 4.5MHz. |
Definition at line 201 of file adc_18xx_43xx.c.
| void Chip_ADC_SetStartMode | ( | LPC_ADC_T * | pADC, |
| ADC_START_MODE_T | mode, | ||
| ADC_EDGE_CFG_T | EdgeOption | ||
| ) |
Select the mode starting the AD conversion.
| pADC | : The base of ADC peripheral on the chip |
| mode | : Stating mode, should be :
|
| EdgeOption | : Stating Edge Condition, should be :
|
Definition at line 187 of file adc_18xx_43xx.c.
1.8.3.1