1.1 ¶¨Ê±Æ÷»ù±¾ÔÀí
¶¨Ê±Æ÷µÄ»ù±¾ÔÀíÊÇ£ºÔÚÌض¨µÄƵÂÊϽøÐеÝÔö»òÕßÊǵݼõ¡£Àà±È£ºÔÚÌض¨µÄƵÂÊϽøÐеÝÔö¿ÉÒÔÀí½â¡°ÊÖ»úµÄÃë±í¹¦ÄÜ¡±£»ÔÚÌض¨µÄƵÂÊϽøÐеÝÔö¿ÉÒÔÀí½â¡°ÊÖ»úµÄµ¹¼Æʱ¹¦ÄÜ¡±¡£ÊÖ»úµÄ¡°Ãë±í¡±ºÍ¡°µ¹¼Æʱ¡±¶¼ÊÇ1ÃëÖÓ¼ÆÊýÒ»´Î£¨µÝÔö»òµÝ¼õ£©£¬Ò²¾ÍÊÇ£¬ÒÔ1HZµÄƵÂʽøÐеÝÔö»òÕߵݼõ¡£
STM32µÄÓ²¼þ¶¨Ê±Æ÷£ºÔÚÌض¨µÄƵÂÊϽøÐеÝÔö»òÕßÊǵݼõ¡£×¢Ò⣺STM32F407GT6µÄ¶¨Ê±Æ÷µÄ¼ÆÊýƵÂÊÊÇ¿ÉÒÔÁé»îÉèÖõġ£
STM32F407ZGT6µÄ¶¨Ê±Æ÷ÓÐ14¸ö¶¨Ê±Æ÷£¬¶¨Ê±Æ÷·ÖΪ£º»ù±¾¶¨Ê±Æ÷¡¢Í¨Óö¨Ê±Æ÷¡¢¸ß¼¶¿ØÖƶ¨Ê±Æ÷¡£»ù±¾¶¨Ê±Æ÷ÓÐÁ½¸ö£º·Ö±ðÊÇTIM6ºÍTIM7¡£
¶¨Ê±Æ÷µÄ·ÖÀàÈçÏ£º
ÔÚÖÐÎIJο¼ÊÖ²áÖУ¬STM32F407¶¨Ê±Ê±¼äµ½´ïʼþÊǽÐ×ö¡°¸üÐÂʼþ¡±£¬¸üеÄÓ¢ÎÄÊÇupdate event¡£
1.2 STM32F407µÄ»ù±¾¶¨Ê±Æ÷µÄÔÀí¿òͼ»ù±¾¶¨Ê±Æ÷£¨TIM6 ºÍ TIM7£©µÄÌØÐÔ°üÀ¨£º
l 16 λ×Ô¶¯ÖØÔصÝÔö¼ÆÊýÆ÷£¨CNT COUNTER ÊÇ16λµÄ¼Ä´æÆ÷£©¡£
l 16 λ¿É±à³ÌÔ¤·ÖƵÆ÷£¬·ÖƵϵÊý½éÓÚ 1 ºÍ 65536 Ö®¼ä¡££¨PSC ÊÇ16λµÄ¼Ä´æÆ÷£©
l µ±¼ÆÊýÆ÷ÉÏÒçʱ£¬»á·¢Éú¸üÐÂʼþ(¶¨Ê±Ê±¼äµ½´ïʼþ)
l ·¢ÉúÈçϸüÐÂʼþ(¶¨Ê±Ê±¼äµ½´ï)ʱ»áÉú³ÉÖжÏ
1) TIM6ºÍTIM7µÄCK_PSCµÄƵÂÊÊÇ84MHZµÄ
2) Ô¤·ÖƵÆ÷µÄ×÷ÓÃÀàËÆÓë¡°³ý·¨¡±¡£×÷ÓãºÊ¹µÃ¶¨Ê±Æ÷µÄ¡°¼ÆÊýƵÂÊ¡±¿ÉÒÔÁé»îÉèÖá£
¾ÙÀý£ºµ±Ô¤·ÖƵÆ÷дÈë0£¬ÔòÊÇ84MHZ/(0+1),Õâ¾ÍÊÇ¡°1·ÖƵ¡±¡£
µ±Ô¤·ÖƵÆ÷дÈë1£¬ÔòÊÇ84MHZ/(1+1),Õâ¾ÍÊÇ¡°2·ÖƵ¡±¡£
µ±Ô¤·ÖƵÆ÷дÈë3£¬ÔòÊÇ84MHZ/(3+1),Õâ¾ÍÊÇ¡°4·ÖƵ¡±¡£
3) CK_CNT = CK_PSC/(PSC+1)
4) CNT COUNTER(¼ÆÊýÆ÷)ÔÚCK_CNTµÄƵÂÊϽøÐС°¼Ó1²Ù×÷¡±¡£ÊÇ´Ó0¿ªÊ¼µÝÔöµÄ¡£
5) ¡°×Ô¶¯ÖØ×°ÔؼĴæÆ÷¡±µÄ×÷ÓÃÊÇ£ºÉèÖö¨Ê±µÄ¡°ÉÏÏÞÖµ¡±¡£
6) µ±CNT COUNTERµÄ¼ÆÊýÆ÷ÖµºÍ¡°×Ô¶¯ÖØ×°ÔؼĴæÆ÷¡±µÄ¡°¶¨Ê±ÉÏÏÞÖµ¡±ÏàµÈʱ£¬Ôò¶¨Ê±Ê±¼äµ½´ï¡££¨Àà±È£ºÊÖ»úÖеġ°Ãë±í¡±£©¡£
7) ¡°CNT COUNTERµÄ¼ÆÊýÆ÷Öµ¡±»áʱ¿ÌºÍ¡°×Ô¶¯ÖØ×°ÔؼĴæÆ÷¡±µÄ¡°¶¨Ê±ÉÏÏÞÖµ¡±½øÐбȽϣ¬Èç¹ûÏàµÈ£¬Ôò¶¨Ê±Ê±¼äµ½´ï¡££¨Àà±È£ºÊÖ»úÖеġ°Ãë±í¡±£©¡£
8) ͼÖеġ°U¡±Ö¸µÄÊÇ¡°update¡±,Ò²¾ÍÊÇ¡°¶¨Ê±µ½´ï¡±µÄÒâ˼¡£STM32F407¶¨Ê±Ê±¼äµ½´ïÊǽÐ×ö¡°¸üС±¡£
9) ͼÖеġ°UI¡±Ö¸µÄÊÇ¡°update interrupt¡±,Òâ˼ÊÇ£º¶¨Ê±Æ÷ʱ¼äµ½´ïºó£¬¿ÉÒÔ²úÉúÖжϡ£¡°¶¨Ê±µ½´ïÖжϡ±ÓÖ½Ð×ö¡°¸üÐÂÖжϡ±¡£
10) ¡°×Ô¶¯ÖØ×°ÔؼĴæÆ÷¡±ÊÇÓÐÓ°×ӼĴæÆ÷µÄ¡£¡°Ô¤·ÖƵ¼Ä´æÆ÷¡±Ò²ÓÐÓ°×ӼĴæÆ÷¡£
11) ¡°Ó°×ӼĴæÆ÷¡±µÄ×÷ÓÃÊÇ¡°»º³å¡±£¬±ÜÃâдÈëµÄÖµÂíÉÏÉúЧ¡£Èç¹ûʹÓá°Ó°×ӼĴæÆ÷¡±£¬CNT COUNTERºÍ¡°×Ô¶¯ÖØ×°ÔؼĴæÆ÷µÄÓ°×ӼĴæÆ÷¡±½øÐбȽϣ¬Èç¹ûCNTµÄÖµºÍ¡°×Ô¶¯ÖØ×°ÔؼĴæÆ÷µÄÓ°×ӼĴæÆ÷¡±ÖеÄÖµÏàµÈ£¬Ôò±íʾ¶¨Ê±Ê±¼äµ½´ï£¬²úÉú¡°¸üС±¡£
12) ¶¨Ê±Ê±¼äµ½´ïºó£¬Ò²¾ÍÊDzúÉú¡°¸üС±£¬Ó²¼þ»á×Ô¶¯¸üС°Ó°×ӼĴæÆ÷¡±¡£
13) Ó°×ӼĴæÆ÷²»¿ÉÒÔÖ±½Ó±à³Ì¸³ÖµµÄ£¬Ó°×ӼĴæÆ÷µÄÖµÀ´×ÔÓÚ¡°×Ô¶¯ÖØ×°ÔؼĴæÆ÷¡±¡£¸üÐÂÓ°×ӼĴæÆ÷µÄÖµÊÇÓ²¼þ×Ô¶¯Íê³É¡£Ã¿µ±¶¨Ê±¼äµ½´ïʱ£¬»á¸üÐÂÓ°×ӼĴæÆ÷µÄÖµ¡£