这篇教程C++ ADCSequenceDataGet函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADCSequenceDataGet函数的典型用法代码示例。如果您正苦于以下问题:C++ ADCSequenceDataGet函数的具体用法?C++ ADCSequenceDataGet怎么用?C++ ADCSequenceDataGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADCSequenceDataGet函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ReadWall_IRunsigned int ReadWall_IR () { uint32_t resultRight, resultFront; int i; ADCProcessorTrigger(ADC0_BASE, 2); //Wait for ADC to finish converting. for ( i = 10000; i>0; i--); //delay a bit ADCSequenceDataGet(ADC0_BASE, 2, &resultRight); ADCSequenceDataGet(ADC0_BASE, 2, &resultFront); //Check if the front wall is close. if (resultFront > MAX_VAL_F){ front_wall_det = 1; } else { front_wall_det = 0; } //Check if the right wall is close. if (resultRight < MIN_VAL_R){ wall_det = 0; } else { wall_det = 1; } return resultRight;}
开发者ID:justinloveless,项目名称:TIRTOS,代码行数:25,
示例2: 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,
示例3: heightSample// *******************************************************// Takes an ADC sample. This is the location of// the helicopter on the vertical axis.void heightSample(void){ //* we could just read ADC every time we call this //* not much need to use systick as with yaw?? //* could combine yaw and height ISRs in one. unsigned long ulValue[10]; //long ulCount = 0; // // Trigger the ADC conversion. ADCProcessorTrigger(ADC0_BASE, 3); // // Wait for conversion to be completed. while(!ADCIntStatus(ADC0_BASE, 3, false)) { } // Read ADC Value. //ulCount = ADCSequenceDataGet(ADC0_BASE, 3, ulValue); //Strange thing is happening, ADCSequecnceDataGet() // Regularly returns a value on the order of 10^9 // when the return value is 0 (false). if (ADCSequenceDataGet(ADC0_BASE, 3, ulValue) == 1) { g_height = ulValue[0]; writeCircBuf(&g_heightBuf, g_height); } // I'm not going to bother taking a new reading because // one sample is not significant since it is averaged.}
开发者ID:msteinke,项目名称:helicopter_RTP_controller,代码行数:37,
示例4: 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,
示例5: 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,
示例6: setADCint setADC (void) { unsigned long ulValue; //char buffer[32] = ""; // // Trigger the sample sequence. // ADCProcessorTrigger(ADC0_BASE, 0); // // Wait until the sample sequence has completed. // while(!ADCIntStatus(ADC0_BASE, 0, false)) { } // // Read the value from the ADC. // ADCSequenceDataGet(ADC0_BASE, 0, &ulValue); /*debug show value RIT128x96x4StringDraw(" ", 90, 88, mainFULL_SCALE); itoa(ulValue, buffer, 10 ); RIT128x96x4StringDraw(buffer, 90, 88, mainFULL_SCALE); */ return ulValue; }
开发者ID:BetteLars,项目名称:EAL_Embedded,代码行数:27,
示例7: 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,
示例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: getADCValuelong getADCValue(void) { unsigned long ADCValue = 0; ADCProcessorTrigger(ADC_BASE, 0 ); while(!ADCIntStatus(ADC_BASE, 0, false)); ADCSequenceDataGet(ADC_BASE, 0, &ADCValue); return ADCValue;}
开发者ID:robz,项目名称:Rasware2012,代码行数:7,
示例10: 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,
示例11: 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,
示例12: 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,
示例13: scan_proc_adc/** * Do a processor A/D conversion sequence. */static void scan_proc_adc(void){ int samples; /* * We occasionally get too many or too few samples because * the extra (missing) samples will show up on the next read * operation. Just do it again if this happens. */ for (samples = 0; samples != ADC_SAMPLES; ) { ADCSequenceEnable(ADC0_BASE, 0); ADCProcessorTrigger(ADC0_BASE, 0); /* * Wait until the sample sequence has completed. */ while(!ADCIntStatus(ADC0_BASE, 0, false)) ; /* * Read the values from the ADC. The whole sequence * gets converted and stored in one fell swoop. */ if (xSemaphoreTake(io_mutex, IO_TIMEOUT)) { samples = ADCSequenceDataGet(ADC0_BASE, 0, (unsigned long *)adc_val); xSemaphoreGive(io_mutex); }#if (DEBUG > 0) if (samples != ADC_SAMPLES) { lprintf("A/D samples: is %d, " "should be %d./r/n", samples, ADC_SAMPLES); }#endif }}
开发者ID:gvb,项目名称:quickstart,代码行数:38,
示例14: readRightIRSensorlong readRightIRSensor (void) { unsigned long ADCValue = 0; ADCProcessorTrigger(ADC_BASE, 2 ); while(!ADCIntStatus(ADC_BASE, 2, false)); ADCSequenceDataGet(ADC_BASE, 2, &ADCValue); return ADCValue;}
开发者ID:jkoeller,项目名称:Rasware2012,代码行数:7,
示例15: adc_initvoid adc_init(void){ unsigned long ulDummy = 0; // Enable the ADC hardware SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); // Configure the pin as analog input SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); //SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1); // PIN D3/2/1 as ADC. GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_5); // PIN E5 as ADC. //GPIOPinTypeADC(GPIO_PORTB_BASE, GPIO_PIN_5 | GPIO_PIN_4); // U_AN{0..1} // for 6 ADCs // use Sample Sequencer 0 since it is the only one able to handle more than four ADCs ADCSequenceDisable(ADC0_BASE, 0); // configure Sequencer to trigger from processor with priority 0 ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); // do NOT use TRIGGER_TIMER because of malfunction in the touch screen handler //ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0); // configure the steps of the Sequencer ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH4); //CH4 = PD3 ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH5); //CH5 = PD2 ADCSequenceStepConfigure(ADC0_BASE, 0, 2, ADC_CTL_CH6); //CH6 = PD1 ADCSequenceStepConfigure(ADC0_BASE, 0, 3, ADC_CTL_CH8 | ADC_CTL_IE | ADC_CTL_END);//CH8 = PE5 //ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH11); // U_AN1 //ADCSequenceStepConfigure(ADC0_BASE, 0, 2, ADC_CTL_CH4); // U_AN2 //ADCSequenceStepConfigure(ADC0_BASE, 0, 3, ADC_CTL_CH5); // U_AN3 //ADCSequenceStepConfigure(ADC0_BASE, 0, 4, ADC_CTL_CH6); // U_AN4 //ADCSequenceStepConfigure(ADC0_BASE, 0, 5, ADC_CTL_CH7 | ADC_CTL_IE | ADC_CTL_END); // U_AN5 ADCSequenceEnable(ADC0_BASE, 0); // flush the ADC ADCSequenceDataGet(ADC0_BASE, 0, &ulDummy); // Enable Interrupt for ADC0 Sequencer 0 ADCIntEnable(ADC0_BASE, 0); IntEnable(INT_ADC0); /* for (int i=0; i < 4; i++) { for (int j=0; j < ADC_BUFF_SIZE; j++) { adcBuff[i][j] = 50; //give the buffers a half decent starting value. } } adcBuffCnt = 0; */}
开发者ID:Joel-Schofield,项目名称:engg4810-MPC,代码行数:59,
示例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: 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,
示例19: ADC0_Handlervoid ADC0_Handler(void){ // Clear flag ADCIntClear(ADC0_BASE, 0); ADCSequenceDataGet(ADC0_BASE, 0, Buffer); Status = TRUE;}
开发者ID:tach4455,项目名称:EE345M,代码行数:9,
示例20: read_battert_adc_valuert_uint32_t read_battert_adc_value(){ uint32_t battertValue; ADCProcessorTrigger(ADC0_BASE, 3); while(!ADCIntStatus(ADC0_BASE, 3, false)); ADCSequenceDataGet(ADC0_BASE, 3, &battertValue); return battertValue; }
开发者ID:trigrass2,项目名称:MircoFlyV0.7,代码行数:9,
示例21: 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,
示例22: 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,
示例23: 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,
示例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: 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,
示例26: 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,
示例27: ADC0IntHandlerextern "C" void ADC0IntHandler(void) // NOT started yet !!!! { uint32_t ui32ADC0Value[4]; //used for storing data from ADC FIFO, must be as large as the FIFO for sequencer in use. Sequencer 1 has FIFO depth of 4 //variables that cannot be optimized out by compiler ADCIntClear(ADC0_BASE, 1); //clear interrupt flag ADCSequenceDataGet(ADC0_BASE, 1, ui32ADC0Value); ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2] + ui32ADC0Value[3] + 2) / 4; //calculate average ADCProcessorTrigger(ADC0_BASE, 1);}
开发者ID:vortex314,项目名称:projects,代码行数:11,
示例28: LightSensorIntHandler//================ PRIVATE DEFINE ===========================================//////================ PRIVATE MACRO ============================================//////================ SOURCE CODE ==============================================//void LightSensorIntHandler(void) { // // Get ADC Data // ADCSequenceDataGet(ADC0_BASE, 3, &(LigthIntensityValue)); // // Clear the ADC interrupt flag. // ROM_ADCIntClear(ADC0_BASE, 3);}
开发者ID:alkyl1978,项目名称:LM4F120,代码行数:16,
示例29: ADCProcessorTriggerfloat Board::getTemp() { float ulTemp_ValueC; unsigned long gt; ADCProcessorTrigger(ADC0_BASE, 3); ADCSequenceDataGet(ADC0_BASE, 3, >); // Berechnung ulTemp_ValueC = ((1475 * 1023) - (2250 * gt)) / 10230; return ulTemp_ValueC/10000;}
开发者ID:vortex314,项目名称:projects,代码行数:12,
示例30: Handler2void Handler2() { TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT); ADCProcessorTrigger(ADC_BASE, 0); while (!ADCIntStatus(ADC_BASE, 0, false)); ADCSequenceDataGet(ADC_BASE, 0, &ADC_resultValue); pwm = ((double) 400 / 1024) * ADC_resultValue; usnprintf(buffer, BUFFSIZE, "ADC : %d/n", (int)ADC_resultValue); UARTPrint0((unsigned char *) buffer);}
开发者ID:ilabmp,项目名称:micro,代码行数:12,
注:本文中的ADCSequenceDataGet函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ADCSequenceEnable函数代码示例 C++ ADCSequenceConfigure函数代码示例 |