We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I've written some code where leds light up in a sequence. I used the systick to trigger an interrupt and light up the next led in the sequence. I want to gradually increase the speed of the sequence so I tried reconfiguring the systick settings throughout the code, but the speed always remains the same as the first time I configured it.
Any ideas what I might be doing wrong? Is it even possible to reconfigure systick and other setups multiple times?? Has it maybe got something to do with the 24-bit RELOAD and CURRENT values?
I really appreciate your responses, happy to take any suggestions :)
// snippit of main function GPIO_Setup_B(); SetupSystick(6000000); NVIC_ST_CTRL |= 0x1; // start timer Delay(1000); NVIC_ST_CTRL &= ~0x1; // stop timer SetupSystick(3000000); // speed should double, but remains the same NVIC_ST_CTRL |= 0x1; // start timer Delay(1000); NVIC_ST_CTRL &= ~0x1; // stop timer SetupSystick(2000000); NVIC_ST_CTRL |= 0x1; // start timer Delay(1000); NVIC_ST_CTRL &= ~0x1; // stop timer SetupSystick(1000000); NVIC_ST_CTRL |= 0x1; // start timer Delay(1000); // setup systick function void SetupSystick(unsigned int time) { NVIC_ST_CTRL &= ~0x1; NVIC_ST_RELOAD |= time; NVIC_ST_CURRENT |= time; // clear count status NVIC_ST_CTRL |= 0x6; NVIC_SYS_PRI3 &= ~0xE0000000; NVIC_SYS_PRI3 |= 0x40000000; } // systick ISR void SysTick_Handler(void) { if (updown == 1) { GPIOB_DATA <<= 0x1; if (GPIOB_DATA >= 0x10) { updown = 0; } } else if (updown == 0) { GPIOB_DATA >>= 0x1; if (GPIOB_DATA <= 0x1) { updown = 1; } } }
hi friends!! can anybody help to configure systic timer to run for 1 sec only. currently it is running two times for every 1 sec