AnsweredAssumed Answered

STM32F10x interrupt example question

Question asked by Carter Lee on Sep 4, 2017
Latest reply on Sep 4, 2017 by Clive One

HI.


Currently I'm trying to understand about STM32F10x's interrupt.


So I've got some snippet code as the below,

USART1's IRQ number is 37.

 

// interrupt example snippet code //
unsigned int vector_table_start_addr = *(unsigned int *)0xE000ED08 ; // VTOR register OK.

*(unsigned int *)(vector_table_start_addr + (16+37)x4 ) = UART_Handler; // cf) UART_Handler set ??

*(unsigned char *)(0xE000E400+37) = prio;


unsigned int offset = (unsigned int)(37/32)*4;
unsigned int bitpos = (unsigned int (37%32);
*(unsigned int *)(0xE000E100+offset) &= ~(1<<bitpos);

 

Q1. what does (16+37)x4 mean in *(unsigned int *)(vector_table_start_addr + (16+37)x4 ) = UART_Handler; ??
Would you please let me know how does it come from? and how to understand it?

 

Q2. How does it get 0xE000E400 and 0xE000E100 address number from *(unsigned char *)(0xE000E400+37) = prio;  and  *(unsigned int *)(0xE000E100+offset) &= ~(1<<bitpos);

Would you please let me know how does it come from? and how do I understand it?

Outcomes