LPC11C24 ADC_IRQn

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11C24 ADC_IRQn

1,017 Views
shenjian
Contributor II

i use      lpcopen_v2_00a_keil_iar_nxp_lpcxpresso_11c24 

static ADC_CLOCK_SETUP_T ADCSetup;
void ADC_INIT(void)
{
Chip_ADC_Init(LPC_ADC, &ADCSetup);

Chip_ADC_EnableChannel(LPC_ADC, ADC_CH0, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH1, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH2, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH3, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH5, ENABLE);

Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH0, ENABLE);
Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH1, ENABLE);
Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH2, ENABLE);
Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH3, ENABLE);
Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH5, ENABLE);

Chip_ADC_Int_SetGlobalCmd(LPC_ADC,ENABLE);
Chip_ADC_SetBurstCmd(LPC_ADC,ENABLE);

DB_PutStr("\n A>");   //------->>>   Can output   A 

Chip_ADC_SetStartMode(LPC_ADC, ADC_START_ON_CTOUT15, ADC_TRIGGERMODE_RISING);

NVIC_EnableIRQ(ADC_IRQn);    //--------------->>>>Die here.

DB_PutStr("\n B>");    //------->>>   Cannot output   B
}

Thank you!

Labels (5)
0 Kudos
5 Replies

768 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello shen jian,

I see you config ADC start mode :

Chip_ADC_SetStartMode(LPC_ADC, ADC_START_ON_CTOUT15, ADC_TRIGGERMODE_RISING);

so please check whether the ADC have start .

Also please pay attention, enable ADC interrupt we need first config ADC interrupt enable register:

A/D Interrupt Enable Register (AD0INTEN - 0x4001 C00C).  then NVIC_EnableIRQ(ADC_IRQn); ,

then start ADC.

And what about the detail when Die .

You can send your project to me,I will help you check it on my side.


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

768 Views
shenjian
Contributor II

the project   js BMS.uvproj  

0 Kudos

768 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Shen jian,

I have test your project on my side, it run into ADC interrupt function, I take a video about the steps,

please have a look at my attachment.

If don't want this happen, you can start ADC after all the initialization.

Hope it helps,


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

768 Views
shenjian
Contributor II

Hello Alice_Yang

Thank you for taking the time to help.   

Found a situation, the ADC's ch0,ch1,ch2,ch3,ch5 at the same time open interrupt will appear repeatedly into the interrupt and can not exit, as long as the ch0 interrupt shut down the system will be able to operate normally, excuse me what is this situation? Thank you very much!

like this 


void ADC_IRQHandler(void)
{
if(Chip_ADC_ReadStatus(LPC_ADC, ADC_CH0, ADC_DR_DONE_STAT) )
Chip_ADC_ReadValue(LPC_ADC, ADC_CH0, &dataADC0);

if(Chip_ADC_ReadStatus(LPC_ADC, ADC_CH1, ADC_DR_DONE_STAT) )
Chip_ADC_ReadValue(LPC_ADC, ADC_CH1, &dataADC1);

if(Chip_ADC_ReadStatus(LPC_ADC, ADC_CH2, ADC_DR_DONE_STAT) )
Chip_ADC_ReadValue(LPC_ADC, ADC_CH2, &dataADC2);

if(Chip_ADC_ReadStatus(LPC_ADC, ADC_CH3, ADC_DR_DONE_STAT) )
Chip_ADC_ReadValue(LPC_ADC, ADC_CH3, &dataADC3);

if(Chip_ADC_ReadStatus(LPC_ADC, ADC_CH5, ADC_DR_DONE_STAT) )
Chip_ADC_ReadValue(LPC_ADC, ADC_CH5, &dataADC5);
}


static ADC_CLOCK_SETUP_T ADCSetup;
void ADC_INIT(void)
{
Chip_ADC_Init(LPC_ADC, &ADCSetup);

Chip_ADC_EnableChannel(LPC_ADC, ADC_CH0, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH1, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH2, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH3, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH5, ENABLE);

//Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH0, ENABLE);
Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH1, ENABLE);
Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH2, ENABLE);
Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH3, ENABLE);
Chip_ADC_Int_SetChannelCmd(LPC_ADC, ADC_CH5, ENABLE);

//Chip_ADC_Int_SetGlobalCmd(LPC_ADC,ENABLE);
Chip_ADC_SetBurstCmd(LPC_ADC, ENABLE);

DB_PutStr("\n A>");

Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);
NVIC_EnableIRQ(ADC_IRQn);
DB_PutStr("\n B>");
}

0 Kudos

768 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello shen jian,

Due to you enable the BURST mode: Chip_ADC_SetBurstCmd(LPC_ADC, ENABLE);

so the AD converter dose repeated conversions through the channels selected:

pastedImage_3.png

Hope it helps,


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos