cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone explain what does the interrupt “Trap�? do in the micro controller

VSrin
Associate II

I am using stm8l - discovery board and I am curious about the functionality of trap in the micro controller. My program stops instead of running continously in the while loop, Is the functionality of trap interrupt that if it occurs, it does not execute (similar to reset)?

#include <iostm8l.h>

#include <stdio.h>

#include <stdint.h>

void Cus_delay(uint32_t ntime)

{

while(ntime!=0)

{

ntime--;

}

}

main()

{

CLK_DIVR = 0x00; // Set the frequency to 16Mhz

PC_DDR = 0x80; // direction output for led

PC_CR1 = 0x80; // fast push pull mode

int a = 10;

while(1)

{

Cus_delay(400000);

Cus_delay(400000);

PC_ODR ^= 0x80;

a = a/0;

}

}

0 REPLIES 0