📄 sys_init.c
字号:
//-- 文字:通
unsigned char code WLib_tong_16x16[]={
0x40,0x42,0x44,0xcc,0x00,0x00,0xf1,0x91,0x95,0xf9,0x95,0x93,0xf1,0x00,0x00,0x00,
0x00,0x40,0x20,0x1f,0x20,0x40,0xbf,0x84,0x84,0xbf,0x94,0xa4,0x9f,0x80,0x80,0x80
};
//-- 文字:道
unsigned char code WLib_dao_16x16[]={
0x40,0x40,0x42,0xcc,0x00,0x04,0xe4,0xa5,0xb6,0xac,0xa6,0xa5,0xe4,0x04,0x00,0x00,
0x00,0x40,0x20,0x1f,0x20,0x40,0x5f,0x4a,0x4a,0x4a,0x4a,0x4a,0x5f,0x40,0x40,0x00
};
//-- 文字:温
unsigned char code WLib_wen_16x16[]={
0x10,0x60,0x02,0x0c,0xc0,0x00,0xfe,0x92,0x92,0x92,0x92,0x92,0xfe,0x00,0x00,0x00,
0x04,0x04,0x7e,0x01,0x40,0x7e,0x42,0x42,0x7e,0x42,0x7e,0x42,0x42,0x7e,0x40,0x00
};
//-- 文字:毫
unsigned char code WLib_hao_16x16[]={
0x00,0x82,0x82,0x82,0xba,0xaa,0xaa,0xab,0xaa,0xaa,0xba,0x82,0x82,0x82,0x80,0x00,
0x02,0x01,0x40,0x44,0x54,0x54,0x54,0x7e,0xaa,0xaa,0xaa,0xa0,0x82,0xe1,0x00,0x00
};
//-- 文字:度
unsigned char code WLib_du_16x16[]={
0x00,0x00,0xfc,0x24,0x24,0x24,0xfc,0x25,0x26,0x24,0xfc,0x24,0x24,0x24,0x04,0x00,
0x40,0x20,0x9f,0x80,0x84,0x4c,0x55,0x25,0x25,0x55,0x55,0x4c,0x84,0x80,0x80,0x00
};
//-- 文字:伏
unsigned char code WLib_fu_16x16[]={
0x80,0x40,0x20,0xf8,0x07,0x20,0x20,0x20,0x20,0xff,0x20,0x22,0x2c,0x20,0x20,0x00,
0x00,0x00,0x00,0xff,0x80,0x40,0x20,0x18,0x06,0x01,0x06,0x18,0x60,0xc0,0x40,0x00
};
//-- 符号:
unsigned char code WLib_maohao_8x16[]={
0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,
0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00
};
//-- 符号。
unsigned char code WLib_dian_8x16[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00
};
/***********************************************************************************
* 函数名称:dis_start0;
*
* 函数功能描述:显示开机界面"铭朗科技www.mlarm.com"及电话;
*
* 输入参数:none;
*
* 返回数据:none
*
* 注意: none;
************************************************************************************/
void dis_start0 (void)
{
LCDC_DispWord (0, 32, WLib_ming_32x32, 4, 32, 1);
LCDC_DispWord (32, 32, WLib_lang_32x32, 4, 32, 1);
LCDC_DispWord (64, 32, WLib_ke_32x32, 4, 32, 1);
LCDC_DispWord (96, 32, WLib_ji_32x32, 4, 32, 1);
LCDC_DispWord (8, 16, WLib_W_10x8, 1, 10, 1);
LCDC_DispWord (19, 16, WLib_W_10x8, 1, 10, 1);
LCDC_DispWord (30, 16, WLib_W_10x8, 1, 10, 1);
LCDC_DispWord (46, 16, WLib_M_9x8, 1, 9, 1);
LCDC_DispWord (57, 16, WLib_L_6x8, 1, 6, 1);
LCDC_DispWord (63, 16, WLib_A_7x8, 1, 7, 1);
LCDC_DispWord (71, 16, WLib_R_7x8, 1, 7, 1);
LCDC_DispWord (79, 16, WLib_M_9x8, 1, 9, 1);
LCDC_DispWord (90, 16, WLib_dot_4x8, 1, 4, 1);
LCDC_DispWord (94, 16, WLib_C_7x8, 1, 7, 1);
LCDC_DispWord (102, 16, WLib_O_7x8, 1, 7, 1);
LCDC_DispWord (110, 16, WLib_M_9x8, 1, 9, 1);
LCDC_DispWord (11, 2, WLib_T_6x8, 1, 6, 1);
LCDC_DispWord (17, 2, WLib_e_5x8, 1, 5, 1);
LCDC_DispWord (22, 2, WLib_l_4x8, 1, 4, 1);
LCDC_DispWord (27, 2, WLib_ddot_3x8, 1, 3, 1);
LCDC_DispWord (34, 2, WLib_0_5x8, 1, 5, 1);
LCDC_DispWord (39, 2, WLib_2_5x8, 1, 5, 1);
LCDC_DispWord (44, 2, WLib_9_5x8, 1, 5, 1);
LCDC_DispWord (49, 2, WLib_line_6x8, 1, 6, 1);
LCDC_DispWord (55, 2, WLib_8_5x8, 1, 5, 1);
LCDC_DispWord (60, 2, WLib_8_5x8, 1, 5, 1);
LCDC_DispWord (65, 2, WLib_2_5x8, 1, 5, 1);
LCDC_DispWord (70, 2, WLib_2_5x8, 1, 5, 1);
LCDC_DispWord (75, 2, WLib_3_5x8, 1, 5, 1);
LCDC_DispWord (80, 2, WLib_5_5x8, 1, 5, 1);
LCDC_DispWord (85, 2, WLib_9_5x8, 1, 5, 1);
LCDC_DispWord (90, 2, WLib_7_5x8, 1, 5, 1);
LCDC_DispWord (95, 2, WLib_line_6x8, 1, 6, 1);
LCDC_DispWord (101, 2, WLib_8_5x8, 1, 5, 1);
LCDC_DispWord (106, 2, WLib_0_5x8, 1, 5, 1);
LCDC_DispWord (111, 2, WLib_2_5x8, 1, 5, 1);
}
#endif
/***********************************************************************************
* 函数名称:SYSCLK_Init;
*
* 函数功能描述:系统时钟初始化,使用外部22.1184MHz晶振作为时钟源;
*
* 输入参数:none;
*
* 返回数据:none;
*
* 注意: none;
************************************************************************************/
void SYSCLK_Init (void)
{
int i; // delay counter
char data SFRPAGE_SAVE = SFRPAGE;// Save Current SFR page
SFRPAGE = CONFIG_PAGE; // set SFR page
OSCXCN = 0x67; // start external oscillator with
// 22.1184MHz crystal
for (i=0; i < 256; i++) ; // Wait for osc. to start up
while (!(OSCXCN & 0x80)) ; // Wait for crystal osc. to settle
CLKSEL = 0x01; // Select the external osc. as
// the SYSCLK source
OSCICN = 0x00; // Disable the internal osc.
//Turn on the PLL and increase the system clock by a factor of M/N = 9/2
SFRPAGE = CONFIG_PAGE;
PLL0CN = 0x04; // Set PLL source as external osc.
SFRPAGE = LEGACY_PAGE;
FLSCL = 0x30; // Set FLASH read time for 100MHz clk
// or less
SFRPAGE = CONFIG_PAGE;
PLL0CN |= 0x01; // Enable Power to PLL
PLL0DIV = 0x02; // Set Pre-divide value to N (N = 2)
PLL0FLT = 0x07; // Set the PLL filter register for
// a reference clock from 7.8 - 12.5 MHz
// and an output clock from 65 - 100 MHz
PLL0MUL = 0x02; // Multiply SYSCLK by M (M = 9)
for (i=0; i < 256; i++); // Wait at least 5us
PLL0CN |= 0x02; // Enable the PLL
while(!(PLL0CN & 0x10)); // Wait until PLL frequency is locked
CLKSEL = 0x02; // Select PLL as SYSCLK source
SFRPAGE = SFRPAGE_SAVE; // Restore SFR page
}
/***********************************************************************************
* 函数名称:PORT_Init;
*
* 函数功能描述:配置端口初始化,配置交叉开关和端口;
*
* 输入参数:none;
*
* 返回数据:none;
*
* 注意: none;
************************************************************************************/
void PORT_Init (void)
{
char data SFRPAGE_SAVE = SFRPAGE; // Save Current SFR page
SFRPAGE = SFR_PAGE_F; // set SFR page F
XBR0 = 0X1F; //设置XBR0
XBR1 = 0X1E; //设置XBR1
XBR2 = 0X44; //打开交叉开关和弱上拉
P0MDOUT = 0X3C; //设置P0口输出
P1MDIN = 0X00; //设置P1口输入信号类型
P1MDOUT = 0X00; //设置P1口输出
P1 = 0XFF; //P1口高阻态
P2MDOUT = 0XFC; //设置P2口输出
P3MDOUT = 0XFF; //设置P3口全部推挽输出
P4MDOUT = 0xff; //设置P4口输出
P5MDOUT = 0x0f; //设置P5口输出
P5 = 0xFF;
P6MDOUT = 0xff; //设置P6口输出
P7MDOUT = 0xff; //设置P7口输出
P3 = P3 & 0XEF; //P4口置0,禁铃
SFRPAGE = SFR_PAGE_0; // set SFR page 0
EMI0CF = 0x2f; //外部存储器接口配置
EMI0TC = 0xff; //外部存储器时序控制
SFRPAGE = SFRPAGE_SAVE; // Restore SFR page
}
/****************************************************************************************
文件结束
****************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -