資源簡介
實現:
1.定時器檢測按鍵;
2.紅外的學習和發送;
說明:
1.硬件電路更改:
去掉R2電阻,用470歐姆電阻串接在PB8和三極管Q1的B級;
2.操作:
a.長按KEY1按鍵,待LED9點亮后進入學習。任意按一個遙控按鍵,系統將會學習到相應的按鍵信息;
b.短按KEY1按鍵,紅外發射口將發射最新學習到的紅外信號。

代碼片段和文件信息
/**
??******************************************************************************
??*?@file????system_stm32f10x.c
??*?@author??MCD?Application?Team
??*?@version?V3.5.0
??*?@date????11-March-2011
??*?@brief???CMSIS?Cortex-M3?Device?Peripheral?Access?layer?System?Source?File.
??*?
??*?1.??This?file?provides?two?functions?and?one?global?variable?to?be?called?from?
??*?????user?application:
??*??????-?SystemInit():?Setups?the?system?clock?(System?clock?source?PLL?Multiplier
??*??????????????????????factors?AHB/APBx?prescalers?and?Flash?settings).?
??*??????????????????????This?function?is?called?at?startup?just?after?reset?and?
??*??????????????????????before?branch?to?main?program.?This?call?is?made?inside
??*??????????????????????the?“startup_stm32f10x_xx.s“?file.
??*
??*??????-?SystemCoreClock?variable:?Contains?the?core?clock?(HCLK)?it?can?be?used
??*??????????????????????????????????by?the?user?application?to?setup?the?SysTick?
??*??????????????????????????????????timer?or?configure?other?parameters.
??*?????????????????????????????????????
??*??????-?SystemCoreClockUpdate():?Updates?the?variable?SystemCoreClock?and?must
??*?????????????????????????????????be?called?whenever?the?core?clock?is?changed
??*?????????????????????????????????during?program?execution.
??*
??*?2.?After?each?device?reset?the?HSI?(8?MHz)?is?used?as?system?clock?source.
??*????Then?SystemInit()?function?is?called?in?“startup_stm32f10x_xx.s“?file?to
??*????configure?the?system?clock?before?to?branch?to?main?program.
??*
??*?3.?If?the?system?clock?source?selected?by?user?fails?to?startup?the?SystemInit()
??*????function?will?do?nothing?and?HSI?still?used?as?system?clock?source.?User?can?
??*????add?some?code?to?deal?with?this?issue?inside?the?SetSysClock()?function.
??*
??*?4.?The?default?value?of?HSE?crystal?is?set?to?8?MHz?(or?25?MHz?depedning?on
??*????the?product?used)?refer?to?“HSE_VALUE“?define?in?“stm32f10x.h“?file.?
??*????When?HSE?is?used?as?system?clock?source?directly?or?through?PLL?and?you
??*????are?using?different?crystal?you?have?to?adapt?the?HSE?value?to?your?own
??*????configuration.
??*????????
??******************************************************************************
??*?@attention
??*
??*?THE?PRESENT?FIRMWARE?WHICH?IS?FOR?GUIDANCE?ONLY?AIMS?AT?PROVIDING?CUSTOMERS
??*?WITH?CODING?INFORMATION?REGARDING?THEIR?PRODUCTS?IN?ORDER?FOR?THEM?TO?SAVE
??*?TIME.?AS?A?RESULT?STMICROELECTRONICS?SHALL?NOT?BE?HELD?LIABLE?FOR?ANY
??*?DIRECT?INDIRECT?OR?CONSEQUENTIAL?DAMAGES?WITH?RESPECT?TO?ANY?CLAIMS?ARISING
??*?FROM?THE?CONTENT?OF?SUCH?FIRMWARE?AND/OR?THE?USE?MADE?BY?CUSTOMERS?OF?THE
??*?CODING?INFORMATION?CONTAINED?HEREIN?IN?CONNECTION?WITH?THEIR?PRODUCTS.
??*
??*?©?COPYRIGHT?2011?STMicroelectronics
??******************************************************************************
??*/
/**?@addtogroup?CMSIS
??*?@{
??*/
/**?@addtogroup?stm32f10x_system
??*?@{
??*
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????281149??2014-05-27?11:14??IR(OK)\obj\delay.crf
?????文件???????1557??2014-05-27?11:14??IR(OK)\obj\delay.d
?????文件?????301368??2014-05-27?11:14??IR(OK)\obj\delay.o
?????文件????????595??2014-05-27?09:41??IR(OK)\obj\delay._2i
?????文件?????????19??2014-05-26?17:25??IR(OK)\obj\ExtDll.iex
?????文件?????365484??2014-05-27?11:14??IR(OK)\obj\IR.axf
?????文件????????293??2014-06-14?17:39??IR(OK)\obj\IR.build_log.htm
?????文件?????284704??2014-05-27?11:14??IR(OK)\obj\ir.crf
?????文件???????1628??2014-05-27?11:14??IR(OK)\obj\ir.d
?????文件???????6104??2014-05-27?09:41??IR(OK)\obj\IR.fed
?????文件??????84197??2014-05-27?11:14??IR(OK)\obj\IR.htm
?????文件????????547??2014-05-27?09:42??IR(OK)\obj\IR.l2p
?????文件????????547??2014-05-27?11:14??IR(OK)\obj\IR.lnp
?????文件?????308808??2014-05-27?11:14??IR(OK)\obj\ir.o
?????文件????????479??2014-05-14?14:09??IR(OK)\obj\IR.sct
?????文件????????592??2014-05-27?09:41??IR(OK)\obj\ir._2i
?????文件?????280921??2014-05-27?11:14??IR(OK)\obj\key.crf
?????文件???????1551??2014-05-27?11:14??IR(OK)\obj\key.d
?????文件?????301616??2014-05-27?11:14??IR(OK)\obj\key.o
?????文件????????585??2014-05-27?09:41??IR(OK)\obj\key._2i
?????文件?????281282??2014-05-27?11:14??IR(OK)\obj\led.crf
?????文件???????1515??2014-05-27?11:14??IR(OK)\obj\led.d
?????文件?????301420??2014-05-27?11:14??IR(OK)\obj\led.o
?????文件????????585??2014-05-27?09:41??IR(OK)\obj\led._2i
?????文件?????283595??2014-05-27?11:14??IR(OK)\obj\main.crf
?????文件???????1707??2014-05-27?11:14??IR(OK)\obj\main.d
?????文件?????307280??2014-05-27?11:14??IR(OK)\obj\main.o
?????文件????????590??2014-05-27?09:41??IR(OK)\obj\main._2i
?????文件?????281474??2014-05-27?11:14??IR(OK)\obj\misc.crf
?????文件???????1680??2014-05-27?11:14??IR(OK)\obj\misc.d
............此處省略82個文件信息
評論
共有 條評論