Afternoon all,
I am having difficulties configuring the ADCs on the launchpad. Here is my code:
// select reference positive
#ifndef LAUNCHPAD
ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);
ADCReferenceSet(ADC1_BASE, ADC_REF_EXT_3V);
#endif
#ifdef LAUNCHPAD
//Enable Pin inputs
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeADC( GPIO_PORTE_BASE, GPIO_PIN_3 );
GPIOPinTypeADC( GPIO_PORTE_BASE, GPIO_PIN_2 );
// Enable the first sample sequencer to capture the value of channel 0 when
// the processor trigger occurs.
ADCSequenceConfigure(ADC0_BASE, SEQ1, ADC_TRIGGER_ALWAYS, PRIORITY0);
ADCSequenceStepConfigure( ADC0_BASE, SEQ1, STEP0, ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH0);
ADCSequenceStepConfigure( ADC0_BASE, SEQ1, STEP1, ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH1);
#endif
//setup interrupts
ADCIntRegister(ADC0_BASE, SEQ1, ADCinterruptSequencer1);
ADCIntEnable(ADC0_BASE, SEQ1);
ADCIntClear(ADC0_BASE, SEQ1);
The issue I am seeing is the ADC on ADC0 is being mirrored in the value from ADC1 (and so on with more added in the chain). I can see voltage changes on the ADC0 input pin being reflected in the value displayed on the screen. However this is also reflected in the value I read back from ADC1.
I am only using 0 and 3V3 from the board so I have no electronic issues. I am simply trying to reflect a voltage above 500 counts as a LED on using the onboard RGB LED. One colour for each channel. I can see intermediate values (ie floating values) through the UART interface. Otherwise the code performs as expected.
I suspect the issue lays in the configuration somewhere. Anyone any ideas? Thanks :)