main.c 625 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <stdarg.h>
  2. #include "yc11xx.h"
  3. #include "system.h"
  4. #include "core_cm0.h"
  5. uint32_t tick_count = 0;
  6. #define SYSTEM_CLOCK (24000000UL)
  7. #define CLOCK_DIVISOR 1000
  8. void SYS_TimerInit()
  9. {
  10. SysTick_Config(SYSTEM_CLOCK/CLOCK_DIVISOR); //each systick interrupt is 1ms
  11. }
  12. void SYStick_handle()
  13. {
  14. #ifdef DEBUG_SYS
  15. MyPrintf("SYSTICK Interrupt trigger a success!\n");
  16. #endif
  17. tick_count++;
  18. }
  19. int main(void)
  20. {
  21. printport_init();
  22. int i = 0x100000;
  23. while(i--);
  24. MyPrintf("this ti systick test\n");
  25. SYS_TimerInit();
  26. while(1)
  27. {
  28. if(tick_count%1000 == 0)
  29. {
  30. MyPrintf("tick_count = %d\n",tick_count);
  31. }
  32. }
  33. }