µÎ´ð¶¨Ê±Æ÷ºÍÍⲿÖжÏÒ»ÆðʹÓÃʱ£¬µ±ÍⲿÖжϴò¶ÏµÎ´ð¶¨Ê±µÄʱºò£¬¿ÉÄܻὫµÎ´ð¶¨Ê±Æ÷¹Ø±Õ£¬½«µÎ´ðÑÓʱµÄº¯ÊýÐÞ¸ÄΪÒÔϼ´¿É
#include "systick.h" /**************************************** ʵÏÖxmsÑÓʱ£¬xms×î´óΪ798 ****************************************/ void Delay_xms(uint32_t xms) { u32 i; SysTick->CTRL =0;
SysTick->LOAD = 21000*xms; //Ïò×Ô¶¯ÖØÔؼĴæÆ÷дÈë¼ÆÊýÖµ
SysTick->VAL =0; //³õʼ»¯µ±Ç°Öµ¼Ä´æÆ÷
i=SysTick->CTRL; SysTick->CTRL |=1<<0; //´ò¿ªµÎ´ð¶¨Ê±Æ÷ do { //µÈ´ý¶¨Ê±µ½´ï i=SysTick->CTRL; SysTick->CTRL =1<<0; //´ò¿ªµÎ´ð¶¨Ê±Æ÷
} while( !(i & (1<<16) )); SysTick->CTRL =0;//¹Ø±ÕµÎ´ð¶¨Ê±Æ÷ }
|
±í8.9 SysTick¿ØÖƼ°×´Ì¬¼Ä´æÆ÷£¨µØÖ·£º0xE000_E010£©
λ¶Î | Ãû³Æ | ÀàÐÍ | ¸´Î»Öµ | ÃèÊö |
16 | COUNTFLAG | R | 0 | Èç¹ûÔÚÉϴζÁÈ¡±¾¼Ä´æÆ÷ºó£¬ SysTick ÒѾÊýµ½ÁË 0£¬Ôò¸ÃλΪ 1¡£Èç¹û¶ÁÈ¡¸Ã룬¸Ã뽫×Ô¶¯ÇåÁã |
2 | CLKSOURCE | R/W | 0 | 0=ÍⲿʱÖÓÔ´(STCLK) 1=ÄÚºËʱÖÓ(FCLK) |
1 | TICKINT | R/W | 0 | 1=SysTick µ¹Êýµ½ 0 ʱ²úÉú SysTick Òì³£ÇëÇó 0=Êýµ½ 0 ʱÎÞ¶¯×÷ |
0 | ENABLE | R/W | 0 | SysTick ¶¨Ê±Æ÷µÄʹÄÜλ |