#include <stdint.h> #include <stdbool.h> #include "lm4f120h5qr.h" volatile static uint32_t adcResult = 0; void ADC0SS3_Handler(void) { adcResult = ADC0->SSFIFO3; ADC0->ISC = (1<<3); } void ADC1SS3_Handler(void) { adcResult = ADC1->SSFIFO3; ADC1->ISC = (1<<3); } /* * main.c */ int main(void) { SYSCTL->RCGCADC = (1 << 0)| (1 << 1); // ADC0 was enabled SYSCTL->RCGCGPIO = (1 << 4); // Clock was enabled to Port E in Run mode GPIOE->DIR = ~(1 << 0); GPIOE->AFSEL = (1 << 0); // The alternate function for the corresponding pins were enabled GPIOE->DEN = ~(1 << 0); // The digital function for the corresponding pins were disabled GPIOE->AMSEL = (1 << 0); // The Analog function for the corresponding pins were disabled ADC0->ACTSS &= ~(1 << 3); // ADC0 SS3 was disabled ADC1->ACTSS &= ~(1 << 3); // ADC1 SS3 was disabled ADC0->EMUX = (0xF << 12); // ADC0 SS3 continuous mode was selected ADC1->EMUX = (0xF << 12); // ADC1 SS3 continuous mode was selected ADC1->SPC = (0x8 << 0); // ADC1 phase was shifted 180.0 ADC0->SSMUX3 = (1 << 0); // AIN3 was selected as an anolog input for ADC0 ADC1->SSMUX3 = (1 << 0); // AIN3 was selected as an analog input for ADC1 ADC0->SSCTL3 = (0x6 << 0); // ADC0 sample interrupt was enabled and End of Sequence ADC1->SSCTL3 = (0x6 << 0); // ADC1 sample interrupt was enabled and End of Sequence ADC0->PC = (0x7 << 0); // ADC0 speed was configured as 1Mbps ADC1->PC = (0x7 << 0); // ADC1 speed was configured as 1Mbps ADC0->IM = (1 << 3); // ADC0 SS3 interrupt was enabled ADC1->IM = (1 << 3); // ADC1 SS3 interrupt was enabled ADC0->ACTSS = (1 << 3); // ADC0 SS3 was enabled ADC1->ACTSS = (1 << 3); // ADC1 SS3 was enabled ADC0->ISC = (1 << 3); // Bit was cleared ADC1->ISC = (1 << 3); // Bit was cleared while(1){ } }
Hi,
I have been working on TM4c1233h6pm and i want to configure adc for 1mbps. I know ı have to use adc0 and adc1 together and i have to shift phase of adc1. When i try to use only adc1 or adc0, it is working but when i try to use adc0 and adc1 together it is not working. Here is my code.