我想做一个多通道的AD 转换,这是我的程序:
//*****************************************************************************
//
// project0.c - Example to demonstrate minimal StellarisWare setup
//
// Copyright (c) 2012 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 9453 of the EK-LM4F120XL Firmware Package.
//
//*****************************************************************************
#include "driverlib/pin_map.h"
#include "inc/hw_ints.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/uart.h"
#include "inc/hw_nvic.h"
#include "inc/hw_gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/adc.h"
//*****************************************************************************
unsigned long ulADC0_Value[2];
//! \addtogroup example_list
//! <h1>Project Zero (project0)</h1>
//!
//! This example demonstrates the use of StellarisWare to setup the clocks
//! and toggle GPIO pins to make the LED's blink. This is a good place to
//! start understanding your launchpad and the tools that can be used to
//! program it. See http://www.ti.com/stellaris-launchpad/project0 for more
//! information and tutorial videos.
//!
//
//*****************************************************************************
//*****************************************************************************
//
// Main 'C' Language entry point. Toggle an LED using StellarisWare.
// See www.ti.com/stellaris-launchpad/project0 for more information and
// tutorial videos.
//
//*****************************************************************************
int
main(void)
{
//
// Setup the system clock to run at 50 Mhz from PLL with crystal reference
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); //Enable ADC0
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); //E port Enable
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3|GPIO_PIN_2); //PE3 as ADC input AIN0 PE2 for AIN1
/******************************/
// GPIOPinTypeGPIOInput(GPIO_PORTA_BASE,GPIO_PIN_7);
// GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_7, GPIO_RISING_EDGE);
// GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_7);
// GPIOADCTriggerEnable(GPIO_PORTA_BASE,GPIO_PIN_7); //PA7 as ADC trggier
/******************************/
ADCSequenceConfigure(ADC0_BASE,0,ADC_TRIGGER_PROCESSOR,0); //Sequence0
ADCSequenceStepConfigure(ADC0_BASE, 0, 1,ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH0|ADC_CTL_CH1);
ADCSequenceEnable(ADC0_BASE, 0);
ADCIntClear(ADC0_BASE,0);
while(1)
{
ADCProcessorTrigger(ADC0_BASE,0);
while(!ADCIntStatus(ADC0_BASE, 0, false))
{}
IntPendClear(INT_ADC0SS0);
ADCIntClear(ADC0_BASE,0);
ADCSequenceDataGet(ADC0_BASE, 0, ulADC0_Value);
}
}
可是ADC转换后的结果却只显示一个通道的值;我看了看手册,上边说,这个ADCSequenceDataGet(ADC0_BASE, 0, ulADC0_Value);只返回最新的值,但是,也是FIFO寄存器的数值啊;还有,为什么手册上说ADC0音序器0的FIFO有8级深度,可看他的寄存器,却只能找到一个FIFO?