UC972开发板,参考实验8,完成定时器触发信号输出实验

代码

ETIMER0 TGL --> PB2

#include "nuc970.h"
#include "sys.h"
#include "etimer.h"
int main(void)
{
//高级中断控制器(AIC)Advanced Interrupt Controller 
    outpw(REG_AIC_MDCR, 0xFFFFFFFE);   //FFFF FFFE(1110),1=禁用相应的中断通道。0=无效。只有最低位无影响
    outpw(REG_AIC_MDCRH, 0x3FFFFFFF);  //(0011)3FFFFFFFE,同理,最高两位位保留位
    sysDisableCache();
    sysFlushCache(I_D_CACHE);  //I_D_CACHE=8
    sysEnableCache(CACHE_WRITE_BACK); //CACHE_WRITE_BACK=0  

    sysInitializeUART();
   		
    outpw(REG_CLK_PCLKEN0, inpw(REG_CLK_PCLKEN0) | (1 << 4));
	 
    outpw(REG_SYS_GPB_MFPL, inpw(REG_SYS_GPB_MFPL) | (0xF << 8));

    ETIMER_Open(0, ETIMER_TOGGLE_MODE, 1000);
    ETIMER_Start(0);
    while(1);
}

  

 

 

 

 

APB Devices Clock Enable Control Register 0 :APB设备时钟启用控制寄存器0

 outpw(REG_CLK_PCLKEN0, inpw(REG_CLK_PCLKEN0) | (1 << 4));  //REG_CLK_PCLKEN0的

SYS_GPB_MFPL  SYS_BA+0x078  GPIOB Low Byte Multiple Function Control Register :GPIOB低字节多功能控制寄存器

 outpw(REG_SYS_GPB_MFPL, inpw(REG_SYS_GPB_MFPL) | (0xF << 8));//设置 PB2 为 ETMR0_TGL 功能

 

posted @ 2019-06-10 21:12  浮沉沉浮  阅读(509)  评论(0编辑  收藏  举报