\n\t\u5728\u5355\u7247\u673a<\/u>\u4e0e\u5d4c\u5165\u5f0f\u5f00\u53d1\u4e2d\uff0c\u67d0\u4e9b\u573a\u666f\u9700\u8981\u6355\u83b7\u4f20\u611f\u5668<\/u>\u7684\u9ad8\u7535\u5e73\uff08\u6216\u4f4e\u7535\u5e73\uff09\u4fe1\u53f7\u7684\u6301\u7eed\u65f6\u95f4\uff0c\u5982\u7ea2\u5916<\/u>\u89e3\u7801\u4fe1\u53f7\u3001\u7f16\u7801\u5668<\/u>\u8f93\u5165\u4fe1\u53f7\u7b49\u3002<\/span><\/p>\n
\n\t\u5982\u4e0b\u56fe\uff0c\u4ee5\u5355\u4e00\u7684\u4e00\u6bb5\u9ad8\u7535\u5e73\u8f93\u5165\u4fe1\u53f7\u4e3a\u4f8b\uff0c\u5982\u4f55\u6d4b\u91cf<\/u>\u8fd9\u6bb5\u9ad8\u7535\u5e73\u7684\u65f6\u95f4\u5462\uff1f<\/span><\/p>\n
\n\t\u4ece\u76f4\u89c2\u4e0a\u7406\u89e3\uff0c\u5c31\u662f\u8981\u4e0d\u65ad\u7684\u68c0\u6d4b\u8fd9\u4e2a\u4fe1\u53f7\uff0c\u5f53\u4fe1\u53f7\u4ece0\u53d8\u52301\u65f6\uff0c\u8bb0\u5f55\u4e00\u4e2a\u65f6\u95f4\uff0c\u518d\u4ece1\u53d8\u52300\u65f6\uff0c\u8bb0\u5f55\u53e6\u4e00\u4e2a\u65f6\u95f4\uff0c\u4e24\u4e2a\u65f6\u95f4\u5dee\u5c31\u662f\u9ad8\u7535\u5e73\u7684\u6301\u7eed\u65f6\u95f4\u4e86\u3002\u90a3\u5177\u4f53\u8981\u600e\u4e48\u7f16\u7a0b\u5462\uff1f\u8fd9\u5c31\u8981\u7528\u5230\u5b9a\u65f6\u5668\u4e86\u3002<\/span><\/p>\n
\n\t<\/span><\/p>\n
\n\t\u4e0a\u7bc7\u4ecb\u7ecd\u4e86\u5b9a\u65f6\u5668\u7684\u8f93\u51fa\u529f\u80fd\uff0c\u672c\u7bc7\u662f\u5229\u7528\u5b9a\u65f6\u5668\u7684\u8f93\u5165\u529f\u80fd\uff0c\u6765\u8ba1\u7b97\u8109\u51b2\u65f6\u957f\u3002\u5982\u4e0b\u56fe\uff1a<\/span><\/p>\n
\n\t\t\t\u5b9a\u65f6\u5668\u7684CNT\u8ba1\u6570\u5668\u5728\u4e0d\u505c\u7684\u8ba1\u6570<\/span><\/p>\n<\/li>\n
\n\t\t\t\u9996\u5148\u914d\u7f6e\u5b9a\u65f6\u5668\u7684\u8f93\u5165\u901a\u9053\u4e3a\u4e0a\u5347\u6cbf\u6355\u83b7\uff0c\u8fd9\u6837\u5f53\u68c0\u6d4b\u5230\u4ece0\u52301\u7684\u8df3\u53d8\u65f6\uff0cCCR1\u5c31\u4f1a\u5148\u4fdd\u5b58\u5f53\u524d\u7684CNT\u503c\uff0c\u540c\u65f6CNT\u4f1a\u6e05\u96f6\u91cd\u65b0\u5f00\u59cb\u8ba1\u6570<\/span><\/p>\n<\/li>\n
\n\t\t\t\u7136\u540e\u5c06\u5b9a\u65f6\u5668\u7684\u8f93\u5165\u901a\u9053\u4e3a\u4e0b\u964d\u6cbf\u6355\u83b7\uff0c\u5f53\u68c0\u6d4b\u4ece1\u52300\u7684\u8df3\u53d8\u65f6\uff0cCCR2\u5c31\u4f1a\u5148\u4fdd\u5b58\u5f53\u524d\u7684CNT\u503c<\/span><\/p>\n<\/li>\n
\n\t\t\t\u5728\u8fd9\u671f\u95f4\uff0cCNT\u7684\u8ba1\u6570\u503c\u53ef\u80fd\u4f1a\u6ea2\u51fa\uff0c\u8fd9\u4e0d\u5f71\u54cd\uff0c\u8bb0\u5f55\u4e0b\u6ea2\u51fa\u7684\u6b21\u6570\uff0c\u5e76\u91cd\u65b0\u5f00\u59cb\u8ba1\u6570\u5373\u53ef<\/span><\/p>\n<\/li>\n
\n\t\t\t\u6700\u7ec8\uff0ct2-t1\u7684\u9ad8\u7535\u5e73\u65f6\u95f4\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7N\u6b21\u7684\u6ea2\u51fa\u65f6\u95f4\u52a0CCR2\u4fdd\u5b58\u7684\u65f6\u95f4\u6765\u8ba1\u7b97\u83b7\u5f97\u4e86<\/span><\/p>\n<\/li>\n<\/ul>\n
\n\t<\/span><\/p>\n
\n\t <\/p>\n
\n\t <\/p>\n
\n\t\u4e0a\u7bc7\u4ecb\u7ecd\u4e86\u5b9a\u65f6\u5668\u8f93\u51faPWM\u65f6\u7528\u5230\u7684\u51e0\u4e2a\u5bc4\u5b58\u5668\uff08CR\u3001CCMR\u3001CNT\u3001PSC\u3001ARR\u3001CCR\u7b49\uff09\uff0c\u8fd9\u91cc\u518d\u4ecb\u7ecd\u51e0\u4e2a\u6355\u83b7\u4fe1\u53f7\u65f6\u9700\u8981\u7528\u5230\u7684\u51e0\u4e2a\u5bc4\u5b58\u5668\uff1a<\/span><\/p>\n
\n\tCCMR\u5bc4\u5b58\u5668\u4e0a\u7bc7\u5df2\u6709\u4ecb\u7ecd\uff0c\u53ea\u662f\u4e0a\u7bc7\u4ec5\u4ecb\u7ecd\u4e86\u8f93\u51fa\u6a21\u5f0f\u4e0b\u7684\u529f\u80fd\uff0c\u672c\u7bc7\u518d\u4ecb\u7ecd\u4e00\u4e0b\u5b83\u5728\u8f93\u5165\u6a21\u5f0f\u4e0b\u7684\u529f\u80fd\uff1a<\/span><\/p>\n
\n\t\u8fd9\u4e9b\u901a\u9053\u53ef\u7528\u4e8e<\/span>\u8f93\u5165\uff08\u6355\u83b7\u6a21\u5f0f\uff09<\/strong><\/span>\u6216<\/span>\u8f93\u51fa\uff08\u6bd4\u8f83\u6a21\u5f0f\uff09\u6a21\u5f0f<\/strong><\/span>\u3002\u901a\u9053\u65b9\u5411\u901a\u8fc7\u914d\u7f6e\u76f8\u5e94\u7684 CCxS \u4f4d\u8fdb\u884c\u5b9a\u4e49\u3002\u6b64\u5bc4\u5b58\u5668\u7684\u6240\u6709\u5176\u5b83\u4f4d\u5728\u8f93\u5165\u6a21\u5f0f\u548c\u8f93\u51fa\u6a21\u5f0f\u4e0b\u7684\u529f\u80fd\u5747\u4e0d\u540c\u3002\u5bf9\u4e8e\u4efb\u4e00\u7ed9\u5b9a\u4f4d<\/span><\/p>\n
\n\t\t\tOCxx \u7528\u4e8e\u8bf4\u660e\u901a\u9053\u914d\u7f6e\u4e3a\u8f93\u51fa\u65f6\u8be5\u4f4d\u5bf9\u5e94\u7684\u529f\u80fd<\/span><\/p>\n<\/li>\n
\n\t\t\tICxx \u5219\u7528\u4e8e\u8bf4\u660e\u901a\u9053\u914d\u7f6e\u4e3a\u8f93\u5165\u65f6 \u8be5\u4f4d\u5bf9\u5e94\u7684\u529f\u80fd<\/span><\/p>\n<\/li>\n<\/ul>\n
\n\t\u56e0\u6b64\uff0c\u5fc5\u987b\u6ce8\u610f\u540c\u4e00\u4e2a\u4f4d\u5728\u8f93\u5165\u9636\u6bb5\u548c\u8f93\u51fa\u9636\u6bb5\u5177\u6709\u4e0d\u540c\u7684\u542b\u4e49\u3002<\/span><\/p>\n
\n\t<\/span><\/p>\n
\n\t\u8fd9\u91cc\u4ec5\u5148\u4ecb\u7ecd<\/span>\u8f93\u5165\u6a21\u5f0f<\/strong><\/span>\u4e0b\u7684\u529f\u80fd\uff1a<\/span><\/p>\n
\n\t\t\t\u4f4d 15:12 <\/span>IC2F<\/strong><\/span>\uff1a\u8f93\u5165\u6355\u83b7 2 \u6ee4\u6ce2\u5668<\/u> (Input capture 2 filter)<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 11:10 <\/span>IC2PSC[1:0]<\/strong><\/span>\uff1a\u8f93\u5165\u6355\u83b7 2 \u9884\u5206\u9891\u5668 (Input capture 2 prescaler)<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 9:8 <\/span>CC2S<\/strong><\/span>\uff1a\u6355\u83b7\/\u6bd4\u8f83 2 \u9009\u62e9 (Capture\/compare 2 selection)<\/span> \u7528\u6cd5\u53c2\u7167\u4e0b\u9762\u7684CC1S\u901a\u90531<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 7:4 <\/span>IC1F<\/strong><\/span>\uff1a\u8f93\u5165\u6355\u83b7 1 \u6ee4\u6ce2\u5668 (Input capture 1 filter)<\/span><\/p>\n
\n\t\t\t\u6570\u5b57\u6ee4\u6ce2\u5668\u7531\u4e8b\u4ef6\u8ba1\u6570\u5668\u7ec4\u6210\uff0c\u6bcf N \u4e2a\u4e8b\u4ef6\u624d\u89c6\u4e3a\u4e00\u4e2a\u6709\u6548\u8fb9\u6cbf\uff1a<\/span><\/p>\n
\n\t\t\t\t\t0000\uff1a\u65e0\u6ee4\u6ce2\u5668<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t0001~1111\uff1a\u5176\u5b83\u9891\u7387\u7684\u6ee4\u6ce2\u5668<\/span><\/p>\n<\/li>\n<\/ul>\n<\/li>\n
\n\t\t\t\u4f4d 3:2 <\/span>IC1PSC<\/strong><\/span>\uff1a\u8f93\u5165\u6355\u83b7 1 \u9884\u5206\u9891\u5668 (Input capture 1 prescaler)<\/span><\/p>\n
\n\t\t\t\u6b64\u4f4d\u57df\u5b9a\u4e49 CC1 \u8f93\u5165 (IC1) \u7684\u9884\u5206\u9891\u6bd4\u3002\u53ea\u8981 CC1E=0\uff08TI<\/u>Mx_CCER \u5bc4\u5b58\u5668\uff09\uff0c\u9884\u5206\u9891\u5668\u4fbf\u7acb\u5373\u590d\u4f4d\u3002<\/span><\/p>\n
\n\t\t\t\t\t00\uff1a\u65e0\u9884\u5206\u9891\u5668\uff0c\u6355\u83b7\u8f93\u5165\u4e0a\u6bcf\u68c0\u6d4b\u5230\u4e00\u4e2a\u8fb9\u6cbf\u4fbf\u6267\u884c\u6355\u83b7<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t01~11\uff1a\u6bcf\u53d1\u751f 2 \uff084\u30018\uff09\u4e2a\u4e8b\u4ef6\u4fbf\u6267\u884c\u4e00\u6b21\u6355\u83b7<\/span><\/p>\n<\/li>\n<\/ul>\n<\/li>\n
\n\t\t\t\u4f4d 1:0 <\/span>CC1S<\/strong><\/span>\uff1a\u6355\u83b7\/\u6bd4\u8f83 1 \u9009\u62e9 (Capture\/Compare 1 selection)\uff0c\u6b64\u4f4d\u57df\u5b9a\u4e49\u901a\u9053\u65b9\u5411\uff08\u8f93\u5165\/\u8f93\u51fa\uff09\u4ee5\u53ca\u6240\u4f7f\u7528\u7684\u8f93\u5165\u3002<\/span><\/p>\n
\n\t\t\t\t\t00\uff1aCC1 \u901a\u9053\u914d\u7f6e\u4e3a\u8f93\u51fa<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t01\uff1aCC1 \u901a\u9053\u914d\u7f6e\u4e3a\u8f93\u5165\uff0cIC1 \u6620\u5c04\u5230 TI1 \u4e0a<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t10\uff1aCC1 \u901a\u9053\u914d\u7f6e\u4e3a\u8f93\u5165\uff0cIC1 \u6620\u5c04\u5230 TI2 \u4e0a<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t11\uff1aCC1 \u901a\u9053\u914d\u7f6e\u4e3a\u8f93\u5165\uff0cIC1 \u6620\u5c04\u5230 TRC \u4e0a\u3002\u6b64\u6a21\u5f0f\u4ec5\u5728\u901a\u8fc7 TS \u4f4d\uff08TIMx_SMCR \u5bc4\u5b58\u5668\uff09\u9009\u62e9\u5185\u90e8\u89e6\u53d1\u8f93\u5165\u65f6\u6709\u6548<\/span><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n
\n\t\u6ce8\uff1a \u4ec5\u5f53\u901a\u9053\u5173\u95ed\u65f6\uff08TIMx_CCER \u4e2d\u7684 CC1E = 0\uff09\uff0c\u624d\u53ef\u5411 CC1S \u4f4d\u5199\u5165\u6570\u636e\u3002<\/span><\/p>\n
\n\t\u6211\u4eec\u8981\u7528\u5230\u8fd9\u4e2a\u5bc4\u5b58\u5668\u7684\u6700\u4f4e 2 \u4f4d\uff0c CC1E \u548c CC1P\u3002<\/span><\/p>\n
\n\t<\/span><\/p>\n
\n\t\t\t\u4f4d 15\u300111\u30017\u30013 <\/span>CCxNP<\/strong><\/span>\uff1a\u6355\u83b7 \/\u6bd4\u8f83x \u8f93\u51fa\u6781\u6027 (Capture\/Comparex output Polarity)\u3002<\/span><\/p>\n
\n\t\t\t\t\tCCx \u901a\u9053\u914d\u7f6e\u4e3a\u8f93\u51fa\uff1a CCxNP \u5fc5\u987b\u4fdd\u6301\u6e05\u96f6\u3002<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\tCCx \u901a\u9053\u914d\u7f6e\u4e3a\u8f93\u5165\uff1a\u6b64\u4f4d\u4e0e CCxP \u914d\u5408\u4f7f\u7528\uff0c\u7528\u4ee5\u5b9a\u4e49 TI1FP1\/TI2FP1 \u7684\u6781\u6027\u3002\u8bf7\u53c2\u89c1 CCxP \u8bf4\u660e\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<\/li>\n
\n\t\t\t\u4f4d 14\u300110\u30016\u30012 \u4fdd\u7559\uff0c\u5fc5\u987b\u4fdd\u6301\u590d\u4f4d\u503c\u3002<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 13\u30019\u30015\u30011 <\/span>CCxP<\/strong><\/span>\uff1a\u6355\u83b7 \/\u6bd4\u8f83x \u8f93\u51fa\u6781\u6027 (Capture\/Comparex output Polarity)\u3002<\/span><\/p>\n
\n\t\t\t\t\t00\uff1a\u975e\u53cd\u76f8\/\u4e0a\u5347\u6cbf\u89e6\u53d1<\/span> \u7535\u8def<\/u>\u5bf9 TIxFP1 \u4e0a\u5347\u6cbf\u654f\u611f \uff08\u5728\u590d\u4f4d\u6a21\u5f0f\u3001\u5916\u90e8\u65f6\u949f<\/u>\u6a21\u5f0f\u6216\u89e6\u53d1\u6a21\u5f0f\u4e0b\u6267\u884c\u6355\u83b7\u6216\u89e6\u53d1\u64cd\u4f5c\uff09\uff0c TIxFP1 \u672a\u53cd\u76f8 \uff08\u5728\u95e8\u63a7\u6a21\u5f0f\u6216\u7f16\u7801\u5668\u6a21\u5f0f\u4e0b\u6267\u884c\u89e6\u53d1\u64cd\u4f5c\uff09\u3002<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t01\uff1a\u53cd\u76f8\/\u4e0b\u964d\u6cbf\u89e6\u53d1<\/span> \u7535\u8def\u5bf9 TIxFP1 \u4e0b\u964d\u6cbf\u654f\u611f \uff08\u5728\u590d\u4f4d\u6a21\u5f0f\u3001\u5916\u90e8\u65f6\u949f\u6a21\u5f0f\u6216\u89e6\u53d1\u6a21\u5f0f\u4e0b\u6267\u884c\u6355\u83b7\u6216\u89e6\u53d1\u64cd\u4f5c\uff09\uff0c TIxFP1 \u53cd\u76f8 \uff08\u5728\u95e8\u63a7\u6a21\u5f0f\u6216\u7f16\u7801\u5668\u6a21\u5f0f\u4e0b\u6267\u884c\u89e6\u53d1\u64cd\u4f5c\uff09\u3002<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t10\uff1a\u4fdd\u7559\uff0c\u4e0d\u4f7f\u7528\u6b64\u914d\u7f6e\u3002<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t11\uff1a\u975e\u53cd\u76f8\/\u4e0a\u5347\u6cbf\u548c\u4e0b\u964d\u6cbf\u5747\u89e6\u53d1<\/span> \u7535\u8def\u5bf9 TIxFP1 \u4e0a\u5347\u6cbf\u548c\u4e0b\u964d\u6cbf\u90fd\u654f\u611f\uff08\u5728\u590d\u4f4d\u6a21\u5f0f\u3001\u5916\u90e8\u65f6\u949f\u6a21\u5f0f\u6216\u89e6\u53d1\u6a21\u5f0f\u4e0b\u6267\u884c\u6355\u83b7\u6216\u89e6\u53d1\u64cd\u4f5c\uff09\uff0cTIxFP1 \u672a\u53cd\u76f8\uff08\u5728\u95e8\u63a7\u6a21\u5f0f\u4e0b\u6267\u884c\u89e6\u53d1\u64cd\u4f5c\uff09\u3002\u7f16\u7801\u5668\u6a21\u5f0f\u4e0b\u4e0d\u5f97\u4f7f\u7528\u6b64\u914d\u7f6e\u3002<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t0\uff1aOCx \u9ad8\u7535\u5e73\u6709\u6548<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t1\uff1aOCx\u4f4e\u7535\u5e73\u6709\u6548<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\tCCx \u901a\u9053\u914d\u7f6e\u4e3a<\/span>\u8f93\u51fa<\/strong><\/span>\uff1a<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\tCCx \u901a\u9053\u914d\u7f6e\u4e3a<\/span>\u8f93\u5165<\/strong><\/span>\uff1a<\/span><\/p>\n
\n\t\t\t\t\tCCxNP\/CCxP \u4f4d\u53ef\u9488\u5bf9\u89e6\u53d1\u6216\u6355\u83b7\u64cd\u4f5c\u9009\u62e9 TI1FP1 \u548c TI2FP1 \u7684\u6781\u6027\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<\/li>\n
\n\t\t\t\u4f4d 12\u30018\u30014\u30010 <\/span>CCxE<\/strong><\/span>\uff1a\u6355\u83b7 \/\u6bd4\u8f83 x \u8f93\u51fa\u4f7f\u80fd (Capture\/Comparex output enable)\u3002<\/span><\/p>\n
\n\t\t\t\t\t0\uff1a\u7981\u6b62\u6355\u83b7<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t1\uff1a\u4f7f\u80fd\u6355\u83b7<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t0\uff1a\u5173\u95ed––OCx \u672a\u6fc0\u6d3b<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\t1\uff1a\u5f00\u542f––\u5728\u76f8\u5e94\u8f93\u51fa\u5f15\u811a\u4e0a\u8f93\u51fa OCx\u4fe1\u53f7<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\tCCx \u901a\u9053\u914d\u7f6e\u4e3a<\/span>\u8f93\u51fa<\/strong><\/span>\uff1a<\/span><\/p>\n<\/li>\n
\n\t\t\t\t\tCCx \u901a\u9053\u914d\u7f6e\u4e3a<\/span>\u8f93\u5165<\/strong><\/span>\uff1a<\/span><\/p>\n
\n\t\t\t\t\t\u6b64\u4f4d\u51b3\u5b9a\u4e86\u662f\u5426\u53ef\u4ee5\u5b9e\u9645\u5c06\u8ba1\u6570\u5668\u503c\u6355\u83b7\u5230\u8f93\u5165\u6355\u83b7\/\u6bd4\u8f83\u5bc4\u5b58\u5668 1 (TIMx_CCR1) \u4e2d\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n
\n\t\u6211\u4eec\u9700\u8981\u7528\u5230\u4e2d\u65ad\u6765\u5904\u7406\u6355\u83b7\u6570\u636e\uff0c\u6240\u4ee5\u5fc5\u987b\u5f00\u542f\u901a\u9053 1 \u7684\u6355\u83b7\u6bd4\u8f83\u4e2d\u65ad\uff0c\u5373 <\/span>CC1IE <\/strong><\/span>\u8bbe\u7f6e\u4e3a 1 \u3002<\/span><\/p>\n
\n\t<\/span><\/p>\n
\n\t\t\t\u4f4d 15\u300113\u30017\u30015 \u4fdd\u7559\uff0c\u5fc5\u987b\u4fdd\u6301\u590d\u4f4d\u503c\u3002<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 14 <\/span>TDE<\/strong><\/span>\uff1a\u89e6\u53d1 DMA \u8bf7\u6c42\u4f7f\u80fd (Trigger DMA request enable)<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 12~\u4f4d9 <\/span>CCxDE<\/strong><\/span>\uff1a\u6355\u83b7\/\u6bd4\u8f83x DMA \u8bf7\u6c42\u4f7f\u80fd (Capture\/Compare 1 DMA request enable)<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 8 <\/span>UDE<\/strong><\/span>\uff1a\u66f4\u65b0 DMA \u8bf7\u6c42\u4f7f\u80fd (Update<\/u> DMA request enable)<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 6 <\/span>TIE<\/strong><\/span>\uff1a\u89e6\u53d1\u4fe1\u53f7(TRGI)\u4e2d\u65ad\u4f7f\u80fd (Trigger interrupt enable)<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 4~\u4f4d1 <\/span>CCxIE<\/strong><\/span>\uff1a\u6355\u83b7\/\u6bd4\u8f83x \u4e2d\u65ad\u4f7f\u80fd (Capture\/Compare 1 interrupt enable)<\/span><\/p>\n<\/li>\n
\n\t\t\t\u4f4d 0 <\/span>UIE<\/strong><\/span>\uff1a\u66f4\u65b0\u4e2d\u65ad\u4f7f\u80fd (Update interrupt enable)<\/span><\/p>\n<\/li>\n<\/ul>\n
\n\t <\/p>\n
\n\t\u8fd9\u91cc\u7528\u5230\u7684\u662f\u5b9a\u65f6\u56685\u7684\u901a\u90531\uff0c\u6839\u636eSTM32<\/u>F407\u7684\u6570\u636e\u624b\u518c“3 Pi<\/u>nouts and pin description”\u4e2d\u7684“Table 9. Alternate function mapping”\u590d\u7528\u5f15\u811a\u8bf4\u660e\u8868\uff0c\u53ef\u4ee5\u770b\u5230\u5b9a\u65f6\u56685\u901a\u90531\u5bf9\u5e94\u7684\u5f15\u811a\u4f4dA0\uff0c\u6240\u4ee5\u4f7f\u7528A0\u4f5c\u4e3a\u4fe1\u53f7\u7684\u8f93\u5165\u5f15\u811a\u3002<\/span><\/span><\/p>\n
\n\t\u56e0\u6b64\u7a0b\u5e8f\u4e2d\u5bf9A0\u5f15\u811a\u53ef\u4ee5\u8fd9\u6837\u914d\u7f6e\uff0c\u6ce8\u610f\u4e00\u5b9a\u8981<\/span>\u914d\u7f6e\u5f15\u811a\u7684\u590d\u7528\u529f\u80fd<\/strong><\/span>\uff1a<\/span><\/p>\n
\r\nGPIO_InitTypeDef<\/span> GPIO_InitStructure<\/span>; \/*GPIO \u7ed3\u6784\u4f53*\/<\/span><\/span>\r\nRCC_AHB1PeriphClockCmd<\/span>(RCC_AHB1Periph_GPIOA<\/span>, ENABLE<\/span>); \/\/\u4f7f\u80fdPORTA\u65f6\u949f <\/span><\/span>\r\n\r\n\/*\u8f93\u5165\u4fe1\u53f7\u7684GPIO\u521d\u59cb\u5316*\/<\/span><\/span>\r\nGPIO_InitStructure<\/span>.GPIO_Pin<\/span> =<\/span> GPIO_Pin_0<\/span>; \/\/GPIOA0<\/span><\/span>\r\nGPIO_InitStructure<\/span>.GPIO_Mode<\/span> =<\/span> GPIO_Mode_AF<\/span>; \/*\u590d\u7528\u529f\u80fd*\/<\/span><\/span>\r\nGPIO_InitStructure<\/span>.GPIO_Speed<\/span> =<\/span> GPIO_Speed_100MHz<\/span>; \/\/\u901f\u5ea6100MHz<\/span><\/span>\r\nGPIO_InitStructure<\/span>.GPIO_OType<\/span> =<\/span> GPIO_OType_PP<\/span>; \/\/\u63a8\u633d\u590d\u7528\u8f93\u51fa<\/span><\/span>\r\nGPIO_InitStructure<\/span>.GPIO_PuPd<\/span> =<\/span> GPIO_PuPd_DOWN<\/span>; \/*\u4e0b\u62c9*\/<\/span><\/span>\r\nGPIO_Init<\/span>(GPIOA<\/span>,&<\/span>GPIO_InitStructure<\/span>); \/\/\u521d\u59cb\u5316PA0<\/span><\/span>\r\n\r\nGPIO_PinAFConfig<\/span>(GPIOA<\/span>,GPIO_PinSource0<\/span>,GPIO_AF_TIM5<\/span>); \/\/PA0\u590d\u7528\u4f4d\u5b9a\u65f6\u56685<\/span><\/span><\/pre>\n\n\t <\/p>\n
\n\t4.1.2 \u65f6\u57fa\u521d\u59cb\u5316<\/span><\/h3>\n\n\t\u4f7f\u7528\u5b9a\u65f6\u5668\uff0c\u65f6\u57fa\u521d\u59cb\u5316\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0c\u5c31\u662f\u8981\u8bbe\u7f6e\u4e00\u4e9b\u8ba1\u6570\u7684\u9891\u7387\u4e0e\u6ea2\u51fa\u503c\uff08\u81ea\u52a8\u91cd\u88c5\u8f7d\u503c\uff09\uff1a<\/span><\/p>\n
\r\nTIM_TimeBaseInitTypeDef<\/span> TIM_TimeBaseStructure<\/span>; \/*\u65f6\u57fa \u7ed3\u6784\u4f53*\/<\/span><\/span>\r\n\r\n\/*\u65f6\u57fa\u521d\u59cb\u5316*\/<\/span><\/span>\r\nTIM_TimeBaseStructure<\/span>.TIM_Period<\/span>=<\/span>arr<\/span>; \/* \u81ea\u52a8\u91cd\u88c5\u8f7d\u503c *\/<\/span><\/span>\r\nTIM_TimeBaseStructure<\/span>.TIM_Prescaler<\/span>=<\/span>psc<\/span>; \/* \u5b9a\u65f6\u5668\u5206\u9891 *\/<\/span><\/span>\r\nTIM_TimeBaseStructure<\/span>.TIM_ClockDivision<\/span>=<\/span>TIM_CKD_DIV1<\/span>;<\/span>\r\nTIM_TimeBaseStructure<\/span>.TIM_CounterMode<\/span>=<\/span>TIM_CounterMode_Up<\/span>; \/\/\u5411\u4e0a\u8ba1\u6570\u6a21\u5f0f<\/span><\/span>\r\nTIM_TimeBaseInit<\/span>(TIM5<\/span>,&<\/span>TIM_TimeBaseStructure<\/span>);<\/span><\/pre>\n\n\t <\/p>\n
\n\t4.1.3 \u8f93\u5165\u901a\u9053\u521d\u59cb\u5316<\/span><\/h3>\n\n\t\u5c06\u5b9a\u65f6\u5668\u7684\u901a\u90531\u8bbe\u7f6e\u4e3a\u8f93\u5165\u6355\u83b7\u6a21\u5f0f\uff1a<\/span><\/p>\n
\r\nTIM_ICInitTypeDef<\/span> TIM5_ICInitStructure<\/span>; \/*\u8f93\u5165\u901a\u9053 \u7ed3\u6784\u4f53*\/<\/span><\/span>\r\n\r\n\/*\u8f93\u5165\u901a\u9053\u521d\u59cb\u5316\uff0c\u521d\u59cb\u5316TIM5\u8f93\u5165\u6355\u83b7\u53c2\u6570*\/<\/span><\/span>\r\nTIM5_ICInitStructure<\/span>.TIM_Channel<\/span> =<\/span> TIM_Channel_1<\/span>; \/\/CC1S=01 \u9009\u62e9\u8f93\u5165\u7aef IC1\u6620\u5c04\u5230TI1\u4e0a<\/span><\/span>\r\nTIM5_ICInitStructure<\/span>.TIM_ICPolarity<\/span> =<\/span> TIM_ICPolarity_Rising<\/span>; \/* \u4e0a\u5347\u6cbf\u6355\u83b7 *\/<\/span><\/span>\r\nTIM5_ICInitStructure<\/span>.TIM_ICSelection<\/span> =<\/span> TIM_ICSelection_DirectTI<\/span>; \/\/\u6620\u5c04\u5230TI1\u4e0a<\/span><\/span>\r\nTIM5_ICInitStructure<\/span>.TIM_ICPrescaler<\/span> =<\/span> TIM_ICPSC_DIV1<\/span>; \/\/\u914d\u7f6e\u8f93\u5165\u5206\u9891,\u4e0d\u5206\u9891 <\/span><\/span>\r\nTIM5_ICInitStructure<\/span>.TIM_ICFilter<\/span> =<\/span> 0x00<\/span>; \/\/IC1F=0000 \u914d\u7f6e\u8f93\u5165\u6ee4\u6ce2\u5668 \u4e0d\u6ee4\u6ce2<\/span><\/span>\r\nTIM_ICInit<\/span>(TIM5<\/span>, &<\/span>TIM5_ICInitStructure<\/span>);<\/span>\r\n\r\nTIM_ITConfig<\/span>(TIM5<\/span>,TIM_IT_Update<\/span>|<\/span>TIM_IT_CC1<\/span>,ENABLE<\/span>); \/* \u5141\u8bb8\u66f4\u65b0(\u6ea2\u51fa)\u4e2d\u65ad ,\u5141\u8bb8CC1IE\u6355\u83b7\u4e2d\u65ad *\/<\/span> <\/span>\r\n\r\nTIM_Cmd<\/span>(TIM5<\/span>,ENABLE<\/span> ); \/\/\u4f7f\u80fd\u5b9a\u65f6\u56685<\/span><\/span><\/pre>\n\n- \n
\n\t\t\t\u5173\u4e8e\u914d\u7f6eCCMR1\u3001CCER\u5bc4\u5b58\u5668<\/span><\/p>\n<\/li>\n<\/ul>\n
\n\tCCMR1:<\/span><\/p>\n
\n\t
<\/span><\/p>\n
\n\tCCER:<\/span>
<\/span><\/p>\n
\n\tTIM_ICInit<\/code><\/span>\u51fd\u6570\u5bf9\u5e94\u4e8e\u8f93\u5165\u901a\u9053\u7684\u521d\u59cb\u5316\uff0c\u5176\u5b9e\u5c31\u662f\u64cd\u4f5c<\/span>CCMR1<\/code><\/span>\u3001<\/span>CCER<\/code><\/span>\u5bc4\u5b58\u5668\uff1a<\/span><\/p>\n
\r\nvoid<\/span> TIM_ICInit<\/span>(TIM_TypeDef<\/span>*<\/span> TIMx<\/span>, TIM_ICInitTypeDef<\/span>*<\/span> TIM_ICInitStruct<\/span>)<\/span>\r\n{<\/span>\r\n if<\/u><\/span> (TIM_ICInitStruct<\/span>-><\/span>TIM_Channel<\/span> ==<\/span> TIM_Channel_1<\/span>)<\/span>\r\n { \/* TI1 \u914d\u7f6e *\/<\/span><\/span>\r\n TI1_Config<\/span>(TIMx<\/span>, TIM_ICInitStruct<\/span>-><\/span>TIM_ICPolarity<\/span>,<\/span>\r\n TIM_ICInitStruct<\/span>-><\/span>TIM_ICSelection<\/span>,<\/span>\r\n TIM_ICInitStruct<\/span>-><\/span>TIM_ICFilter<\/span>);<\/span>\r\n \/* \u8bbe\u7f6e\u4e2d\u65ad\u6355\u83b7\u9884\u5206\u9891\u503c *\/<\/span><\/span>\r\n TIM_SetIC1Prescaler<\/span>(TIMx<\/span>, TIM_ICInitStruct<\/span>-><\/span>TIM_ICPrescaler<\/span>);<\/span>\r\n }<\/span>\r\n else<\/span> if<\/span> (TIM_ICInitStruct<\/span>-><\/span>TIM_Channel<\/span> ==<\/span> TIM_Channel_2<\/span>)<\/span>\r\n {<\/span>\r\n \/*\u7701\u7565...*\/<\/span><\/span>\r\n }<\/span>\r\n}<\/span>\r\n\r\nstatic<\/span> void<\/span> TI1_Config<\/span>(TIM_TypeDef<\/span>*<\/span> TIMx<\/span>, uint16_t<\/span> TIM_ICPolarity<\/span>, uint16_t<\/span> TIM_ICSelection<\/span>,uint16_t<\/span> TIM_ICFilter<\/span>)<\/span>\r\n{<\/span>\r\n uint16_t<\/span> tmpccmr1<\/span> =<\/span> 0<\/span>, tmpccer<\/span> =<\/span> 0<\/span>;<\/span>\r\n\r\n \/* \u5173\u95ed\u901a\u90531: \u590d\u4f4dCC1E\u4f4d *\/<\/span><\/span>\r\n TIMx<\/span>-><\/span>