这篇教程C++ ADCIntClear函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADCIntClear函数的典型用法代码示例。如果您正苦于以下问题:C++ ADCIntClear函数的具体用法?C++ ADCIntClear怎么用?C++ ADCIntClear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADCIntClear函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SampleLightCOvoid 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,
示例2: ADC_Inunsigned 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,
示例3: mainint 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,
示例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,
示例5: CapacitorTaskvoid 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,
示例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 ofcurrent 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,
示例7: joyTaskvoid 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,
示例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,
示例9: ADC0IntHandlervoid 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,
示例10: adc_init_and_runvoid 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,
示例11: mainint 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,
示例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,
示例13: UARTIntHandlervoid 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,
示例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,
示例15: pirates// Control the major or minor cycle in main functionvoid 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,
示例16: getADCValueslong 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,
示例17: sampleAdcPortlong 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,
示例18: InitializeInterruptsvoid 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,
示例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,
示例20: mode1void 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,
示例21: adc_interrupt//triggers when it's got all the channels readvoid adc_interrupt(void){ unsigned long temp[4]; unsigned long i; ADCIntClear(ADC0_BASE, 1); ADCSequenceDataGet(ADC0_BASE, 1, temp); ADCIntClear(ADC0_BASE, 1); for ( i = 0; i < 4; i++ ) { temp[i] = temp[i] >> 5; // 7-bit number (128 steps) if ( temp[i] != adcValues[i] ) UARTprintf("ADC[%d]: %d/n", i, temp[i] ); adcValues[i] = (unsigned char)temp[i]; }}
开发者ID:joshthornton,项目名称:ENGG4810,代码行数:19,
示例22: ADC0_Handlervoid ADC0_Handler(void){ // Clear flag ADCIntClear(ADC0_BASE, 0); ADCSequenceDataGet(ADC0_BASE, 0, Buffer); Status = TRUE;}
开发者ID:tach4455,项目名称:EE345M,代码行数:9,
示例23: get_tempvoid get_temp(void){ 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;}
开发者ID:CS308-2016,项目名称:BinC,代码行数:10,
示例24: adc_readvoid adc_read() { ADCProcessorTrigger(ADC0_BASE, 0); while(!ADCIntStatus(ADC0_BASE, 0, false)); ADCIntClear(ADC0_BASE, 0); ADCSequenceDataGet(ADC0_BASE, 0, ulADC0_Value); ADCSequenceEnable(ADC0_BASE, 0);}
开发者ID:ARENIBDelta,项目名称:2013_robot,代码行数:10,
示例25: ADCIntHandlervoid ADCIntHandler(void) { while(!ADCIntStatus(MODULE_ADC_BASE, MODULE_ADC_SEQUENCE_NUM, false)); ADCIntClear(MODULE_ADC_BASE, MODULE_ADC_SEQUENCE_NUM); xSemaphoreTakeFromISR(adc_mutex, pdFALSE); ADCSequenceDataGet(MODULE_ADC_BASE, MODULE_ADC_SEQUENCE_NUM, adc_vals); xSemaphoreGiveFromISR(adc_mutex, pdTRUE); ADCProcessorTrigger(MODULE_ADC_BASE, MODULE_ADC_SEQUENCE_NUM);}
开发者ID:obolon-svitle,项目名称:dcon-virtual-modules,代码行数:10,
示例26: ADC0IntHandler/* * This function is the implementation of the ADC0 interrupt handler. */interrupt void ADC0IntHandler(void) { //Clear the ADC interrupt flags ADCIntClear(ADC0_BASE, 3); //Get data from ADC0 sequence 3 ADCSequenceDataGet(ADC0_BASE, 3, ulCurrent); UARTprintf("Current: %u ", ulCurrent[0]);}
开发者ID:paulbartell,项目名称:TissueTester,代码行数:13,
示例27: ADC1IntHandler/* * This function is the implementation of the ADC1 interrupt handler. */interrupt void ADC1IntHandler(void) { //Clear the ADC interrupt flags ADCIntClear(ADC1_BASE, 3); //Get data from ADC0 sequence 3 ADCSequenceDataGet(ADC1_BASE, 3, ulLVDT); UARTprintf("LVDT: %u/n", ulLVDT[0]);}
开发者ID:paulbartell,项目名称:TissueTester,代码行数:13,
示例28: heightInit// *******************************************************// Initializes the ADC pins and their ISRs.void heightInit(void){ // using code from WEEK-2_ADC, my_adc.c written by Dr. Steve Weddell //SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | // SYSCTL_XTAL_8MHZ); // // The ADC0 peripheral must be enabled for use. SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); // // For this example ADC0 is used with AIN0 on port B1. This // was given by the LM3S1968 data sheet. // Therefore, GPIO port B needs to be enabled // so these pins can be used. SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); // Select the analog ADC function for these pins. // The LM3S1968 data sheet was consulted to see which functions are // allocated per pin. GPIOPinTypeADC(GPIO_PORTB_BASE, GPIO_PIN_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. Each ADC module has 4 programmable sequences, sequence 0 // to sequence 3. This example is arbitrarily using sequence 3. ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0); // // Configure step 0 on sequence 3. Sample channel 0 (ADC_CTL_CH0) 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). Sequence // 3 has only one programmable step. Sequence 1 and 2 have 4 steps, and // sequence 0 has 8 programmable steps. Since we are only doing a single // conversion using sequence 3 we will only configure step 0. For more // information on the ADC sequences and steps, reference the datasheet. ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | 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); initCircBuf (&g_heightBuf, CIRCBUF_SIZE);}
开发者ID:msteinke,项目名称:helicopter_RTP_controller,代码行数:57,
示例29: RMBD01Initvoid RMBD01Init( void ){ // // Configure the ADC for Pitch and Roll // sequence 3 means a single sample // sequence 1, 2 means up to 4 samples // sequence 0 means up to 8 samples // we use sequence 1 // if (SysCtlPeripheralPresent(SYSCTL_PERIPH_ADC0)) { SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_TIMER, 0); // 1 captures up to 4 samples // // Select the external reference for greatest accuracy. // ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V); ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ENCODER_CHANNEL_PITCH); // sample pitch ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ENCODER_CHANNEL_ROLL | ADC_CTL_IE | ADC_CTL_END); // sample roll ADCIntRegister(ADC0_BASE,1,ADCIntHandler); ADCSequenceEnable(ADC0_BASE, 1); ADCIntEnable(ADC0_BASE, 1); // // Setup timer for ADC_TRIGGER_TIMER // SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1); // // Configure the second timer to generate triggers to the ADC // TimerConfigure(TIMER1_BASE, TIMER_CFG_32_BIT_PER); TimerLoadSet(TIMER1_BASE, TIMER_A, SysCtlClockGet() / 1000); // 2 ms TimerControlStall(TIMER1_BASE, TIMER_A, true); TimerControlTrigger(TIMER1_BASE, TIMER_A, true); // // Enable the timers. // TimerEnable(TIMER1_BASE, TIMER_A); new_adc = false; // } // // Clear outstanding ADC interrupt and enable // ADCIntClear(ADC0_BASE, 1); IntEnable(INT_ADC0);} // InitADC
开发者ID:EranSegal,项目名称:ek-lm4f230H5QR,代码行数:55,
示例30: mainint main(void) { settemp = 25; uint32_t ui32ADC0Value[4]; SysCtlClockSet( SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); 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); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); IntMasterEnable(); IntEnable(INT_UART0); UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); 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; char m[] = "Current Temperature is *C, Set Temperature is *C"; m[23]=(ui32TempValueC/10 % 10) + '0'; m[24]=(ui32TempValueC%10) + '0'; m[49]=(settemp/10 % 10) + '0'; m[50]=(settemp%10) + '0'; int i; for(i=0;m[i];i++){ UARTCharPut(UART0_BASE, m[i]); } if(ui32TempValueC < settemp){ GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,8); } else{ GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,2); } UARTCharPut(UART0_BASE, '/r'); UARTCharPut(UART0_BASE, '/n'); SysCtlDelay(1000000); }}
开发者ID:CS308-2016,项目名称:SmartLuggage,代码行数:55,
注:本文中的ADCIntClear函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ADCProcessorTrigger函数代码示例 C++ AD1889_WRITEW函数代码示例 |