void initAdc (const adc_t adcNumber) { ADCSetup.adcRate = ADC_MAX_SAMPLE_RATE; ADCSetup.bitsAccuracy = ADC_10BITS; ADCSetup.burstMode = false; if ((adcNumber > 0) && (adcNumber < (sizeof (adc) / sizeof (adc_t)))) { /*ADC Init */ Chip_SCU_ADC_Channel_Config(ADC_ID, adc[adcNumber]); // Channel on ADC0 Chip_ADC_Init(_LPC_ADC_ID, &ADCSetup); Chip_ADC_EnableChannel(_LPC_ADC_ID, adc[adcNumber], ENABLE); } }
void adc_init(void) { ADC_CLOCK_SETUP_T ADCSetup; /* * PIO0_12 AD1 V_25 * PIO0_14 AD3 V_18 * PIO0_16 AD5 V_CORE * PIO0_23 AD7 V_09 * */ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 12, FUNC2); Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 14, FUNC2); Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 16, FUNC1); Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 23, FUNC1); Chip_ADC_Init(LPC_ADC, &ADCSetup); }
/** \brief ADC Initialization method */ uint8_t init_ADC_EDUCIAA(void) { /** \details * This function initialize the ADC peripheral in the EDU-CIAA board, * with the correct parameters with LPCOpen library. It uses CH1 * * \param none * * \return uint8_t: TBD (to support errors in the init function) * */ static ADC_CLOCK_SETUP_T configADC; configADC.adcRate=1000; /** max 409 KHz*/ configADC.burstMode=DISABLE; configADC.bitsAccuracy=ADC_10BITS; Chip_ADC_Init(LPC_ADC0,&configADC); Chip_ADC_EnableChannel(LPC_ADC0,ADC_CH1,ENABLE); Chip_ADC_SetSampleRate(LPC_ADC0, &configADC,ADC_MAX_SAMPLE_RATE); return TRUE; }
void Board_ADC_Init(void) { // ADC0 Chip_ADC_Init(LPC_ADC0, &(adcsData[0].setup)); adcsData[0].adc = LPC_ADC0; Chip_ADC_SetBurstCmd(LPC_ADC0, DISABLE); NVIC_EnableIRQ(ADC0_IRQn); // ADC1 //Chip_ADC_Init(LPC_ADC1, &(adcsData[1].setup)); //adcsData[1].adc = LPC_ADC1; //Chip_ADC_SetBurstCmd(LPC_ADC1, DISABLE); //NVIC_EnableIRQ(ADC1_IRQn); flagWaitingADCConv=0; ADCValues[0]=0; ADCValues[1]=0; ADCValues[2]=0; Chip_ADC_Int_SetChannelCmd(adcsData[0].adc, ADC_CH1, ENABLE); Chip_ADC_Int_SetChannelCmd(adcsData[0].adc, ADC_CH2, ENABLE); Chip_ADC_Int_SetChannelCmd(adcsData[0].adc, ADC_CH3, ENABLE); }
/* * @brief: enable/disable the ADC and DAC peripheral * @param: ENEABLE_AI, DISABLE_AI, ENEABLE_AO, DISABLE_AO * @return: none */ void analogConfig( uint8_t config ){ switch(config){ case ENABLE_ANALOG_INPUTS: { /* Config ADC0 sample mode */ /* ADC_CLOCK_SETUP_T ADCSetup = { 400000, // ADC rate 10, // ADC bit accuracy 0 // ADC Burt Mode (true or false) }; */ ADC_CLOCK_SETUP_T ADCSetup; /* Initialized to default values: * - Sample rate:ADC_MAX_SAMPLE_RATE=400KHz * - resolution: ADC_10BITS * - burst mode: DISABLE */ Chip_ADC_Init( LPC_ADC0, &ADCSetup ); /* Disable burst mode */ Chip_ADC_SetBurstCmd( LPC_ADC0, DISABLE ); /* Set sample rate to 200KHz */ Chip_ADC_SetSampleRate( LPC_ADC0, &ADCSetup, ADC_MAX_SAMPLE_RATE/2 ); /* Disable all channels */ Chip_ADC_EnableChannel( LPC_ADC0,ADC_CH1, DISABLE ); Chip_ADC_Int_SetChannelCmd( LPC_ADC0, ADC_CH1, DISABLE ); Chip_ADC_EnableChannel( LPC_ADC0, ADC_CH2, DISABLE ); Chip_ADC_Int_SetChannelCmd( LPC_ADC0, ADC_CH2, DISABLE ); Chip_ADC_EnableChannel( LPC_ADC0, ADC_CH3, DISABLE ); Chip_ADC_Int_SetChannelCmd( LPC_ADC0, ADC_CH3, DISABLE ); Chip_ADC_EnableChannel( LPC_ADC0, ADC_CH4, DISABLE ); Chip_ADC_Int_SetChannelCmd( LPC_ADC0, ADC_CH4, DISABLE ); } break; case DISABLE_ANALOG_INPUTS: /* Disable ADC peripheral */ Chip_ADC_DeInit( LPC_ADC0 ); break; case ENABLE_ANALOG_OUTPUTS: /* Initialize the DAC peripheral */ Chip_DAC_Init(LPC_DAC); /* Enables the DMA operation and controls DMA timer */ Chip_DAC_ConfigDAConverterControl(LPC_DAC, DAC_DMA_ENA); /* DCAR DMA access */ /* Update value to DAC buffer*/ Chip_DAC_UpdateValue(LPC_DAC, 0); break; case DISABLE_ANALOG_OUTPUTS: /* Disable DAC peripheral */ Chip_DAC_DeInit( LPC_DAC ); break; } }
/** * @brief Main entry point * @return Nothing */ int main(void) { SystemCoreClockUpdate(); Board_Init(); setupClock(); SystemCoreClockUpdate(); On = true; enableOut = false; controlFlag = false; Board_LED_Set(0, On); DEBUGOUT("Starting\n"); /* Initialize RITimer */ Chip_RIT_Init(LPC_RITIMER); LPC_IOCON->PINSEL[4] |= 0x00000555; //Change this after you know which pwm outputs are needed. LPC_IOCON->PINMODE[3] |= (3 << 6); LPC_IOCON->PINMODE[3] |= (3 << 12); LPC_IOCON->PINSEL[1] |= (1 << 14); LPC_IOCON->PINSEL[1] |= (1 << 16); LPC_IOCON->PINSEL[1] |= (1 << 18); LPC_IOCON->PINSEL[1] |= (1 << 20); LPC_IOCON->PINMODE[1] |= (2 << 14); LPC_IOCON->PINMODE[1] |= (2 << 16); LPC_IOCON->PINMODE[1] |= (2 << 18); LPC_IOCON->PINMODE[1] |= (2 << 20); LPC_SYSCTL->PCLKSEL[0] |= (1 << 12); //PCLK_PWM1 = CCLK LPC_IOCON->PINMODE[4] |= (3 << 26); LPC_SYSCTL->PCONP |= (1 << 17); //Enable clock LPC_SYSCTL->PCLKSEL[1] |= (1 << 30); //PCLKMPWM = CCLK LPC_SYSCTL->PCLKSEL[0] |= (1 << 24); Chip_PWM_Init(LPC_PWM1); LPC_PWM1->PR = 0; Chip_PWM_SetMatch(LPC_PWM1, 0, 3000); Chip_PWM_SetMatch(LPC_PWM1, 1, 1500); Chip_PWM_SetMatch(LPC_PWM1, 2, 1500); Chip_PWM_SetMatch(LPC_PWM1, 3, 1500); Chip_PWM_ResetOnMatchEnable(LPC_PWM1, 0); Chip_PWM_SetCountClockSrc(LPC_PWM1, PWM_CAPSRC_RISING_PCLK, 0); Chip_PWM_SetControlMode(LPC_PWM1, 0, PWM_SINGLE_EDGE_CONTROL_MODE, PWM_OUT_ENABLED); Chip_PWM_SetControlMode(LPC_PWM1, 1, PWM_SINGLE_EDGE_CONTROL_MODE, PWM_OUT_ENABLED); Chip_PWM_SetControlMode(LPC_PWM1, 2, PWM_SINGLE_EDGE_CONTROL_MODE, PWM_OUT_ENABLED); Chip_PWM_LatchEnable(LPC_PWM1, 0, PWM_OUT_ENABLED); Chip_PWM_LatchEnable(LPC_PWM1, 1, PWM_OUT_ENABLED); Chip_PWM_LatchEnable(LPC_PWM1, 2, PWM_OUT_ENABLED); Chip_PWM_LatchEnable(LPC_PWM1, 3, PWM_OUT_ENABLED); Chip_PWM_Enable(LPC_PWM1); Chip_PWM_Reset(LPC_PWM1); Chip_GPIO_Init(LPC_GPIO); LPC_MCPWM->CON_SET |= (1 <<3); DCACSetFreq(1074); LPC_MCPWM->DT = 12; LPC_MCPWM->INTEN_SET |= 1; LPC_MCPWM->INTF_SET |= 1; LPC_MCPWM->CON_SET |= 1; freq = 1074; NVIC_EnableIRQ(RITIMER_IRQn); Chip_ADC_Init(LPC_ADC, &ADCSetup); Chip_ADC_SetBurstCmd(LPC_ADC, DISABLE); /* Configure RIT for a 1s interrupt tick rate */ Chip_RIT_SetTimerInterval(LPC_RITIMER, TIME_INTERVAL); /* LED is toggled in interrupt handler */ vout = 0; voutOldest = 0; voutOld = 0; while (1) { if(controlFlag) { bool emergency = !Chip_GPIO_GetPinState(LPC_GPIO,2,13); emergency |= !Chip_GPIO_GetPinState(LPC_GPIO,2,13); emergency |= !Chip_GPIO_GetPinState(LPC_GPIO,2,13); emergency |= !Chip_GPIO_GetPinState(LPC_GPIO,2,13); emergency |= !Chip_GPIO_GetPinState(LPC_GPIO,2,13); emergency |= !Chip_GPIO_GetPinState(LPC_GPIO,2,13); emergency = !emergency; if(emergency) { enableOut = false; vout = 0; } else { #ifdef enableLoad enableOut = Chip_GPIO_GetPinState(LPC_GPIO,0,28); #else enableOut = true; #endif } Board_LED_Set(0, enableOut); DCDCControl(); DCACControl(); Vmeasure += readADC(VIN_PIN); Imeasure += readADC(CURRENT_PIN); times++; if(times >= delayFactor && enableOut) { DEBUGOUT("%d %d %d %d\n",readADC(VIN_PIN), readADC(VOUT_PIN), readADC(CURRENT_PIN), vout); times = 0; cycles++; if(cycles < ncycles) { #ifdef enableMPPT MPPT(Vmeasure/delayFactor, Imeasure/delayFactor); #endif Vmeasure = 0; Imeasure = 0; } else { cycles = 0; } } if(enablePrev != enableOut) { DEBUGOUT("TOGGLING %d\n",enableOut); } enablePrev = enableOut; controlFlag = false; if(emergency) return 0; } } }
void Board_ADC_Init() { Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO0_11, IOCON_FUNC2|IOCON_ADMODE_EN|(!IOCON_HYS_EN)|IOCON_MODE_INACT); Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_0, IOCON_FUNC2|IOCON_ADMODE_EN|(!IOCON_HYS_EN)|IOCON_MODE_INACT); Chip_ADC_Init(LPC_ADC, &adc_setup); }
/** * @brief Main routine for ADC example * @return Nothing */ int main(void) { bool end_Flag = false; uint32_t _bitRate = ADC_MAX_SAMPLE_RATE; uint8_t bufferUART; SystemCoreClockUpdate(); Board_Init(); /* Chip_IOCON_PinMux(0, 25, IOCON_ADMODE_EN, IOCON_FUNC1); */ /*ADC Init */ Chip_ADC_Init(_LPC_ADC_ID, &ADCSetup); Chip_ADC_EnableChannel(_LPC_ADC_ID, _ADC_CHANNLE, ENABLE); while (!end_Flag) { DEBUGOUT(WelcomeMenu); while (!end_Flag) { bufferUART = 0xFF; bufferUART = DEBUGIN(); if (bufferUART == 'c') { DEBUGOUT(SelectMenu); bufferUART = 0xFF; while (bufferUART == 0xFF) { bufferUART = DEBUGIN(); if ((bufferUART != '1') && (bufferUART != '2') && (bufferUART != '3')) { bufferUART = 0xFF; } } switch (bufferUART) { case '1': /* Polling Mode */ App_Polling_Test(); break; case '2': /* Interrupt Mode */ App_Interrupt_Test(); break; case '3': /* DMA mode */ App_DMA_Test(); break; } break; } else if (bufferUART == 'x') { end_Flag = true; DEBUGOUT("\r\nADC demo terminated!"); } else if (bufferUART == 'o') { _bitRate -= _bitRate > 0 ? 1000 : 0; Chip_ADC_SetSampleRate(_LPC_ADC_ID, &ADCSetup, _bitRate); DEBUGOUT("Rate : %ld Sample/s\r\n", _bitRate); } else if (bufferUART == 'p') { _bitRate += _bitRate < 400000 ? 1000 : 0; Chip_ADC_SetSampleRate(_LPC_ADC_ID, &ADCSetup, _bitRate); DEBUGOUT("Rate : %ld Sample/s\r\n", _bitRate); } else if (bufferUART == 'b') { Burst_Mode_Flag = !Burst_Mode_Flag; ADCSetup.burstMode = Burst_Mode_Flag; Chip_ADC_SetSampleRate(_LPC_ADC_ID, &ADCSetup, _bitRate); if (Burst_Mode_Flag) { DEBUGOUT("Burst Mode ENABLED\r\n"); } else { DEBUGOUT("Burst Mode DISABLED\r\n"); } } } } return 0; }
/** * @brief main routine for blinky example * @return Function should not exit. */ int main(void) { USBD_API_INIT_PARAM_T usb_param; USB_CORE_DESCS_T desc; ErrorCode_t ret = LPC_OK; uint32_t prompt = 0; SystemCoreClockUpdate(); /* Initialize board and chip */ Board_Init(); Board_ADC_Init(); /* Initialize PWM Units */ handle0 = Chip_PWM_Init(0, 18, 100); handle1 = Chip_PWM_Init(0, 13, 100); /* enable clocks and pinmux */ Chip_USB_Init(); /* initialize USBD ROM API pointer. */ g_pUsbApi = (const USBD_API_T *) LPC_ROM_API->usbdApiBase; /* initialize call back structures */ memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T)); usb_param.usb_reg_base = LPC_USB0_BASE; /* WORKAROUND for artf44835 ROM driver BUG: Code clearing STALL bits in endpoint reset routine corrupts memory area next to the endpoint control data. For example When EP0, EP1_IN, EP1_OUT, EP2_IN are used we need to specify 3 here. But as a workaround for this issue specify 4. So that extra EPs control structure acts as padding buffer to avoid data corruption. Corruption of padding memory doesn’t affect the stack/program behaviour. */ usb_param.max_num_ep = 3 + 1; usb_param.mem_base = USB_STACK_MEM_BASE; usb_param.mem_size = USB_STACK_MEM_SIZE; /* Set the USB descriptors */ desc.device_desc = (uint8_t *) &USB_DeviceDescriptor[0]; desc.string_desc = (uint8_t *) &USB_StringDescriptor[0]; /* Note, to pass USBCV test full-speed only devices should have both descriptor arrays point to same location and device_qualifier set to 0. */ desc.high_speed_desc = (uint8_t *) &USB_FsConfigDescriptor[0]; desc.full_speed_desc = (uint8_t *) &USB_FsConfigDescriptor[0]; desc.device_qualifier = 0; /* USB Initialization */ ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param); if (ret == LPC_OK) { /* WORKAROUND for artf32219 ROM driver BUG: The mem_base parameter part of USB_param structure returned by Init() routine is not accurate causing memory allocation issues for further components. */ usb_param.mem_base = USB_STACK_MEM_BASE + (USB_STACK_MEM_SIZE - usb_param.mem_size); /* Initialize ADC */ Chip_ADC_Init(_LPC_ADC_ID, &ADCSetup); Chip_ADC_EnableChannel(_LPC_ADC_ID, ADC_CH0, ENABLE); Chip_ADC_Int_SetChannelCmd(_LPC_ADC_ID, ADC_CH0, ENABLE); NVIC_SetPriority(_LPC_ADC_IRQ, 1); NVIC_EnableIRQ(_LPC_ADC_IRQ); /* Init VCOM interface */ ret = vcom_init(g_hUsb, &desc, &usb_param); if (ret == LPC_OK) { /* enable USB interrupts */ NVIC_SetPriority(USB0_IRQn, 1); NVIC_EnableIRQ(USB0_IRQn); /* now connect */ USBD_API->hw->Connect(g_hUsb, 1); } } DEBUGSTR("USB CDC class based virtual Comm port example!\r\n"); /* Start BURST Mode (Continuously Convert and Interrupt) */ Chip_ADC_SetBurstCmd(_LPC_ADC_ID, ENABLE); Chip_RIT_Init(LPC_RITIMER); Chip_RIT_SetTimerInterval(LPC_RITIMER, CONTROL_INTERVAL); NVIC_EnableIRQ(RIT_IRQn); int read_mode = WAITING_HEADER; while (1) { /* Check if host has connected and opened the VCOM port */ if ((vcom_connected() != 0) && (prompt == 0)) { //vcom_write("Hello World!!\r\n", 15); prompt = 1; } if (prompt) { unsigned char c; if (vcom_bread(&c, 1) != 0) { switch (read_mode) { case WAITING_HEADER: if (c == PACKET_HEADER) { g_buffCounter = 0; read_mode = WAITING_FOOTER; } break; case WAITING_FOOTER: if (c == PACKET_FOOTER) { onReceivePacket(); read_mode = WAITING_HEADER; } else { g_rxBuff[g_buffCounter] = c; g_buffCounter++; } break; default: break; } } } /* Sleep until next IRQ happens */ //__WFI(); } }
/** * @brief Main routine for W5500 EVB firmware * @return Function should not exit. */ int main(void) { #if defined (__USE_LPCOPEN) #if !defined(NO_BOARD_LIB) // Read clock settings and update SystemCoreClock variable SystemCoreClockUpdate(); // Set up and initialize all required blocks and // functions related to the board hardware Board_Init(); #endif #endif uint16_t dataADC; int16_t calc_temp; /* Flag for running user's code */ bool run_user_applications = true; /* Enable and setup SysTick Timer at a periodic rate */ SysTick_Config(SystemCoreClock / TICKRATE_HZ1); /* ADC Init */ Init_ADC_PinMux(); Chip_ADC_Init(LPC_ADC, &ADCSetup); Chip_ADC_EnableChannel(LPC_ADC, TEMP_SENSOR_CH, ENABLE); #ifdef _MAIN_DEBUG_ printf("\r\n=======================================\r\n"); printf(" WIZnet W5500 EVB\r\n"); printf(" On-board Temperature sensor demo example v%d.%.2d\r\n", VER_H, VER_L); printf("=======================================\r\n"); printf(">> This example using ADC, SysTick\r\n"); printf("=======================================\r\n"); #endif /* Main loop ***************************************/ while(1) { // TODO: insert user's code here if(run_user_applications) { if(ADC_read_enable) { ADC_read_enable = false; /* Start A/D conversion */ Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING); /* Waiting for A/D conversion complete */ while (Chip_ADC_ReadStatus(LPC_ADC, TEMP_SENSOR_CH, ADC_DR_DONE_STAT) != SET) {} /* Read ADC value */ Chip_ADC_ReadValue(LPC_ADC, TEMP_SENSOR_CH, &dataADC); /* Calculate ADC value to Celsius temperature */ calc_temp = (((dataADC * SUPPLY_VOLTAGE) / 1023) - 500) / 10; /* Print ADC value */ printf("ADC value is 0x%x, ", dataADC); /* Print Celsius temperature */ printf("Celsius temperature : %d C\r\n", calc_temp); } } // End of user's code } // End of Main loop return 0; }
/** * @brief main routine for ADC example * @return Function should not exit */ int main(void) { uint32_t rawSample; int j; SystemCoreClockUpdate(); Board_Init(); DEBUGSTR("ADC Demo\r\n"); /* Setup ADC for 12-bit mode and normal power */ Chip_ADC_Init(LPC_ADC, 0); /* Setup for maximum ADC clock rate */ Chip_ADC_SetClockRate(LPC_ADC, ADC_MAX_SAMPLE_RATE); /* Setup sequencer A for ADC channel 1, EOS interrupt */ #if defined(BOARD_MCORE48_1125) /* Setup a sequencer to do the following: Perform ADC conversion of ADC channel 1 only Trigger on low edge of PIO0_7 */ Chip_ADC_SetupSequencer(LPC_ADC, ADC_SEQA_IDX, (ADC_SEQ_CTRL_CHANSEL(1) | ADC_SEQ_CTRL_MODE_EOS | ADC_SEQ_CTRL_HWTRIG_PIO0_7)); /* Select ADC_1 mux for PIO1_11 */ Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_11, (IOCON_FUNC1 | IOCON_ADMODE_EN)); /* Setup GPIO PIO0_7 as an input (will kill LED out) */ Chip_GPIO_WriteDirBit(LPC_GPIO, 0, 7, false); /* Use higher voltage trim for MCore48 board */ Chip_ADC_SetTrim(LPC_ADC, ADC_TRIM_VRANGE_HIGHV); #endif /* Need to do a calibration after initialization and trim */ Chip_ADC_StartCalibration(LPC_ADC); while (!(Chip_ADC_IsCalibrationDone(LPC_ADC))) {} /* Setup threshold 0 low and high values to about 25% and 75% of max */ Chip_ADC_SetThrLowValue(LPC_ADC, 0, ((1 * 0xFFF) / 4)); Chip_ADC_SetThrHighValue(LPC_ADC, 0, ((3 * 0xFFF) / 4)); /* Clear all pending interrupts */ Chip_ADC_ClearFlags(LPC_ADC, Chip_ADC_GetFlags(LPC_ADC)); /* Enable ADC overrun and sequence A completion interrupts */ Chip_ADC_EnableInt(LPC_ADC, (ADC_INTEN_SEQA_ENABLE | ADC_INTEN_OVRRUN_ENABLE)); /* Use threshold 0 for channel 1 and enable threshold interrupt mode for channel as crossing */ Chip_ADC_SelectTH0Channels(LPC_ADC, ADC_THRSEL_CHAN_SEL_THR1(1)); Chip_ADC_SetThresholdInt(LPC_ADC, 1, ADC_INTEN_THCMP_CROSSING); /* Enable ADC NVIC interrupt */ NVIC_EnableIRQ(ADC_A_IRQn); /* Enable sequencer */ Chip_ADC_EnableSequencer(LPC_ADC, ADC_SEQA_IDX); /* Setup SyTick for a periodic rate */ SysTick_Config(SystemCoreClock / TICKRATE_HZ); /* Endless loop */ while (1) { /* Sleep until something happens */ __WFI(); if (thresholdCrossed) { thresholdCrossed = false; DEBUGSTR("********ADC threshold event********\r\n"); } /* Is a conversion sequence complete? */ if (sequenceComplete) { sequenceComplete = false; /* Get raw sample data for channels 1-8 */ for (j = 1; j <= 1; j++) { rawSample = Chip_ADC_GetDataReg(LPC_ADC, j); /* Show some ADC data */ DEBUGOUT("Sample value = 0x%x\r\n", ADC_DR_RESULT(rawSample)); DEBUGOUT("Threshold range = 0x%x\r\n", ADC_DR_THCMPRANGE(rawSample)); DEBUGOUT("Threshold cross = 0x%x\r\n", ADC_DR_THCMPCROSS(rawSample)); DEBUGOUT("Overrun = %d\r\n", ((rawSample & ADC_DR_OVERRUN) != 0)); DEBUGOUT("Data valid = %d\r\n", ((rawSample & ADC_SEQ_GDAT_DATAVALID) != 0)); DEBUGSTR("\r\n"); } } } /* Should not run to here */ return 0; }
void ADC_Init() { Chip_SCU_ADC_Channel_Config(0,ADC_CH1); Chip_ADC_Init(LPC_ADC0, &adcsetup); Chip_ADC_EnableChannel(LPC_ADC0, ADC_CH1, ENABLE); }