【正文】
當(dāng)CL SFR的值小于{EPCnL,CCAPnL}時(shí),輸出為低,當(dāng)PCA CL SFR的值等于或大于{EPCnL,CCAPnL}時(shí),輸出為高。PCA PWM mode /可調(diào)制脈沖寬度輸出模式由于所有模塊共用僅有的PCA定時(shí)器,所有它們的輸出頻率相同。脈寬調(diào)節(jié)模式所有PCA模塊都可用作PWM輸出(下圖)。就需要做判斷。要激活高速輸出模式,模塊CCAPMn SFR 的TOG,MAT 和ECOM 位必須都置位。PCA定時(shí)器的值與模塊捕獲寄存器的值相比較,當(dāng)兩者相等時(shí),如果位CCFn(在CCON SFR 中)和位ECCFn 在CCAPMn SFR中)都置位,將產(chǎn)生中斷。PCA Capture Mode(PCA捕獲模式圖)如果CCON SFR的位CCFn和CCAPMn SFR的位ECCFn位被置位,將產(chǎn)生中斷。對(duì)模塊的外部CEXn 輸入(CEX0/,CEX1/,CEX2/,CEX3/ 口)的跳變進(jìn)行采樣。當(dāng)PCA模塊用在PWM模式中時(shí),它們用來(lái)控制輸出的占空比。每個(gè)PCA模塊還對(duì)應(yīng)另外兩個(gè)寄存器,CCAPnH和CCAPnL。如果兩位都置位,則兩種跳變沿都被使能,捕獲可在兩種跳變沿產(chǎn)生。CAPNn()和CAPPn()用來(lái)設(shè)置捕獲輸入的有效沿。當(dāng)PCA計(jì)數(shù)值與模塊的捕獲/比較寄存器的值相匹配時(shí),如果TOG位()置位,模塊的CEXn 輸出將發(fā)生翻轉(zhuǎn)。當(dāng)模塊發(fā)生匹配或比較時(shí),ECCFn位(,n=0,1 ,2,3 由工作的模塊決定)使能CCON SFR的CCFn標(biāo)志來(lái)產(chǎn)生中斷。它們分別是:模塊0對(duì)應(yīng)CCAPM0,模塊1對(duì)應(yīng)CCAPM1,模塊2對(duì)應(yīng)CCAPM2,模塊3對(duì)應(yīng)CCAPM3。PCA的中斷系統(tǒng)如圖所示。這些標(biāo)志也只能通過(guò)軟件清除。CF位只可通過(guò)軟件清除。CR位被清零時(shí)PCA關(guān)閉。CCON SFR包含PCA的運(yùn)行控制位(CR)和PCA定時(shí)器標(biāo)志(CF)以及各個(gè)模塊的標(biāo)志(CCF3/CCF2/CCF1/CCF0)??删幊逃?jì)數(shù)器陣列PCA定時(shí)器/計(jì)數(shù)器CMOD SFR 還有2個(gè)位與PCA相關(guān)。PCA定時(shí)器是4個(gè)模塊的公共時(shí)間基準(zhǔn),可通過(guò)編程工作在:1/12振蕩頻率、1/2振蕩頻率、定時(shí)器0溢出或ECI腳的輸入()。(CEX0/PCA0/PWM0),(CEX1/PCA1/PWM1),(CEX2/PCA2/PWM2),(CEX3/PCA3/PWM3)。每個(gè)模塊可編程工作。一種典型三極管控制電路如果用弱上拉控制,建議加上拉電阻R1(~10K),如果不加上拉電阻R 1(~10K),建議R2的值在15K以上,或用強(qiáng)推挽輸出。輸出口線配置如下圖所示。當(dāng)作為一個(gè)邏輯輸出時(shí),這種配置方式必須有外部上拉,一般通過(guò)電阻外接到V D D 。輸入口帶有一個(gè)施密特觸發(fā)輸入以及一個(gè)干擾抑制電路。推挽引腳配置如下圖所示。2 .推挽輸出配置推挽輸出配置的下拉結(jié)構(gòu)與開(kāi)漏輸出以及準(zhǔn)雙向口的下拉結(jié)構(gòu)相同,但當(dāng)鎖存器為1時(shí)提供持續(xù)的強(qiáng)上拉。因此,建議不要在準(zhǔn)雙向口模式中向3V 單片機(jī)引腳施加5V電壓,如使用的話,要加限流電阻,或用二極管做輸入隔離,或用三極管做輸出隔離。準(zhǔn)雙向口輸出如下圖所示。當(dāng)口線鎖存器由0到1跳變時(shí),這個(gè)上拉用來(lái)加快準(zhǔn)雙向口由邏輯0到邏輯1轉(zhuǎn)換。當(dāng)引腳懸空時(shí),這個(gè)極弱的上拉源產(chǎn)生很弱的上拉電流將引腳上拉為高電平。如果一個(gè)引腳輸出為1而由外部裝置下拉到低時(shí),弱上拉關(guān)閉而“極弱上拉”維持開(kāi)狀態(tài),為了把這個(gè)引腳強(qiáng)拉為低,外部裝置必須有足夠的灌電流能力使引腳上的電壓降到門(mén)檻電壓以下。在3個(gè)上拉晶體管中,有1個(gè)上拉晶體管稱(chēng)為“弱上拉”,當(dāng)口線寄存器為1且引腳本身也為1時(shí)打開(kāi)。當(dāng)引腳輸出為低時(shí),它的驅(qū)動(dòng)能力很強(qiáng),可吸收相當(dāng)大的電流。準(zhǔn)雙向口輸出類(lèi)型可用作輸出和輸入功能而不需重新配置口線輸出狀態(tài)。每個(gè)口由2個(gè)控制寄存器中的相應(yīng)位控制每個(gè)引腳工作類(lèi)型。t need to reconfigure mouth lines output state. This is because juncture lines output is 1 drive ability is very weak, allowing external devices will its down. When pins for low, it output driving ability, can absorb the considerable current. Quasi twoway mouth have 3 pull_up transistor adapted to different needs.In the three and one transistor, pull up transistor called weak on pull , for 1 and paternal line registers itself pins for 1 open. This pull_up provides basic drive current make prospective twoway mouth for 1 output. If a pin for 1 and output by external devices to drop down to low, pull up close and weak very weak pull_up maintain open position, in order to put this pin for low, strong to pull the external devices must have enough power to make pin infused current threshold voltage of a voltage to the following.Article 2 pull_up transistors, called extremely weak on pull, 1 latch paternal line when open. When pin, the very weak suspended the pull_up source generates very weak and current will pin and high level.Article 3 pull_up transistor called powerful pull. Juncture line latches from 0 to 1, the jumping to accelerate must pull up by logic 0 to twoway mouth logic 1 conversion. When this happened, powerful pull open about 2 machine cycle to make pins can quickly pull to the earth high level.Quasi twoway mouth output shown below.STC12C520 series microcontroller 3V device, if the user is in pins plus 5V voltage, there will be a current flow from pins, this has caused additional VDD power consumption. Accordingly, the proposal is not in quasi twoway mouth mode 3V microcontroller pins to exert 5V voltage, such as the use of words, will add current limiting resistor, or using diode do input isolation, or use triode do output segregation.Quasi twoway mouth with a schmidt trigger input and a interference suppression circuit.2. The pushpull output configurationThe dropdown pushpull output configuration opendrain output and the structure and the prospective twoway mouth down same structure, but when latches is 1 provides continuous strong pull up. The pushpull model need more monly used for driving current situation.The pushpull pins configuration are shown below.3. Only for input (high resistance) configurationInput port configuration are shown below.Input port with a schmidt trigger input and a interference suppression circuit.4. Opendrain output configurationJuncture line latches is 0, the opendrain output close all pull_up transistors. When, as a logical output, this configuration mode must have externally pull, usually by resistance receiving V D D outside. This style of dropdown and quasi twoway mouth the same. The jammer line configuration are shown below.Opendrain port with a schmidt trigger input and a interference suppression circuit.A typical transistor control circuitIf use weak pull_up control, suggestion plus pullup resistors R1 ( K ~ 10K), if not add pullup resistors R 1 ( K ~ 10K), suggest R2 value in the 15K above, or use a strong pushpull output.STC12C5204AD series microcontroller programmable counter array (PCA)PCA contains a special 16 timer, has four 16 bits of capture/parison of module and connected. Each module programmable workIn four mode: increase/decrease along the capture, software timer, highspeed output or could be modulated pulse output. Modules connected to (0 CEX0 / PCA0 / PWM0), module 1 connected to (CEX1 / PCA1 / PWM1), modules connected to (2 CEX2 / PCA2 / PWM2), modules connected to (3 CEX3 / PCA3 / PWM3). Register the content of CH and CL is free of 16 PCA increasing count the value of the timer. PCA timer is four modules, the public time benchmark by programming work .Programmable Counter ArrayPCA Timer/CounterCMOD SFR there are 2 bytes and PCA related. They were: CIDL, idle mode allows stop PCA。謝謝!在此再次向馬麗師致以誠(chéng)摯的謝意和崇高的敬意。他精益求精的工作作風(fēng)在最后的總結(jié)階段再一次幫助了我,讓我對(duì)系統(tǒng)的工作原理和整個(gè)機(jī)構(gòu)有了系統(tǒng)的認(rèn)知。從畢業(yè)設(shè)計(jì)的剛開(kāi)始馬老師就給予我細(xì)心的指導(dǎo),馬老師心中一切計(jì)劃都安排的井井有條,這對(duì)于我第一次做這些工作有著很好的指導(dǎo)作用。在此謹(jǐn)向馬老師以誠(chéng)摯的謝意和崇高的敬意。聯(lián)合硬件、軟件來(lái)調(diào)試電路。設(shè)計(jì)并制作一款改進(jìn)型的散熱器,帶上溫度傳感器,可以實(shí)現(xiàn)溫度控制選擇STC12C5204單片機(jī),通過(guò)比較選擇了溫敏電阻作為溫度檢測(cè)工具,來(lái)實(shí)現(xiàn)筆記本的溫度收集。其中每個(gè)芯片的引腳通過(guò)紅藍(lán)兩色的方點(diǎn)來(lái)表示此時(shí)的引腳電平的高低,紅色表示高電平,藍(lán)色表示低電平。電機(jī)的啟動(dòng)和停止通過(guò)綠色的LED表示,LED亮表示電機(jī)啟動(dòng),LED滅表示電機(jī)停止?!〕绦虻恼{(diào)試與仿真單片機(jī)程序通過(guò)Keil C編輯、編譯成“*.hex”后,直接用鼠標(biāo)雙擊畫(huà)面上的STC12C5204芯片,把“*.hex”文件加入。單片機(jī)系統(tǒng)的仿真是Pr