Other Parts Discussed in Thread: HALCOGEN
Tool/software:
Hi,
I am trying to use the functions vimEnableInterrupt and vimDisableInterrupt to enable or disable a specific interrupt vector. In my case, it’s for adcGROUP1.
However, I cannot make it work. It seems that the interrupt for adcGROUP1 is never enabled by the instruction vimEnableInterrupt(15, SYS_IRQ).
Below, I have attached the sys_main.c and notification.c files so you can take a look. Thank you for your assistance with this issue.
sys_main.c
/* Include Files */
#include "sys_common.h"
/* USER CODE BEGIN (1) */
#include "adc.h"
#include "sci.h"
#include "gio.h"
#include "stdlib.h"
#include "stdio.h"
#include "sys_vim.h"
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
/* USER CODE END */
int main(void)
{
/* USER CODE BEGIN (3) */
sciInit();
adcInit();
gioInit();
//_enable_IRQ();
vimInit();
vimEnableInterrupt(15, SYS_IRQ);
// vimChannelMap(15, 15, adc1Group1Interrupt);
//vimDisableInterrupt(15);
adcEnableNotification(adcREG1, adcGROUP1);
/* start adc conversion */
adcStartConversion(adcREG1, adcGROUP1);
printf("\n");
fflush(stdout);
while (1)
{
gioSetBit(gioPORTB, 0, 1);
printf("Sen by Serial Port \n");
fflush(stdout);
gioSetBit(gioPORTB, 0, 0);
}
/* USER CODE END */
return 0;
}
/* USER CODE BEGIN (4) */
/* USER CODE END */
notification.c
/* Include Files */
#include "esm.h"
#include "sys_selftest.h"
#include "adc.h"
#include "gio.h"
#include "sci.h"
#include "sys_dma.h"
/* USER CODE BEGIN (0) */
#include "stdio.h"
#include "stdlib.h"
#include "sys_vim.h"
#pragma WEAK(adcNotification)
void adcNotification(adcBASE_t *adc, uint32 group)
{
/* enter user code between the USER CODE BEGIN and USER CODE END. */
/* USER CODE BEGIN (11) */
adcData_t adc_data;
adcData_t *ptr;
uint32 i = 0;
uint32 c = 0;
c = adcGetData(adcREG1, adcGROUP1, &adc_data);
ptr = &adc_data;
for (i = 0; i < c; i++)
{
printf("adc value[%d]: %d;\n", i, ptr->value);
fflush(stdout);
ptr++;
}
//vimDisableInterrupt(15);
return;
/* USER CODE END */
}
Halcogen





