From f20dd4e4bfbe7395a2ecb772ebb9a86f33c05efe Mon Sep 17 00:00:00 2001 From: CNLohr <lohr85@gmail.com> Date: Fri, 12 May 2023 13:10:04 -0400 Subject: [PATCH] Clarify that CNT keeps counting up. --- examples/systick_irq/systick_irq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/systick_irq/systick_irq.c b/examples/systick_irq/systick_irq.c index 352f4d5..26d5de5 100644 --- a/examples/systick_irq/systick_irq.c +++ b/examples/systick_irq/systick_irq.c @@ -34,10 +34,10 @@ void systick_init(void) NVIC_EnableIRQ(SysTicK_IRQn); /* Set the tick interval to 1ms for normal op */ - SysTick->CMP = (SYSTEM_CORE_CLOCK/1000)-1; + SysTick->CMP = (SYSTEM_CORE_CLOCK/1000)-1; /* Start at zero */ - SysTick->CNT = 0; + SysTick->CNT = 0; systick_cnt = 0; /* Enable SysTick counter, IRQ, HCLK/1 */ @@ -56,10 +56,10 @@ void SysTick_Handler(void) // as a warning, if more than this length of time // passes before triggering, you may miss your // interrupt. - SysTick->CMP += (SYSTEM_CORE_CLOCK/1000); + SysTick->CMP += (SYSTEM_CORE_CLOCK/1000); /* clear IRQ */ - SysTick->SR = 0; + SysTick->SR = 0; /* update counter */ systick_cnt++; @@ -108,6 +108,6 @@ int main() Delay_Ms( 250 ); GPIOC->BSHR = (1<<16); Delay_Ms( 250 ); - printf( "Count: %lu / Milliseconds: %lu\n\r", count++, systick_cnt ); + printf( "Print #: %lu / Milliseconds: %lu / CNT: %lu\n\r", count++, systick_cnt, SysTick->CNT ); } } -- GitLab