Hi,
I got some questions about the breakpoints in debug mode. Below is a simple program to explain.
Putting breakpoints before the first 3 lines in main just works as expected, but aren't declarations like counter, and counter_limit able to stop the program? Is there a reason?
I tried putting a breakpoint before the LED toggle point PTD->PTOR = 1<<0; but it just gets ignored..?
And if I put it next line when counter is set to 0 again the program stops at this point every single cycle of the for loop (even if the if-request isn't true), and that confuses me most..
I hope someone can enlighten me
Best regards
Raphael
The Code:
#include "sdk_project_config.h"
#include "s32K144.h"
volatile int exit_code = 0;
int main(void)
{
PCC->PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK; //enabling clock for PORT D
PORTD->PCR[0] = PORT_PCR_MUX(1); //set pin as GPIO
PTD->PDDR = 1<<0; // pin 0 is configured as output
int counter = 0;
int counter_limit = 100000;
for(;;)
{
counter++;
if(counter > counter_limit)
{
PTD->PTOR = 1<<0;
counter = 0;
}
if(exit_code != 0)
{
break;
}
}
return exit_code;
}