日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁(yè) > 單片機(jī) > 單片機(jī)
[導(dǎo)讀] #include "mytimer.h"#include "lhg_def.h"#include "uart.h"#include "lhg_def.h"#include "2440addr.h"//Timer input clock Frequency = PCLK / {prescaler value+1} / {divider value}//PCLK=50Mhz/

#include "mytimer.h"
#include "lhg_def.h"
#include "uart.h"
#include "lhg_def.h"
#include "2440addr.h"

//Timer input clock Frequency = PCLK / {prescaler value+1} / {divider value}
//PCLK=50Mhz
//prescaler : 0~255
#define prescaler234 99
//divider : 1/2,1/4,1/8,1/16 選擇為(0,1,2,3)
#define divider4 2
//定時(shí)器設(shè)置為62500HZ


void __irq timer4ISP(void) //中斷函數(shù)
{
rSRCPND |= rSRCPND|(0x1<<14);
rINTPND |= rINTPND|(0x1<<14);

Uart_Printf("now in timer4 interrupt~~ ");
}

void mytimer_init(void)//初始化定時(shí)器
{
Uart_Printf("timer4 init/r/n");
//設(shè)置中斷入口
pISR_TIMER4 = (U32)timer4ISP;
rTCFG0 &=~(0xff<<8);
rTCFG0 |= prescaler234<<8;
rTCFG1 &=~(0xf<<16);
rTCFG1 |= divider4<<16;
rTCNTB4 = 62500;//16位的 count buffer register
//rTCNTO4 = //16位的 count observation value for Time 4
rTCON |= (1<<22)|(1<<21)|(1<<20);//自動(dòng)裝載,啟動(dòng)定時(shí)器
rTCON &= ~0x200000 ; //定時(shí)器4開(kāi)始工作
//關(guān)于中斷
rSRCPND |= rSRCPND|(0x1<<14);
rINTPND |= rINTPND|(0x1<<14);
rINTMSK &= ~(0x1<<14);
}

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專(zhuān)欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關(guān)閉