本文整理汇总了C++中ADCIntClear函数的典型用法代码示例。如果您正苦于以下问题:C++ ADCIntClear函数的具体用法?C++ ADCIntClear怎么用?C++ ADCIntClear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ADCIntClear函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SampleLightCO
void SampleLightCO(void){
unsigned long ulADC0_Value[1];
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | ADC_CTL_IE |
ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 3);
ADCIntClear(ADC0_BASE, 3);
while(1){
ADCProcessorTrigger(ADC0_BASE, 3);
while(!ADCIntStatus(ADC0_BASE, 3, false)){
}
ADCIntClear(ADC0_BASE, 3);
ADCSequenceDataGet(ADC0_BASE, 3, ulADC0_Value);
Log("Breath Level = ");
LogD(ulADC0_Value[0]);
Log("\r");
SysCtlDelay(SysCtlClockGet() / 12);
}
}
开发者ID:ThaiDoWave,项目名称:seniordesign,代码行数:26,代码来源:piezo.c
示例2: ADC_In
unsigned long ADC_In(unsigned int channelNum){
unsigned long config;
unsigned long data;
// Configuring ADC to start by processor call instead of interrupt
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
// Determine input channel
switch(channelNum){
case 0: config = ADC_CTL_CH0; break;
case 1: config = ADC_CTL_CH1; break;
case 2: config = ADC_CTL_CH2; break;
case 3: config = ADC_CTL_CH3; break;
}
// Enable ADC interrupt and last step of sequence
config |= ADC_CTL_IE | ADC_CTL_END;
ADCSequenceStepConfigure(ADC0_BASE, 3, 0, config);
ADCSequenceEnable(ADC0_BASE, 3);
ADCIntClear(ADC0_BASE, 3);
// Start ADC conversion
ADCProcessorTrigger(ADC0_BASE, 3);
// Wait for ADC conversion to finish
while(!ADCIntStatus(ADC0_BASE, 3, false)){}
// Clear interrupt flag and read conversion data
ADCIntClear(ADC0_BASE, 3);
ADCSequenceDataGet(ADC0_BASE, 3, &data);
return data;
}
开发者ID:tach4455,项目名称:EE345M,代码行数:35,代码来源:ADC.c
示例3: main
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeADC(GPIO_PORTB_BASE, GPIO_PIN_5);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_5);
ADCSequenceConfigure(ADC0_BASE, 2, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 2, 0, ADC_CTL_CH8);
ADCSequenceStepConfigure(ADC0_BASE, 2, 1, ADC_CTL_CH11 | ADC_CTL_IE | ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 2);
ADCIntClear(ADC0_BASE, 2);
while(1)
{
ADCProcessorTrigger(ADC0_BASE, 2);
while(!ADCIntStatus(ADC0_BASE, 2, false));
ADCIntClear(ADC0_BASE, 2);
ADCSequenceDataGet(ADC0_BASE, 2, adcValue);
SysCtlDelay(SysCtlClockGet() / 12);
}
}
开发者ID:anshuman94,项目名称:StarShipXP,代码行数:26,代码来源:main.c
示例4: hardware_init
//---------------------------------------------------------------------------
// hardware_init()
//
// inits GPIO pins for toggling the LED
//---------------------------------------------------------------------------
void hardware_init(void)
{
//Set CPU Clock to 40MHz. 400MHz PLL/2 = 200 DIV 5 = 40MHz
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
//Removing Locks From Switch
LOCK_F=0x4C4F434B;
CR_F=GPIO_PIN_0|GPIO_PIN_4;
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_0); // Configuring PD0 as ADC input (channel 1) CH7 ADC0
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1);
ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceConfigure(ADC1_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH7);
ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_CH7);
ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_CH7);
ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_CH7 | ADC_CTL_IE | ADC_CTL_END);
ADCSequenceStepConfigure(ADC1_BASE, 1, 0, ADC_CTL_CH6);
ADCSequenceStepConfigure(ADC1_BASE, 1, 1, ADC_CTL_CH6);
ADCSequenceStepConfigure(ADC1_BASE, 1, 2, ADC_CTL_CH6);
ADCSequenceStepConfigure(ADC1_BASE, 1, 3, ADC_CTL_CH6 | ADC_CTL_IE | ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 1);
ADCSequenceEnable(ADC1_BASE, 1);
ADCIntClear(ADC0_BASE, 1);
ADCIntClear(ADC1_BASE, 1);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_6);
GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_3);
GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0);
//GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_4,0x10);
}
开发者ID:dealsndime,项目名称:CS684--2016,代码行数:57,代码来源:main.c
示例5: CapacitorTask
void CapacitorTask(void* pvParameter)
{
unsigned long ulValue=0;
int i=0;
cqueue = xQueueCreate(100,sizeof(unsigned long));
//SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_1);
GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_1, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_OD);
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, 0x02);//Setting the Pin 0 to "high"
//Initialize the ADC using functions from the Stellaris API
//SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
ADCSequenceConfigure(ADC_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_IE|ADC_CTL_END|ADC_CTL_CH1);
ADCSequenceEnable(ADC0_BASE, 1);
//ADCIntEnable(ADC0_BASE, 1);
ADCIntClear(ADC0_BASE, 1);
//Trigger from the Processor
while(true)
{
if(flagcap==1)
{
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, 0x00);//Setting the Pin 0 to "high"
vTaskDelay(TICK_R*0.5);
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, 0x02);//Setting the Pin 0 to "high"
i=0;
flagcap = 0;
//ADCIntClear(ADC0_BASE, 1);
while(i<100)
{
ADCProcessorTrigger(ADC0_BASE, 1);
while(!ADCIntStatus(ADC0_BASE, 1, false))
{
}
ADCSequenceDataGet(ADC0_BASE, 1, &ulValue);//Enable ADC sequence 0
ADCIntClear(ADC0_BASE, 1);
xQueueSend(cqueue, &ulValue, 0);
i++;
vTaskDelay(TICK_R*1.0)
; }
flagUART = 1;
}
vTaskDelay(TICK_R*10);
}
}
开发者ID:santosh500,项目名称:C_Embedded_Projects,代码行数:52,代码来源:capacitor.c
示例6: Converter
/**
Reads the current sense amplifier output using the Analog to Digital Converter (ADC).
Current sense resistor is 0.2 ohms, amplifier multiplies voltage drop by 50. Therefore, every mA of
current translates into 10mV measured by the microcontroller
@note Current sense input is on PE5 on Stellaris LaunchPad
@pre Current sense shunt is installed on the BoosterPack
@return Current in mA multiplied by 10 (e.g. return value of 713 = 71.3mA)
@see StellarisWare/examples/peripherals/adc/single_ended.c
*/
uint16_t getCurrentSensor()
{
/* This array is used for storing the data read from the ADC FIFO. It must be as large as the
FIFO for the sequencer in use. This example uses sequence 3 which has a FIFO depth of 1. */
uint32_t ulADC0_Value[1];
/* Enable sample sequence 3 with a processor signal trigger. Sequence 3 will do a single sample
when the processor sends a signal to start the conversion. */
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
/* Configure step 0 on sequence 3. Sample channel 8 (ADC_CTL_CH8) in single-ended mode
* (default) and configure the interrupt flag (ADC_CTL_IE) to be set when the sample is done.
* Tell the ADC logic that this is the last conversion on sequence 3 (ADC_CTL_END). */
ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH8 | ADC_CTL_IE | ADC_CTL_END);
// Since sample sequence 3 is now configured, it must be enabled.
ADCSequenceEnable(ADC0_BASE, 3);
// Clear the interrupt status flag. This is done to make sure the
// interrupt flag is cleared before we sample.
ADCIntClear(ADC0_BASE, 3);
//
// Now the setup is done, let's actually measure something!
//
// Trigger the ADC conversion.
ADCProcessorTrigger(ADC0_BASE, 3);
// Wait for conversion to be completed.
while(!ADCIntStatus(ADC0_BASE, 3, false))
{
}
// Clear the ADC interrupt flag.
ADCIntClear(ADC0_BASE, 3);
// Read ADC Value into ulADC0_Value
ADCSequenceDataGet(ADC0_BASE, 3, ulADC0_Value);
// This part does not have a separate voltage reference
// Therefore we have to measure with reference to what we think VCC is, 3.30V
#define REFERENCE_VOLTAGE_MV (3300l)
uint32_t temp = (ulADC0_Value[0] * REFERENCE_VOLTAGE_MV);
#define NUMBER_OF_STEPS_12_BIT_RESOLUTION (4096l)
return ((uint16_t) (temp / NUMBER_OF_STEPS_12_BIT_RESOLUTION));
}
开发者ID:vtoanb,项目名称:msp430lioamaintain,代码行数:59,代码来源:hal_ek-lm4f120XL.c
示例7: joyTask
void joyTask(void *pvParameters) {
//initialize queues for communication and user feedback
dataBuffer = xQueueCreate(5, sizeof(unsigned long));
feedBack = xQueueCreate(5, sizeof(unsigned long));
//Enable ADC peripheral for joystick (left and right only)
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
//Set ADC to trigger from software, high priority
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
//configure adc to have an interrupt, to throw it at the end of the step sequence
ADCSequenceStepConfigure(ADC0_BASE, 0, 0,(ADC_CTL_END|ADC_CTL_CH0|ADC_CTL_IE));
//Enable the configured sequence
ADCSequenceEnable(ADC0_BASE, 0);
//clear the interrupt
ADCIntClear(ADC0_BASE, 0);
//temporary variable to catch adc vals, since queue docs are full of lies
unsigned long temp;
while(true) {
// Trigger the sample sequence.
ADCProcessorTrigger(ADC0_BASE, 0);
// Block until the sampling completes (fcn returns 0 until interrupt is thrown)
while(!ADCIntStatus(ADC0_BASE, 0, false)){}
// Read the value from the ADC into a temporary var
ADCSequenceDataGet(ADC0_BASE, 0, &temp);
//clear the interrupt
ADCIntClear(ADC0_BASE, 0);
//write temp value to queue
xQueueSend(dataBuffer, (void*) &temp, 0);
//send ADC value to the OLDE for display
xQueueSend(feedBack, (void*) &temp, 0);
//return control to Task scheduler
vTaskDelay(100*ONE_MS);
}
}
开发者ID:SLongofono,项目名称:Classwork-Resume,代码行数:49,代码来源:joy.c
示例8: HeightIntHandler
//******************************************************************************
// The handler for the ADC conversion (height) complete interrupt.
// Writes to the circular buffer.
//*****************************************************************************
void HeightIntHandler(void)
{
unsigned long ulValue;
static int counter = 0; //Keeping track of the buffer count for the initialRead
int current;
int sum = 0;
int i;
// Clean up, clearing the interrupt
ADCIntClear(ADC0_BASE, 3);
// Get the single sample from ADC0. (Yes, I know, I just did what you did sir :p)
ADCSequenceDataGet(ADC0_BASE, 3, &ulValue);
// Place it in the circular buffer (advancing write index)
g_inBuffer.data[g_inBuffer.windex] = (int) ulValue;
g_inBuffer.windex++;
if (g_inBuffer.windex >= g_inBuffer.size)
g_inBuffer.windex = 0;
if (counter < BUF_SIZE) {
counter++;
if (counter == BUF_SIZE) {
for (i = 0; i < BUF_SIZE; i++) {
current = ulValue;
sum = sum + current;
}
//Average voltage to calibrate the minimum height of the helicopter
initialRead = ADC_TO_MILLIS(sum/BUF_SIZE);
}
}
}
开发者ID:Yamoahs,项目名称:ENCE361_Helicopter_project,代码行数:36,代码来源:Copy+of+milestone2_MotorControl(PID)4.c
示例9: ADC0IntHandler
void ADC0IntHandler()
{
unsigned long adc0Value; // Holds the ADC result
char adc0String[5]; // Holds the string-converted ADC result
// 清ADC0中断标志.
// ADCIntClear (unsigned long ulBase, unsigned long ulSequenceNum)
ADCIntClear(ADC0_BASE, 0);
//从SSO读出转换结果 (FIFO0),本例中只有一个采样.如果要使用多个转换源,需要使用数组做为参数传递给API函数,保存FIFO转换结果.
// long ADCSequenceDataGet (unsigned long ulBase,unsigned long ulSequenceNum,unsigned long *pulBuffer)
ADCSequenceDataGet(ADC0_BASE, 0, &adc0Value);
adc0Value= ((59960 - (adc0Value * 100)) / 356);
// 在OLED上显示当前温度
usprintf(adc0String, "%d", adc0Value);
IntMasterDisable();
RIT128x96x4StringDraw("Current temp : ", 6, 48, 15);
RIT128x96x4StringDraw(adc0String, 94, 48, 15);
IntMasterEnable();
// ADC模块空闲,可以进行下一次转换
adc_busy=0;
}
开发者ID:mybays,项目名称:lm3s,代码行数:27,代码来源:main.c
示例10: adc_init_and_run
void adc_init_and_run(void){
// Тактирование выбранного модуля АЦП.
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADCx);
// Ожидание готовности выбранного модуля АЦП к настройке.
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADCx)) { }
ADCHardwareOversampleConfigure(ADCx_BASE, 4);
// Установка триггера выбранного буфера АЦП.
ADCSequenceConfigure(ADCx_BASE, SSy, ADC_TRIGGER, 0);
ADCSequenceStepConfigure(ADCx_BASE, SSy, 0, ADC_CTL_CH0);
ADCSequenceStepConfigure(
ADCx_BASE, SSy, 1, ADC_CTL_CH1|ADC_CTL_IE|ADC_CTL_END
);
ADCIntClear(ADCx_BASE, SSy);
IntEnable(INT_ADCxSSy);
IntPrioritySet(INT_ADCxSSy, 1);
ADCSequenceEnable(ADCx_BASE, SSy);
ADCProcessorTrigger(ADCx_BASE, SSy);
}
开发者ID:andrew-merzlaikov,项目名称:smart_house,代码行数:25,代码来源:adc_setup.c
示例11: main
int main(void)
{
uint32_t ui32ADC0Value[4];
volatile uint32_t ui32TempAvg;
volatile uint32_t ui32TempValueC;
volatile uint32_t ui32TempValueF;
setup();
ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE,1,3,ADC_CTL_TS|ADC_CTL_IE|ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 1);
while(1)
{
ADCIntClear(ADC0_BASE, 1);
ADCProcessorTrigger(ADC0_BASE, 1);
while(!ADCIntStatus(ADC0_BASE, 1, false))
{
}
ADCSequenceDataGet(ADC0_BASE, 1, ui32ADC0Value);
ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2] + ui32ADC0Value[3] + 2)/4;
ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096)/10;
ui32TempValueF = ((ui32TempValueC * 9) + 160) / 5;
}
}
开发者ID:dipteshkanojia,项目名称:CS684-2016,代码行数:33,代码来源:example.c
示例12: checkIntTempSensor
/*****************************************************
* Function: checkIntTempSensor
* Description: Reads internal temperature sensor
* Input: NONE
* Output: ui32TempAvg, ui32TempValueC, ui32TempValueF
*****************************************************/
void checkIntTempSensor(void)
{
// Clear flag
ADCIntClear(ADC0_BASE, 0);
// Trigger processor
ADCProcessorTrigger(ADC0_BASE, 0);
// Wait for ADC status to be set
while(!ADCIntStatus(ADC0_BASE, 0, false)){}
// Get data and convert to useful values
// Read all four steps of sequence into ui32ADC0Value
ADCSequenceDataGet(ADC0_BASE, 0, ui32ADC0Value);
ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2] + ui32ADC0Value[3] + 2)/4;
ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096)/10;
ui32TempValueF = ((ui32TempValueC * 9) + 160) / 5;
// Shutdown if device is getting too hot
if(ui32TempValueF >= SHUTDOWN_TEMP)
{
mode = SYSTEM_SHUTDOWN;
}
}
开发者ID:BooRan,项目名称:Auto_Water_TM4,代码行数:31,代码来源:main.c
示例13: UARTIntHandler
void UARTIntHandler() {
uint32_t ui32Status;
uint32_t ui32ADC0Value[4]; // ADC FIFO
volatile uint32_t ui32TempAvg; // Store average
volatile uint32_t ui32TempValueC; // Temp in C
volatile uint32_t ui32TempValueF; // Temp in F
ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status
UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts
ADCIntClear(ADC0_BASE, 2); // Clear ADC0 interrupt flag.
ADCProcessorTrigger(ADC0_BASE, 2); // Trigger ADC conversion.
while (!ADCIntStatus(ADC0_BASE, 2, false))
; // wait for conversion to complete.
ADCSequenceDataGet(ADC0_BASE, 2, ui32ADC0Value); // get converted data.
// Average read values, and round.
// Each Value in the array is the result of the mean of 64 samples.
ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2]
+ ui32ADC0Value[3] + 2) / 4;
ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096) / 10; // calc temp in C
ui32TempValueF = ((ui32TempValueC * 9) + 160) / 5;
//while(UARTCharsAvail(UART0_BASE)) //loop while there are chars
//{
// UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE)); //echo character
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); //blink LED
SysCtlDelay(SysCtlClockGet() / (1000 * 3)); //delay ~1 msec
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); //turn off LED
//}
}
开发者ID:martinjaime,项目名称:MartinJaime_CpE403_labs,代码行数:33,代码来源:main.c
示例14: Init_ADC
/*
* 初始化ADC引脚和配置
* 其中ADC0的输入引脚配置为CH1,ADC1的输入引脚配置为CH2
*/
void Init_ADC()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2);
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH1 | ADC_CTL_IE | ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 3);
ADCIntClear(ADC0_BASE, 3);
ADCSequenceConfigure(ADC1_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC1_BASE, 3, 0, ADC_CTL_CH2 | ADC_CTL_IE | ADC_CTL_END);
ADCSequenceEnable(ADC1_BASE, 3);
ADCIntClear(ADC1_BASE, 3);
}
开发者ID:authuir,项目名称:TivaEthernet,代码行数:20,代码来源:ADC.c
示例15: pirates
// Control the major or minor cycle in main function
void pirates(void* taskDataPtr)
{
pirateDataStruct* dataPtr = (pirateDataStruct*) taskDataPtr;
unsigned short* pirateProximityPtr = dataPtr->pirateProximity;
while (1) {
// Start of ADC2 //removed to free up ADC lines
//
static unsigned long adc2Reading[4] = {0};
// interrupt flag is cleared before we sample.
ADCIntClear(ADC0_BASE, 2);
// Trigger the ADC conversion.
ADCProcessorTrigger(ADC0_BASE, 2);
// Wait for conversion to be completed.
while(!ADCIntStatus(ADC0_BASE, 2, false))
{
}
// Clear the ADC interrupt flag.
ADCIntClear(ADC0_BASE, 2);
// Read ADC Value.
ADCSequenceDataGet(ADC0_BASE, 2, adc2Reading);
converted = (double) (1023 - adc2Reading[2]) * (200.0 / 1023) * 2;
*pirateProximityPtr = (unsigned short) converted;
//disable phasor and photon
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, 0x00);
if(*pirateProximityPtr>100) {
//disable phasor and photon
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, 0x00);
//xTaskSuspend(piratesHandle);
}
else if(*pirateProximityPtr<30) {
//fire phasors fault pin
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, 0xFF);
}
if(*pirateProximityPtr<5) {
//fire photons PD5
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);
}
vTaskDelay(100);
}
}
开发者ID:Beck-Sisyphus,项目名称:EE472,代码行数:48,代码来源:pirates.c
示例16: getADCValues
long getADCValues(int port) {
unsigned long ADCValue[4] = {0,0,0,0};
ADCIntClear(ADC_BASE, port);
ADCProcessorTrigger(ADC_BASE, port);
while(!ADCIntStatus(ADC_BASE, port, false));
ADCSequenceDataGet(ADC_BASE, port, ADCValue);
return ADCValue[0];
}
开发者ID:RAS-MoFos,项目名称:Rasware2012,代码行数:8,代码来源:Nav.c
示例17: sampleAdcPort
long sampleAdcPort(int port) {
unsigned long ADCValues[4] = {0};
ADCProcessorTrigger(ADC_BASE, 0 );
while(!ADCIntStatus(ADC_BASE, 0, false));
ADCSequenceDataGet(ADC_BASE, 0, ADCValues);
ADCIntClear(ADC_BASE, 0);
return ADCValues[port];
}
开发者ID:4radovich,项目名称:Rasware2012,代码行数:8,代码来源:adc.c
示例18: InitializeInterrupts
void InitializeInterrupts()
{
//Enable and clear all configured interrupts before starting main loop
IntEnable(INT_ADC3);
IntEnable(INT_TIMER1A);
IntMasterEnable();
ADCIntClear(ADC0_BASE, 3);
}
开发者ID:FTGStudio,项目名称:Sound-Visualizer,代码行数:8,代码来源:main.c
示例19: ADC0IntFucntion
//*****************************************************************************
//
//! \brief ADC0 Interrupt Handler.
//!
//! If users want to user the ADC0 Callback feature, Users should promise
//! that the ADC0 Handle in the vector table is ADCIntHandler.
//!
//! \return None.
//
//*****************************************************************************
unsigned long ADC0IntFucntion(void *pvCBData,
unsigned long ulEvent,
unsigned long ulMsgParam,
void *pvMsgData)
{
ADCIntClear(ADC1_BASE, ADC_INT_END_CONVERSION);
return 0;
}
开发者ID:0xc0170,项目名称:cox,代码行数:18,代码来源:ADConvert.c
示例20: mode1
void mode1() //Obtain samples from ADC
{
ADCProcessorTrigger(ADC0_BASE, 2); // Start Sampling
while(!ADCIntStatus(ADC0_BASE, 2, false)); // Wait until sampling is done
ADCIntClear(ADC0_BASE, 2); //Clear Interrupt
ADCSequenceDataGet(ADC0_BASE, 2, adcValue); //Obtain the sample
ssdset(adcValue[0]);
}
开发者ID:anshuman94,项目名称:TIVA-C-123G,代码行数:8,代码来源:main.c
注:本文中的ADCIntClear函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论