⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 port_initial.c

📁 电子设计训练课题
💻 C
字号:
/*===============================================================*/
/*函数名称: Port_Initial.c                                      */
/*函数功能: 主函数,调用各模块                                   */
/*基本思想:  对所涉及到的端口进行配置                            */
/*修改记录: 无修改记录                                          */
/*编写作者: t483-4-19chenyong                                   */
/*编写日期: 2007-4-14                                           */
/*===============================================================*/
#include"common.h"

 

void Port_Initial (void) 
{
    WDTCN = 0x07;	// Watchdog Timer Control Register
    WDTCN = 0xDE;   // Disable WDT    
    WDTCN = 0xAD;
    SFRPAGE = 0x0F;
    XBR0 = 0x00;	// XBAR0: Initial Reset Value
    XBR1 = 0x04;	// XBAR1: Initial Reset Value
    XBR2 = 0x40;	// XBAR2: Initial Reset Value
 
    SFRPAGE = 0x0F;
    P0MDOUT = 0x00; // Output configuration for P0 
    P1MDOUT = 0x00; // Output configuration for P1 
    P2MDOUT = 0x00; // Output configuration for P2 
    P3MDOUT = 0x00; // Output configuration for P3 
    P4MDOUT = 0x00; // Output configuration for P4
    P5MDOUT = 0x00; // Output configuration for P5
    P6MDOUT = 0x00; // Output configuration for P6
    P7MDOUT = 0x00; // Output configuration for P7
    P1MDIN = 0xFF;  // Input configuration for P1
 
    SFRPAGE = 0x0F;
    CLKSEL = 0x00;  // Oscillator Clock Selector
    OSCXCN = 0x00;	// EXTERNAL Oscillator Control Register	
    OSCICN = 0x84;	// Internal Oscillator Control Register
    //采用内部晶振,为24.5MHZ8分频
}
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -