66 #if defined(BOARD_KEIL_MCB_18574357)
67 #define _ADC_CHANNLE ADC_CH1
68 #define _LPC_ADC_ID LPC_ADC0
69 #define _LPC_ADC_IRQ ADC0_IRQn
70 #define _GPDMA_CONN_ADC GPDMA_CONN_ADC_0
71 #elif defined(BOARD_HITEX_EVA_18504350)
72 #define _ADC_CHANNLE ADC_CH2
73 #define _LPC_ADC_ID LPC_ADC1
74 #define _LPC_ADC_IRQ ADC1_IRQn
75 #define _GPDMA_CONN_ADC GPDMA_CONN_ADC_1
78 static char WelcomeMenu[] =
"\r\nHello NXP Semiconductors \r\n"
80 "Sample rate : 400kHz \r\n"
81 "Bit accuracy : 10 bits \r\n"
82 "Press \'c\' to continue or \'x\' to quit\r\n"
83 "Press \'o\' or \'p\' to set Sample rate "
84 "(valid only when Burst mode is enabled)\r\n"
85 "Press \'k\' or \'l\' to set Bit accuracy\r\n"
86 "Press \'b\' to ENABLE or DISABLE Burst Mode\r\n";
87 static char SelectMenu[] =
"\r\nPress number 1-3 to choose ADC running mode:\r\n"
88 "\t1: Polling Mode \r\n"
89 "\t2: Interrupt Mode \r\n"
109 DEBUGOUT(
"ADC value is : 0x%04x\r\n", data);
122 NVIC_DisableIRQ(DMA_IRQn);
123 NVIC_SetPriority(DMA_IRQn, ((0x01 << 3) | 0x01));
124 NVIC_EnableIRQ(DMA_IRQn);
126 NVIC_EnableIRQ(_LPC_ADC_IRQ);
157 NVIC_DisableIRQ(DMA_IRQn);
158 NVIC_DisableIRQ(_LPC_ADC_IRQ);
169 NVIC_EnableIRQ(_LPC_ADC_IRQ);
189 NVIC_DisableIRQ(_LPC_ADC_IRQ);
244 NVIC_DisableIRQ(_LPC_ADC_IRQ);
250 NVIC_EnableIRQ(_LPC_ADC_IRQ);
272 NVIC_DisableIRQ(_LPC_ADC_IRQ);
278 NVIC_EnableIRQ(_LPC_ADC_IRQ);
305 bool end_Flag =
false;
320 if (bufferUART ==
'c') {
323 while (bufferUART == 0xFF) {
325 if ((bufferUART !=
'1') && (bufferUART !=
'2') && (bufferUART !=
'3')) {
329 switch (bufferUART) {
347 else if (bufferUART ==
'x') {
349 DEBUGOUT(
"\r\nADC demo terminated!");
351 else if (bufferUART ==
'o') {
352 _bitRate -= _bitRate > 0 ? 1000 : 0;
354 DEBUGOUT(
"Rate : %d Sample/s - Accuracy : %d bit \r\n", _bitRate, 10 - _bitAccuracy);
356 else if (bufferUART ==
'p') {
357 _bitRate += _bitRate < 400000 ? 1000 : 0;
359 DEBUGOUT(
"Rate : %d Sample/s - Accuracy : %d bit \r\n", _bitRate, 10 - _bitAccuracy);
361 else if (bufferUART ==
'k') {
362 _bitAccuracy += _bitAccuracy <
ADC_3BITS ? 1 : 0;
364 DEBUGOUT(
"Rate : %d Sample/s - Accuracy : %d bit \r\n", _bitRate, 10 - _bitAccuracy);
366 else if (bufferUART ==
'l') {
367 _bitAccuracy -= _bitAccuracy > 0 ? 1 : 0;
369 DEBUGOUT(
"Rate : %d Sample/s - Accuracy : %d bit \r\n", _bitRate, 10 - _bitAccuracy);
371 else if (bufferUART ==
'b') {
377 DEBUGOUT(
"Burst Mode DISABLED\r\n");