FIX:修改工程
This commit is contained in:
parent
0c7d43690e
commit
4965d3bd8d
40
README.md
40
README.md
@ -1,46 +1,34 @@
|
||||
# [CH552](https://github.com/sochub/CH552)
|
||||
# [CH552](https://github.com/SoCXin/CH552)
|
||||
|
||||
[](https://stop.stops.top)
|
||||
[](http://www.SoC.Xin)
|
||||
|
||||
#### [Vendor](https://github.com/sochub/Vendor):[WCH](https://github.com/sochub/WCH)
|
||||
#### [Core](https://github.com/sochub/8051):[E8051](https://github.com/sochub/8051)
|
||||
#### [Level](https://github.com/sochub/Level):6/24MHz
|
||||
#### [Vendor](https://github.com/SoCXin/Vendor):[WCH](https://github.com/SoCXin/WCH)
|
||||
#### [Core](https://github.com/SoCXin/8051):[E8051](https://github.com/SoCXin/8051)
|
||||
#### [Level](https://github.com/SoCXin/Level):6/24MHz
|
||||
|
||||
## [CH552简介](https://github.com/sochub/CH552/wiki)
|
||||
## [CH552简介](https://github.com/SoCXin/CH552/wiki)
|
||||
|
||||
[CH552](https://github.com/sochub/CH552) 是一款兼容MCS-51指令集的增强型E8051内核单片机,其79%的指令是单字节单周期指令,平均指令速度比标准MCS-51快8~15倍。
|
||||
[CH552](https://github.com/SoCXin/CH552) 是一款兼容MCS-51指令集的增强型E8051内核单片机,其79%的指令是单字节单周期指令,平均指令速度比标准MCS-51快8~15倍。
|
||||
|
||||
支持最高24MHz 系统主频,内置16K 程序存储器ROM 和256 字节内部iRAM 以及1K 字节片内xRAM,xRAM 支持DMA直接内存存取。
|
||||
|
||||
内置了ADC 模数转换、触摸按键电容检测、3 组定时器和信号捕捉及PWM、双异步串口、SPI、USB设备控制器和全速收发器、USB type-C等功能模块。
|
||||
|
||||
[](http://www.wch.cn/products/category/5.html)
|
||||
[](http://www.wch.cn/products/CH552.html)
|
||||
* 芯片封装:TSSOP20、MSOP10、QFN16
|
||||
|
||||
* 芯片封装:TSSOP20、MSOP10、QFN16、SOP16
|
||||
[](http://www.wch.cn/products/category/5.html)
|
||||
[](http://www.wch.cn/products/CH552.html)
|
||||
|
||||
[](http://www.wch.cn/products/CH554.html)
|
||||
[](http://www.wch.cn/products/CH554.html)
|
||||
|
||||
### [资源收录](https://github.com/sochub/CH552)
|
||||
### [资源收录](https://github.com/SoCXin/CH552)
|
||||
|
||||
* [参考文档](docs/)
|
||||
* [参考资源](src/)
|
||||
* [参考工程](project/)
|
||||
* [相关工具](tools/)
|
||||
|
||||
#### [外部资源](https://github.com/sochub)
|
||||
### [选型建议](https://github.com/SoCXin)
|
||||
|
||||
* [OS-Q H05](https://github.com/OS-Q/H05)
|
||||
* [编译器SDCC](https://github.com/sochub/sdcc)
|
||||
|
||||
|
||||
### [选型建议](https://github.com/sochub)
|
||||
|
||||
[CH552](https://github.com/sochub/CH552) 是 8051 USB单片机中的低成本方案,性价比十分高,在需要USB和上位机通信的场合使用非常便利(例如模拟WCH家的CH340串口通信)。
|
||||
|
||||
相同规格略提升替换可选[CH552](https://github.com/sochub/CH552),更高性能的替换可选2倍左右性能和资源增幅的[CH558](https://github.com/sochub/CH558) 或 [CH559](https://github.com/sochub/CH559),后者可以提供如LQFP48等封装规格。
|
||||
|
||||
更多功能接口或无线集成可选[CH56系列](https://github.com/sochub/CH56)或[CH57系列](https://github.com/sochub/CH57)替换,同厂方案。
|
||||
[CH552](https://github.com/SoCXin/CH552) 是 8051 USB单片机中的低成本方案,性价比高,相同规格略提升替换可选[CH554](https://github.com/SoCXin/CH554),降低规格可选[CH551](https://github.com/SoCXin/CH551),更高性能的替换可选2倍左右性能和资源增幅的[CH558](https://github.com/SoCXin/CH558) 或 [CH559](https://github.com/SoCXin/CH559)。
|
||||
|
||||
|
||||
## [SoC资源平台](http://www.qitas.cn)
|
||||
|
10
src/keil/HID/.gitignore → project/HID/.gitignore
vendored
10
src/keil/HID/.gitignore → project/HID/.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
obj/
|
||||
list/
|
||||
*.uvgui.*
|
||||
*.uvgui_*
|
||||
*.uvopt
|
||||
obj/
|
||||
list/
|
||||
*.uvgui.*
|
||||
*.uvgui_*
|
||||
*.uvopt
|
File diff suppressed because it is too large
Load Diff
@ -1,271 +1,271 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : DEBUG.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 DEBUG Interface
|
||||
CH554主频修改、延时函数定义
|
||||
串口0和串口1初始化
|
||||
串口0和串口1的收发子函数
|
||||
看门狗初始化
|
||||
*******************************************************************************/
|
||||
|
||||
#include "CH554.H"
|
||||
#include "DEBUG.H"
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CfgFsys( )
|
||||
* Description : CH554时钟选择和配置函数,默认使用Fsys 6MHz,FREQ_SYS可以通过
|
||||
CLOCK_CFG配置得到,公式如下:
|
||||
Fsys = (Fosc * 4/(CLOCK_CFG & MASK_SYS_CK_SEL);具体时钟需要自己配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CfgFsys( )
|
||||
{
|
||||
// SAFE_MOD = 0x55;
|
||||
// SAFE_MOD = 0xAA;
|
||||
// CLOCK_CFG |= bOSC_EN_XT; //使能外部晶振
|
||||
// CLOCK_CFG &= ~bOSC_EN_INT; //关闭内部晶振
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x07; // 32MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x05; // 16MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x04; // 12MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x03; // 6MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x02; // 3MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x01; // 750KHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x00; // 187.5MHz
|
||||
SAFE_MOD = 0x00;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayus(UNIT16 n)
|
||||
* Description : us延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mDelayuS( UINT16 n ) // 以uS为单位延时
|
||||
{
|
||||
#ifdef FREQ_SYS
|
||||
#if FREQ_SYS <= 6000000
|
||||
n >>= 2;
|
||||
#endif
|
||||
#if FREQ_SYS <= 3000000
|
||||
n >>= 2;
|
||||
#endif
|
||||
#if FREQ_SYS <= 750000
|
||||
n >>= 4;
|
||||
#endif
|
||||
#endif
|
||||
while ( n ) { // total = 12~13 Fsys cycles, 1uS @Fsys=12MHz
|
||||
++ SAFE_MOD; // 2 Fsys cycles, for higher Fsys, add operation here
|
||||
#ifdef FREQ_SYS
|
||||
#if FREQ_SYS >= 14000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 16000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 18000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 20000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 22000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 24000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 26000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 28000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 30000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 32000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#endif
|
||||
-- n;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayms(UNIT16 n)
|
||||
* Description : ms延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mDelaymS( UINT16 n ) // 以mS为单位延时
|
||||
{
|
||||
while ( n ) {
|
||||
#ifdef DELAY_MS_HW
|
||||
while ( ( TKEY_CTRL & bTKC_IF ) == 0 );
|
||||
while ( TKEY_CTRL & bTKC_IF );
|
||||
#else
|
||||
mDelayuS( 1000 );
|
||||
#endif
|
||||
-- n;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0Alter()
|
||||
* Description : CH554串口0引脚映射,串口映射到P0.2和P0.3
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0Alter()
|
||||
{
|
||||
PIN_FUNC |= bUART0_PIN_X; //串口映射到P1.2和P1.3
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mInitSTDIO()
|
||||
* Description : CH554串口0初始化,默认使用T1作UART0的波特率发生器,也可以使用T2
|
||||
作为波特率发生器
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mInitSTDIO( )
|
||||
{
|
||||
UINT32 x;
|
||||
UINT8 x2;
|
||||
|
||||
SM0 = 0;
|
||||
SM1 = 1;
|
||||
SM2 = 0; //串口0使用模式1
|
||||
//使用Timer1作为波特率发生器
|
||||
RCLK = 0; //UART0接收时钟
|
||||
TCLK = 0; //UART0发送时钟
|
||||
PCON |= SMOD;
|
||||
x = 10 * FREQ_SYS / UART0_BUAD / 16; //如果更改主频,注意x的值不要溢出
|
||||
x2 = x % 10;
|
||||
x /= 10;
|
||||
if ( x2 >= 5 ) x ++; //四舍五入
|
||||
|
||||
TMOD = TMOD & ~ bT1_GATE & ~ bT1_CT & ~ MASK_T1_MOD | bT1_M1; //0X20,Timer1作为8位自动重载定时器
|
||||
T2MOD = T2MOD | bTMR_CLK | bT1_CLK; //Timer1时钟选择
|
||||
TH1 = 0-x; //12MHz晶振,buad/12为实际需设置波特率
|
||||
TR1 = 1; //启动定时器1
|
||||
TI = 1;
|
||||
REN = 1; //串口0接收使能
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0RcvByte()
|
||||
* Description : CH554UART0接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART0RcvByte( )
|
||||
{
|
||||
while(RI == 0); //查询接收,中断方式可不用
|
||||
RI = 0;
|
||||
return SBUF;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART0发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(TI ==0);
|
||||
TI = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : UART1Setup()
|
||||
* Description : CH554串口1初始化
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void UART1Setup( )
|
||||
{
|
||||
U1SM0 = 0; //UART1选择8位数据位
|
||||
U1SMOD = 1; //快速模式
|
||||
U1REN = 1; //使能接收
|
||||
SBAUD1 = 0 - FREQ_SYS/16/UART1_BUAD;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1RcvByte()
|
||||
* Description : CH554UART1接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART1RcvByte( )
|
||||
{
|
||||
while(U1RI == 0); //查询接收,中断方式可不用
|
||||
U1RI = 0;
|
||||
return SBUF1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART1发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART1SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF1 = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(U1TI ==0);
|
||||
U1TI = 1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTModeSelect(UINT8 mode)
|
||||
* Description : CH554看门狗模式选择
|
||||
* Input : UINT8 mode
|
||||
0 timer
|
||||
1 watchDog
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554WDTModeSelect(UINT8 mode)
|
||||
{
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xaa; //进入安全模式
|
||||
if(mode){
|
||||
GLOBAL_CFG |= bWDOG_EN; //启动看门狗复位
|
||||
}
|
||||
else GLOBAL_CFG &= ~bWDOG_EN; //启动看门狗仅仅作为定时器
|
||||
SAFE_MOD = 0x00; //退出安全模式
|
||||
WDOG_COUNT = 0; //看门狗赋初值
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTFeed(UINT8 tim)
|
||||
* Description : CH554看门狗定时时间设置
|
||||
* Input : UINT8 tim 看门狗复位时间设置
|
||||
00H(6MHz)=2.8s
|
||||
80H(6MHz)=1.4s
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554WDTFeed(UINT8 tim)
|
||||
{
|
||||
WDOG_COUNT = tim; //看门狗计数器赋值
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : DEBUG.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 DEBUG Interface
|
||||
CH554主频修改、延时函数定义
|
||||
串口0和串口1初始化
|
||||
串口0和串口1的收发子函数
|
||||
看门狗初始化
|
||||
*******************************************************************************/
|
||||
|
||||
#include "CH554.H"
|
||||
#include "DEBUG.H"
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CfgFsys( )
|
||||
* Description : CH554时钟选择和配置函数,默认使用Fsys 6MHz,FREQ_SYS可以通过
|
||||
CLOCK_CFG配置得到,公式如下:
|
||||
Fsys = (Fosc * 4/(CLOCK_CFG & MASK_SYS_CK_SEL);具体时钟需要自己配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CfgFsys( )
|
||||
{
|
||||
// SAFE_MOD = 0x55;
|
||||
// SAFE_MOD = 0xAA;
|
||||
// CLOCK_CFG |= bOSC_EN_XT; //使能外部晶振
|
||||
// CLOCK_CFG &= ~bOSC_EN_INT; //关闭内部晶振
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x07; // 32MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x05; // 16MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x04; // 12MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x03; // 6MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x02; // 3MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x01; // 750KHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x00; // 187.5MHz
|
||||
SAFE_MOD = 0x00;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayus(UNIT16 n)
|
||||
* Description : us延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mDelayuS( UINT16 n ) // 以uS为单位延时
|
||||
{
|
||||
#ifdef FREQ_SYS
|
||||
#if FREQ_SYS <= 6000000
|
||||
n >>= 2;
|
||||
#endif
|
||||
#if FREQ_SYS <= 3000000
|
||||
n >>= 2;
|
||||
#endif
|
||||
#if FREQ_SYS <= 750000
|
||||
n >>= 4;
|
||||
#endif
|
||||
#endif
|
||||
while ( n ) { // total = 12~13 Fsys cycles, 1uS @Fsys=12MHz
|
||||
++ SAFE_MOD; // 2 Fsys cycles, for higher Fsys, add operation here
|
||||
#ifdef FREQ_SYS
|
||||
#if FREQ_SYS >= 14000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 16000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 18000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 20000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 22000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 24000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 26000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 28000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 30000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#if FREQ_SYS >= 32000000
|
||||
++ SAFE_MOD;
|
||||
#endif
|
||||
#endif
|
||||
-- n;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayms(UNIT16 n)
|
||||
* Description : ms延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mDelaymS( UINT16 n ) // 以mS为单位延时
|
||||
{
|
||||
while ( n ) {
|
||||
#ifdef DELAY_MS_HW
|
||||
while ( ( TKEY_CTRL & bTKC_IF ) == 0 );
|
||||
while ( TKEY_CTRL & bTKC_IF );
|
||||
#else
|
||||
mDelayuS( 1000 );
|
||||
#endif
|
||||
-- n;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0Alter()
|
||||
* Description : CH554串口0引脚映射,串口映射到P0.2和P0.3
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0Alter()
|
||||
{
|
||||
PIN_FUNC |= bUART0_PIN_X; //串口映射到P1.2和P1.3
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mInitSTDIO()
|
||||
* Description : CH554串口0初始化,默认使用T1作UART0的波特率发生器,也可以使用T2
|
||||
作为波特率发生器
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mInitSTDIO( )
|
||||
{
|
||||
UINT32 x;
|
||||
UINT8 x2;
|
||||
|
||||
SM0 = 0;
|
||||
SM1 = 1;
|
||||
SM2 = 0; //串口0使用模式1
|
||||
//使用Timer1作为波特率发生器
|
||||
RCLK = 0; //UART0接收时钟
|
||||
TCLK = 0; //UART0发送时钟
|
||||
PCON |= SMOD;
|
||||
x = 10 * FREQ_SYS / UART0_BUAD / 16; //如果更改主频,注意x的值不要溢出
|
||||
x2 = x % 10;
|
||||
x /= 10;
|
||||
if ( x2 >= 5 ) x ++; //四舍五入
|
||||
|
||||
TMOD = TMOD & ~ bT1_GATE & ~ bT1_CT & ~ MASK_T1_MOD | bT1_M1; //0X20,Timer1作为8位自动重载定时器
|
||||
T2MOD = T2MOD | bTMR_CLK | bT1_CLK; //Timer1时钟选择
|
||||
TH1 = 0-x; //12MHz晶振,buad/12为实际需设置波特率
|
||||
TR1 = 1; //启动定时器1
|
||||
TI = 1;
|
||||
REN = 1; //串口0接收使能
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0RcvByte()
|
||||
* Description : CH554UART0接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART0RcvByte( )
|
||||
{
|
||||
while(RI == 0); //查询接收,中断方式可不用
|
||||
RI = 0;
|
||||
return SBUF;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART0发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(TI ==0);
|
||||
TI = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : UART1Setup()
|
||||
* Description : CH554串口1初始化
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void UART1Setup( )
|
||||
{
|
||||
U1SM0 = 0; //UART1选择8位数据位
|
||||
U1SMOD = 1; //快速模式
|
||||
U1REN = 1; //使能接收
|
||||
SBAUD1 = 0 - FREQ_SYS/16/UART1_BUAD;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1RcvByte()
|
||||
* Description : CH554UART1接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART1RcvByte( )
|
||||
{
|
||||
while(U1RI == 0); //查询接收,中断方式可不用
|
||||
U1RI = 0;
|
||||
return SBUF1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART1发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART1SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF1 = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(U1TI ==0);
|
||||
U1TI = 1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTModeSelect(UINT8 mode)
|
||||
* Description : CH554看门狗模式选择
|
||||
* Input : UINT8 mode
|
||||
0 timer
|
||||
1 watchDog
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554WDTModeSelect(UINT8 mode)
|
||||
{
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xaa; //进入安全模式
|
||||
if(mode){
|
||||
GLOBAL_CFG |= bWDOG_EN; //启动看门狗复位
|
||||
}
|
||||
else GLOBAL_CFG &= ~bWDOG_EN; //启动看门狗仅仅作为定时器
|
||||
SAFE_MOD = 0x00; //退出安全模式
|
||||
WDOG_COUNT = 0; //看门狗赋初值
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTFeed(UINT8 tim)
|
||||
* Description : CH554看门狗定时时间设置
|
||||
* Input : UINT8 tim 看门狗复位时间设置
|
||||
00H(6MHz)=2.8s
|
||||
80H(6MHz)=1.4s
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554WDTFeed(UINT8 tim)
|
||||
{
|
||||
WDOG_COUNT = tim; //看门狗计数器赋值
|
||||
}
|
@ -1,46 +1,46 @@
|
||||
/* 调试 */
|
||||
/* 提供printf子程序和延时函数 */
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
//定义函数返回值
|
||||
#ifndef SUCCESS
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
#ifndef FAIL
|
||||
#define FAIL 0xFF
|
||||
#endif
|
||||
|
||||
//定义定时器起始
|
||||
#ifndef START
|
||||
#define START 1
|
||||
#endif
|
||||
#ifndef STOP
|
||||
#define STOP 0
|
||||
#endif
|
||||
|
||||
#ifndef DE_PRINTF
|
||||
#define DE_PRINTF 0
|
||||
#endif
|
||||
#define FREQ_SYS 12000000 //系统主频12MHz
|
||||
#ifndef UART0_BUAD
|
||||
#define UART0_BUAD 57600
|
||||
#define UART1_BUAD 57600
|
||||
#endif
|
||||
|
||||
void CfgFsys( ); //CH554时钟选择和配置
|
||||
void mDelayuS( UINT16 n ); // 以uS为单位延时
|
||||
void mDelaymS( UINT16 n ); // 以mS为单位延时
|
||||
void CH554UART0Alter(); //CH554串口0引脚映射到P0.2/P0.3
|
||||
void mInitSTDIO( ); //T1作为波特率发生器
|
||||
UINT8 CH554UART0RcvByte( ); //CH554 UART0查询方式接收一个字节
|
||||
void CH554UART0SendByte(UINT8 SendDat); //CH554UART0发送一个字节
|
||||
|
||||
void UART1Setup( ); //
|
||||
UINT8 CH554UART1RcvByte( ); //CH554 UART1查询方式接收一个字节
|
||||
void CH554UART1SendByte(UINT8 SendDat); //CH554UART1发送一个字节
|
||||
|
||||
void CH554WDTModeSelect(UINT8 mode); //CH554看门狗模式设置
|
||||
void CH554WDTFeed(UINT8 tim); //CH554看门狗喂狗
|
||||
#endif
|
||||
/* 调试 */
|
||||
/* 提供printf子程序和延时函数 */
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
//定义函数返回值
|
||||
#ifndef SUCCESS
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
#ifndef FAIL
|
||||
#define FAIL 0xFF
|
||||
#endif
|
||||
|
||||
//定义定时器起始
|
||||
#ifndef START
|
||||
#define START 1
|
||||
#endif
|
||||
#ifndef STOP
|
||||
#define STOP 0
|
||||
#endif
|
||||
|
||||
#ifndef DE_PRINTF
|
||||
#define DE_PRINTF 0
|
||||
#endif
|
||||
#define FREQ_SYS 12000000 //系统主频12MHz
|
||||
#ifndef UART0_BUAD
|
||||
#define UART0_BUAD 57600
|
||||
#define UART1_BUAD 57600
|
||||
#endif
|
||||
|
||||
void CfgFsys( ); //CH554时钟选择和配置
|
||||
void mDelayuS( UINT16 n ); // 以uS为单位延时
|
||||
void mDelaymS( UINT16 n ); // 以mS为单位延时
|
||||
void CH554UART0Alter(); //CH554串口0引脚映射到P0.2/P0.3
|
||||
void mInitSTDIO( ); //T1作为波特率发生器
|
||||
UINT8 CH554UART0RcvByte( ); //CH554 UART0查询方式接收一个字节
|
||||
void CH554UART0SendByte(UINT8 SendDat); //CH554UART0发送一个字节
|
||||
|
||||
void UART1Setup( ); //
|
||||
UINT8 CH554UART1RcvByte( ); //CH554 UART1查询方式接收一个字节
|
||||
void CH554UART1SendByte(UINT8 SendDat); //CH554UART1发送一个字节
|
||||
|
||||
void CH554WDTModeSelect(UINT8 mode); //CH554看门狗模式设置
|
||||
void CH554WDTFeed(UINT8 tim); //CH554看门狗喂狗
|
||||
#endif
|
@ -1,80 +1,80 @@
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : Touch_Key.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 触摸按键采样间隔设置、通道选择和切换和中断处理函数
|
||||
*******************************************************************************/
|
||||
|
||||
#include "CH554.H"
|
||||
#include "DEBUG.H"
|
||||
#include "Key.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchKeyQueryCylSet1Or2ms(UINT8 cyl)
|
||||
* Description : 触摸按键查询周期设置
|
||||
* Input : UINT8 cyl 时钟设置
|
||||
1 2ms
|
||||
0 1ms
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void TouchKeyQueryCylSet1Or2ms(UINT8 cyl)
|
||||
{
|
||||
if(cyl)
|
||||
{
|
||||
TKEY_CTRL |= bTKC_2MS;
|
||||
}
|
||||
else
|
||||
{
|
||||
TKEY_CTRL &= ~bTKC_2MS;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchKeyChanelSelect(UINT8 ch)
|
||||
* Description : 触摸按键通道选择
|
||||
* Input : UINT8 ch 采用通道
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 TouchKeyChanelSelect(UINT8 ch)
|
||||
{
|
||||
TKEY_CTRL &= 0xF8;
|
||||
if(ch == 0){;} //关闭电容检测,仅作1ms或者2ms定时中断
|
||||
else if(ch == 1){P1_DIR_PU &= 0xFE; TKEY_CTRL |= 0x01;} //TIN0(P10)
|
||||
else if(ch == 2){P1_DIR_PU &= 0xFD; TKEY_CTRL |= 0x02;} //TIN0(P11)
|
||||
else if(ch == 3){P1_DIR_PU &= 0xEF; TKEY_CTRL |= 0x03;} //TIN0(P14)
|
||||
else if(ch == 4){P1_DIR_PU &= 0xDF; TKEY_CTRL |= 0x04;} //TIN0(P15)
|
||||
else if(ch == 5){P1_DIR_PU &= 0xBF; TKEY_CTRL |= 0x05;} //TIN0(P16)
|
||||
else if(ch == 6){P1_DIR_PU &= 0x7F; TKEY_CTRL |= 0x06;} //TIN0(P17)
|
||||
else if(ch == 7){TKEY_CTRL |= 0x07;} //开启电容检测,但是不连接通道
|
||||
else return FAIL;
|
||||
|
||||
#if INTERRUPT_TouchKey
|
||||
IE_TKEY = 1; //使能Touch_Key中断
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#if INTERRUPT_TouchKey
|
||||
/*******************************************************************************
|
||||
* Function Name : Touch_KeyInterrupt(void)
|
||||
* Description : Touch_Key 中断服务程序
|
||||
*******************************************************************************/
|
||||
void Touch_KeyInterrupt( void ) interrupt INT_NO_TKEY using 1 //Touch_Key中断服务程序,使用寄存器组1
|
||||
{
|
||||
UINT16 KeyData;
|
||||
IE_TKEY = 0; //关中断
|
||||
KeyData = TKEY_DAT; //保持87us,尽快取走
|
||||
#ifdef DE_PRINTF
|
||||
printf("DATA: %04x\n",KeyData&0x7FFF);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : Touch_Key.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 触摸按键采样间隔设置、通道选择和切换和中断处理函数
|
||||
*******************************************************************************/
|
||||
|
||||
#include "CH554.H"
|
||||
#include "DEBUG.H"
|
||||
#include "Key.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchKeyQueryCylSet1Or2ms(UINT8 cyl)
|
||||
* Description : 触摸按键查询周期设置
|
||||
* Input : UINT8 cyl 时钟设置
|
||||
1 2ms
|
||||
0 1ms
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void TouchKeyQueryCylSet1Or2ms(UINT8 cyl)
|
||||
{
|
||||
if(cyl)
|
||||
{
|
||||
TKEY_CTRL |= bTKC_2MS;
|
||||
}
|
||||
else
|
||||
{
|
||||
TKEY_CTRL &= ~bTKC_2MS;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchKeyChanelSelect(UINT8 ch)
|
||||
* Description : 触摸按键通道选择
|
||||
* Input : UINT8 ch 采用通道
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 TouchKeyChanelSelect(UINT8 ch)
|
||||
{
|
||||
TKEY_CTRL &= 0xF8;
|
||||
if(ch == 0){;} //关闭电容检测,仅作1ms或者2ms定时中断
|
||||
else if(ch == 1){P1_DIR_PU &= 0xFE; TKEY_CTRL |= 0x01;} //TIN0(P10)
|
||||
else if(ch == 2){P1_DIR_PU &= 0xFD; TKEY_CTRL |= 0x02;} //TIN0(P11)
|
||||
else if(ch == 3){P1_DIR_PU &= 0xEF; TKEY_CTRL |= 0x03;} //TIN0(P14)
|
||||
else if(ch == 4){P1_DIR_PU &= 0xDF; TKEY_CTRL |= 0x04;} //TIN0(P15)
|
||||
else if(ch == 5){P1_DIR_PU &= 0xBF; TKEY_CTRL |= 0x05;} //TIN0(P16)
|
||||
else if(ch == 6){P1_DIR_PU &= 0x7F; TKEY_CTRL |= 0x06;} //TIN0(P17)
|
||||
else if(ch == 7){TKEY_CTRL |= 0x07;} //开启电容检测,但是不连接通道
|
||||
else return FAIL;
|
||||
|
||||
#if INTERRUPT_TouchKey
|
||||
IE_TKEY = 1; //使能Touch_Key中断
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#if INTERRUPT_TouchKey
|
||||
/*******************************************************************************
|
||||
* Function Name : Touch_KeyInterrupt(void)
|
||||
* Description : Touch_Key 中断服务程序
|
||||
*******************************************************************************/
|
||||
void Touch_KeyInterrupt( void ) interrupt INT_NO_TKEY using 1 //Touch_Key中断服务程序,使用寄存器组1
|
||||
{
|
||||
UINT16 KeyData;
|
||||
IE_TKEY = 0; //关中断
|
||||
KeyData = TKEY_DAT; //保持87us,尽快取走
|
||||
#ifdef DE_PRINTF
|
||||
printf("DATA: %04x\n",KeyData&0x7FFF);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -1,39 +1,39 @@
|
||||
|
||||
#define INTERRUPT_TouchKey 0 //开启Key中断方式
|
||||
|
||||
|
||||
#define L_WIN 0X08
|
||||
#define L_ALT 0X04
|
||||
#define L_SHIFT 0X02
|
||||
#define L_CTL 0X01
|
||||
#define R_WIN 0X80
|
||||
#define R_ALT 0X40
|
||||
#define R_SHIFT 0X20
|
||||
#define R_CTL 0X10
|
||||
#define SPACE 0X2C
|
||||
#define ENTER 0X28
|
||||
|
||||
#define MOUSE 0
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchKeyQueryCylSet(UINT8 cyl)
|
||||
* Description : 触摸按键查询周期设置
|
||||
* Input : UINT8 cyl 时钟设置
|
||||
1 2ms
|
||||
0 1ms
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void TouchKeyQueryCylSet1Or2ms(UINT8 cyl);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchKeyChanelSelect(UINT8 ch)
|
||||
* Description : 触摸按键通道选择
|
||||
* Input : UINT8 ch 采用通道
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 TouchKeyChanelSelect(UINT8 ch);
|
||||
|
||||
|
||||
#define INTERRUPT_TouchKey 0 //开启Key中断方式
|
||||
|
||||
|
||||
#define L_WIN 0X08
|
||||
#define L_ALT 0X04
|
||||
#define L_SHIFT 0X02
|
||||
#define L_CTL 0X01
|
||||
#define R_WIN 0X80
|
||||
#define R_ALT 0X40
|
||||
#define R_SHIFT 0X20
|
||||
#define R_CTL 0X10
|
||||
#define SPACE 0X2C
|
||||
#define ENTER 0X28
|
||||
|
||||
#define MOUSE 0
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchKeyQueryCylSet(UINT8 cyl)
|
||||
* Description : 触摸按键查询周期设置
|
||||
* Input : UINT8 cyl 时钟设置
|
||||
1 2ms
|
||||
0 1ms
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void TouchKeyQueryCylSet1Or2ms(UINT8 cyl);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TouchKeyChanelSelect(UINT8 ch)
|
||||
* Description : 触摸按键通道选择
|
||||
* Input : UINT8 ch 采用通道
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 TouchKeyChanelSelect(UINT8 ch);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,25 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name :Compound_Dev.C *
|
||||
* Author : WCH *
|
||||
* Version : V1.2 *
|
||||
* Date : 2017/02/24 *
|
||||
* Description : A demo for USB compound device created by CH554, support *
|
||||
keyboard , and HID-compliant device. *
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef __COMPOUND_H__
|
||||
#define __COMPOUND_H__
|
||||
|
||||
extern UINT16I TouchKeyButton;
|
||||
|
||||
extern UINT8 TX[64];
|
||||
extern UINT8 RX[64];
|
||||
extern UINT8 TXflag;
|
||||
extern UINT8 RXflag;
|
||||
|
||||
extern void USBDeviceInit();
|
||||
extern void TXflagHandle(UINT8 val);
|
||||
|
||||
#endif
|
||||
/**************************** END *************************************/
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name :Compound_Dev.C *
|
||||
* Author : WCH *
|
||||
* Version : V1.2 *
|
||||
* Date : 2017/02/24 *
|
||||
* Description : A demo for USB compound device created by CH554, support *
|
||||
keyboard , and HID-compliant device. *
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef __COMPOUND_H__
|
||||
#define __COMPOUND_H__
|
||||
|
||||
extern UINT16I TouchKeyButton;
|
||||
|
||||
extern UINT8 TX[64];
|
||||
extern UINT8 RX[64];
|
||||
extern UINT8 TXflag;
|
||||
extern UINT8 RXflag;
|
||||
|
||||
extern void USBDeviceInit();
|
||||
extern void TXflagHandle(UINT8 val);
|
||||
|
||||
#endif
|
||||
/**************************** END *************************************/
|
@ -1,66 +1,66 @@
|
||||
/********************************** (C) COPYRIGHT ******************************
|
||||
* File Name : main.c
|
||||
* Author : QITAS
|
||||
* Version : V1.0
|
||||
* Date : 2018/06/05
|
||||
* Description : A demo for HID compatible device.
|
||||
********************************************************************************/
|
||||
#include "CH554.H"
|
||||
#include "USB.h"
|
||||
#include "debug.h"
|
||||
#include "Key.h"
|
||||
#include "stdio.h"
|
||||
|
||||
extern UINT8 FLAG; // Trans complete flag
|
||||
extern UINT8 EnumOK; // Enum ok flag
|
||||
extern UINT8 TX[64];
|
||||
extern UINT8 RX[64];
|
||||
UINT16I TouchKeyButton = 0;
|
||||
//UINT8X TSTDATA[64] _at_ 0x00E0;
|
||||
|
||||
void CfgCLK(void)
|
||||
{
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
SAFE_MOD = 0x00;
|
||||
}
|
||||
|
||||
void main( void )
|
||||
{
|
||||
UINT8 i;
|
||||
CfgCLK(); //Configure sys
|
||||
mDelaymS(10);
|
||||
mInitSTDIO( ); // Init UART0
|
||||
|
||||
USBDeviceInit(); // Configure the USB module,the Endpoint and the USB Interrupt
|
||||
EA = 1;
|
||||
UEP1_T_LEN = 0; // Reset the trans length register
|
||||
UEP2_T_LEN = 0;
|
||||
FLAG = 0;
|
||||
EnumOK = 0;
|
||||
TouchKeyQueryCylSet1Or2ms(1); //set query cycle
|
||||
TouchKeyChanelSelect(3); //set query chanel
|
||||
for( i = 1; i < 64 ;i ++ )
|
||||
{
|
||||
TX[i]=i+1;
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
if( EnumOK == 1 )
|
||||
{
|
||||
TXflagHandle(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(TKEY_CTRL&bTKC_IF) //wait query finsh,max 2ms 获取键值基准值,多采样几次
|
||||
{
|
||||
TouchKeyButton = TKEY_DAT;
|
||||
}
|
||||
}
|
||||
if(RXflag);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************** END *************************************/
|
||||
/********************************** (C) COPYRIGHT ******************************
|
||||
* File Name : main.c
|
||||
* Author : QITAS
|
||||
* Version : V1.0
|
||||
* Date : 2018/06/05
|
||||
* Description : A demo for HID compatible device.
|
||||
********************************************************************************/
|
||||
#include "CH554.H"
|
||||
#include "USB.h"
|
||||
#include "debug.h"
|
||||
#include "Key.h"
|
||||
#include "stdio.h"
|
||||
|
||||
extern UINT8 FLAG; // Trans complete flag
|
||||
extern UINT8 EnumOK; // Enum ok flag
|
||||
extern UINT8 TX[64];
|
||||
extern UINT8 RX[64];
|
||||
UINT16I TouchKeyButton = 0;
|
||||
//UINT8X TSTDATA[64] _at_ 0x00E0;
|
||||
|
||||
void CfgCLK(void)
|
||||
{
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
SAFE_MOD = 0x00;
|
||||
}
|
||||
|
||||
void main( void )
|
||||
{
|
||||
UINT8 i;
|
||||
CfgCLK(); //Configure sys
|
||||
mDelaymS(10);
|
||||
mInitSTDIO( ); // Init UART0
|
||||
|
||||
USBDeviceInit(); // Configure the USB module,the Endpoint and the USB Interrupt
|
||||
EA = 1;
|
||||
UEP1_T_LEN = 0; // Reset the trans length register
|
||||
UEP2_T_LEN = 0;
|
||||
FLAG = 0;
|
||||
EnumOK = 0;
|
||||
TouchKeyQueryCylSet1Or2ms(1); //set query cycle
|
||||
TouchKeyChanelSelect(3); //set query chanel
|
||||
for( i = 1; i < 64 ;i ++ )
|
||||
{
|
||||
TX[i]=i+1;
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
if( EnumOK == 1 )
|
||||
{
|
||||
TXflagHandle(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(TKEY_CTRL&bTKC_IF) //wait query finsh,max 2ms 获取键值基准值,多采样几次
|
||||
{
|
||||
TouchKeyButton = TKEY_DAT;
|
||||
}
|
||||
}
|
||||
if(RXflag);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************** END *************************************/
|
10
src/keil/LCD/.gitignore → project/LCD/.gitignore
vendored
10
src/keil/LCD/.gitignore → project/LCD/.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
obj/
|
||||
list/
|
||||
*.uvgui.*
|
||||
*.uvgui_*
|
||||
*.uvopt
|
||||
obj/
|
||||
list/
|
||||
*.uvgui.*
|
||||
*.uvgui_*
|
||||
*.uvopt
|
@ -1,5 +1,5 @@
|
||||
del *.uvopt /s
|
||||
del *.uvgui.* /s
|
||||
rd obj /s /q
|
||||
rd list /s /q
|
||||
exit
|
||||
del *.uvopt /s
|
||||
del *.uvgui.* /s
|
||||
rd obj /s /q
|
||||
rd list /s /q
|
||||
exit
|
File diff suppressed because it is too large
Load Diff
@ -1,188 +1,188 @@
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : GPIO.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 IO 设置接口函数和GPIO中断函数
|
||||
*******************************************************************************/
|
||||
|
||||
#include "CH554.H"
|
||||
#include "common.h"
|
||||
#include "GPIO.h"
|
||||
#include "stdio.h"
|
||||
#include "USB.h"
|
||||
|
||||
extern UINT8 Value_CH552[14];
|
||||
UINT8 Power_y=0;
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Port1Cfg()
|
||||
* Description : 端口1配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port1Cfg(UINT8 Mode,UINT8 Pin)
|
||||
{
|
||||
switch(Mode){
|
||||
case 0:
|
||||
P1_MOD_OC = P1_MOD_OC & ~(1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 1:
|
||||
P1_MOD_OC = P1_MOD_OC & ~(1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
case 2:
|
||||
P1_MOD_OC = P1_MOD_OC | (1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 3:
|
||||
P1_MOD_OC = P1_MOD_OC | (1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Port3Cfg()
|
||||
* Description : 端口3配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port3Cfg(UINT8 Mode,UINT8 Pin)
|
||||
{
|
||||
switch(Mode){
|
||||
case 0:
|
||||
P3_MOD_OC = P3_MOD_OC & ~(1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 1:
|
||||
P3_MOD_OC = P3_MOD_OC & ~(1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
case 2:
|
||||
P3_MOD_OC = P3_MOD_OC | (1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 3:
|
||||
P3_MOD_OC = P3_MOD_OC | (1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterruptCfg()
|
||||
* Description : GPIO中断配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void GPIOInterruptCfg()
|
||||
{
|
||||
GPIO_IE &= ~bIE_IO_EDGE; //高/低电平触发 低电平为有效电平
|
||||
// GPIO_IE |= bIE_IO_EDGE; //上升/下降触发 下降沿触发
|
||||
//GPIO_IE |= bIE_RXD1_LO; //RXD1低电平或下降沿触发 串口1接收中断使能
|
||||
GPIO_IE |= bIE_P1_5_LO | bIE_P1_4_LO | bIE_P1_3_LO | bIE_RST_HI;
|
||||
//P15\P14\P13低电平触发;RST高电平触发 上升沿触发
|
||||
//GPIO_IE |= bIE_P3_1_LO; //P31低电平或下降沿触发
|
||||
//GPIO_IE |= bIE_RXD0_LO; //RXD0低电平或下降沿触发 串口2接收中断使能
|
||||
IE_GPIO = 1; //GPIO中断开启 扩展中断使能
|
||||
}
|
||||
|
||||
|
||||
#ifdef GPIO_INTERRUPT
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterrupt(void)
|
||||
* Description : GPIO 中断服务程序
|
||||
*******************************************************************************/
|
||||
void GPIOInterrupt( void ) interrupt INT_NO_GPIO using 1 //GPIO中断服务程序,使用寄存器组1
|
||||
{
|
||||
//#ifdef DE_PRINTF
|
||||
// printf("GPIO_STATUS: %02x\n",(UINT16)(PIN_FUNC&bIO_INT_ACT));
|
||||
//#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TheKeyQuery()
|
||||
* Description : 按键查询
|
||||
* like-20180605
|
||||
*******************************************************************************/
|
||||
void TheKeyQuery()
|
||||
{
|
||||
if(KEY0==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY0==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_0);
|
||||
}
|
||||
}
|
||||
if(KEY1==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY1==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_1);
|
||||
}
|
||||
}
|
||||
if(KEY2==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY2==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_2);
|
||||
}
|
||||
}
|
||||
if(KEY3==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY3==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_3);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Function Name : TheKeyQuery()
|
||||
* Description : 电源查询
|
||||
* like-20180605
|
||||
*******************************************************************************/
|
||||
void PowerSupplyQuery()
|
||||
{
|
||||
if(Power==0&&Power_y==1)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(PowerOFF);
|
||||
Power_y = 0;
|
||||
}
|
||||
else if(Power==1&&Power_y==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(PowerON);
|
||||
Power_y = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : GPIO.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 IO 设置接口函数和GPIO中断函数
|
||||
*******************************************************************************/
|
||||
|
||||
#include "CH554.H"
|
||||
#include "common.h"
|
||||
#include "GPIO.h"
|
||||
#include "stdio.h"
|
||||
#include "USB.h"
|
||||
|
||||
extern UINT8 Value_CH552[14];
|
||||
UINT8 Power_y=0;
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Port1Cfg()
|
||||
* Description : 端口1配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port1Cfg(UINT8 Mode,UINT8 Pin)
|
||||
{
|
||||
switch(Mode){
|
||||
case 0:
|
||||
P1_MOD_OC = P1_MOD_OC & ~(1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 1:
|
||||
P1_MOD_OC = P1_MOD_OC & ~(1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
case 2:
|
||||
P1_MOD_OC = P1_MOD_OC | (1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 3:
|
||||
P1_MOD_OC = P1_MOD_OC | (1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Port3Cfg()
|
||||
* Description : 端口3配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port3Cfg(UINT8 Mode,UINT8 Pin)
|
||||
{
|
||||
switch(Mode){
|
||||
case 0:
|
||||
P3_MOD_OC = P3_MOD_OC & ~(1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 1:
|
||||
P3_MOD_OC = P3_MOD_OC & ~(1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
case 2:
|
||||
P3_MOD_OC = P3_MOD_OC | (1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 3:
|
||||
P3_MOD_OC = P3_MOD_OC | (1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterruptCfg()
|
||||
* Description : GPIO中断配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void GPIOInterruptCfg()
|
||||
{
|
||||
GPIO_IE &= ~bIE_IO_EDGE; //高/低电平触发 低电平为有效电平
|
||||
// GPIO_IE |= bIE_IO_EDGE; //上升/下降触发 下降沿触发
|
||||
//GPIO_IE |= bIE_RXD1_LO; //RXD1低电平或下降沿触发 串口1接收中断使能
|
||||
GPIO_IE |= bIE_P1_5_LO | bIE_P1_4_LO | bIE_P1_3_LO | bIE_RST_HI;
|
||||
//P15\P14\P13低电平触发;RST高电平触发 上升沿触发
|
||||
//GPIO_IE |= bIE_P3_1_LO; //P31低电平或下降沿触发
|
||||
//GPIO_IE |= bIE_RXD0_LO; //RXD0低电平或下降沿触发 串口2接收中断使能
|
||||
IE_GPIO = 1; //GPIO中断开启 扩展中断使能
|
||||
}
|
||||
|
||||
|
||||
#ifdef GPIO_INTERRUPT
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterrupt(void)
|
||||
* Description : GPIO 中断服务程序
|
||||
*******************************************************************************/
|
||||
void GPIOInterrupt( void ) interrupt INT_NO_GPIO using 1 //GPIO中断服务程序,使用寄存器组1
|
||||
{
|
||||
//#ifdef DE_PRINTF
|
||||
// printf("GPIO_STATUS: %02x\n",(UINT16)(PIN_FUNC&bIO_INT_ACT));
|
||||
//#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TheKeyQuery()
|
||||
* Description : 按键查询
|
||||
* like-20180605
|
||||
*******************************************************************************/
|
||||
void TheKeyQuery()
|
||||
{
|
||||
if(KEY0==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY0==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_0);
|
||||
}
|
||||
}
|
||||
if(KEY1==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY1==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_1);
|
||||
}
|
||||
}
|
||||
if(KEY2==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY2==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_2);
|
||||
}
|
||||
}
|
||||
if(KEY3==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY3==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_3);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Function Name : TheKeyQuery()
|
||||
* Description : 电源查询
|
||||
* like-20180605
|
||||
*******************************************************************************/
|
||||
void PowerSupplyQuery()
|
||||
{
|
||||
if(Power==0&&Power_y==1)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(PowerOFF);
|
||||
Power_y = 0;
|
||||
}
|
||||
else if(Power==1&&Power_y==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(PowerON);
|
||||
Power_y = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,32 @@
|
||||
|
||||
#define GPIO_INTERRUPT 1
|
||||
sbit Power=P1^7;
|
||||
sbit KEY0=P1^1;
|
||||
sbit KEY1=P1^4;
|
||||
sbit KEY2=P1^5;
|
||||
sbit KEY3=P1^6;
|
||||
/*******************************************************************************
|
||||
* Function Name : Port1Cfg()
|
||||
* Description : 端口1配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port1Cfg(UINT8 Mode,UINT8 Pin);
|
||||
void Port3Cfg(UINT8 Mode,UINT8 Pin);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterruptCfg()
|
||||
* Description : GPIO中断配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void GPIOInterruptCfg();
|
||||
void custom_GPIO_Interrupt(void);
|
||||
void TheKeyQuery();
|
||||
void PowerSupplyQuery();
|
||||
|
||||
#define GPIO_INTERRUPT 1
|
||||
sbit Power=P1^7;
|
||||
sbit KEY0=P1^1;
|
||||
sbit KEY1=P1^4;
|
||||
sbit KEY2=P1^5;
|
||||
sbit KEY3=P1^6;
|
||||
/*******************************************************************************
|
||||
* Function Name : Port1Cfg()
|
||||
* Description : 端口1配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port1Cfg(UINT8 Mode,UINT8 Pin);
|
||||
void Port3Cfg(UINT8 Mode,UINT8 Pin);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterruptCfg()
|
||||
* Description : GPIO中断配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void GPIOInterruptCfg();
|
||||
void custom_GPIO_Interrupt(void);
|
||||
void TheKeyQuery();
|
||||
void PowerSupplyQuery();
|
@ -1,489 +1,489 @@
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
|
||||
//#include "font.h"
|
||||
//#include "sys.h"
|
||||
#include "lcd.h"
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
******************************************************/
|
||||
|
||||
u16 BACK_COLOR, POINT_COLOR; //背景色,画笔色
|
||||
|
||||
unsigned char bdata bitdata;
|
||||
sbit bit7=bitdata^7;
|
||||
sbit bit6=bitdata^6;
|
||||
sbit bit5=bitdata^5;
|
||||
sbit bit4=bitdata^4;
|
||||
sbit bit3=bitdata^3;
|
||||
sbit bit2=bitdata^2;
|
||||
sbit bit1=bitdata^1;
|
||||
sbit bit0=bitdata^0;
|
||||
|
||||
|
||||
void LCD_Writ_Bus(char da) //串行数据写入
|
||||
{
|
||||
bitdata=da;
|
||||
LCD_SDI=bit7;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit6;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit5;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit4;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit3;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit2;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit1;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit0;LCD_SCK=0;LCD_SCK=1;
|
||||
}
|
||||
|
||||
void LCD_WR_DATA8(char da) //发送数据-8位参数
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_DATA(int da)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_Writ_Bus(da>>8);
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_REG(char da)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=0;
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_REG_DATA(int reg,int da)
|
||||
{
|
||||
LCD_WR_REG(reg);
|
||||
LCD_WR_DATA(da);
|
||||
|
||||
}
|
||||
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)
|
||||
{
|
||||
LCD_WR_REG(0x2a);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(x1+2);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(x2+2);
|
||||
|
||||
LCD_WR_REG(0x2b);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(y1+1);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(y2+1);
|
||||
|
||||
LCD_WR_REG(0x2C);
|
||||
}
|
||||
|
||||
|
||||
void Lcd_Init(void)
|
||||
{//LCD_BLK=1;
|
||||
|
||||
//调用一次这些函数,免得编译的时候提示警告
|
||||
|
||||
|
||||
// LCD_WR_REG_DATA(0,0);
|
||||
// LCD_ShowString(0,0," ");
|
||||
// LCD_ShowNum(0,0,0,0);
|
||||
// LCD_Show2Num(0,0,0,0);
|
||||
// LCD_DrawPoint_big(0,0);
|
||||
// LCD_DrawRectangle(0,0,0,0);
|
||||
// Draw_Circle(0,0,0);
|
||||
|
||||
LCD_REST=0;
|
||||
delayms(20);
|
||||
LCD_REST=1;
|
||||
delayms(20);
|
||||
LCD_WR_REG(0x11);//Sleep exit
|
||||
delayms (120);
|
||||
|
||||
//ST7735R Frame Rate
|
||||
LCD_WR_REG(0xB1);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB2);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB3);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB4); //Column inveLCD_DC ion
|
||||
LCD_WR_DATA8(0x07);
|
||||
|
||||
//ST7735R Power Sequence
|
||||
LCD_WR_REG(0xC0);
|
||||
LCD_WR_DATA8(0xA2);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(0x84);
|
||||
LCD_WR_REG(0xC1);
|
||||
LCD_WR_DATA8(0xC5);
|
||||
|
||||
LCD_WR_REG(0xC2);
|
||||
LCD_WR_DATA8(0x0A);
|
||||
LCD_WR_DATA8(0x00);
|
||||
|
||||
LCD_WR_REG(0xC3);
|
||||
LCD_WR_DATA8(0x8A);
|
||||
LCD_WR_DATA8(0x2A);
|
||||
LCD_WR_REG(0xC4);
|
||||
LCD_WR_DATA8(0x8A);
|
||||
LCD_WR_DATA8(0xEE);
|
||||
|
||||
LCD_WR_REG(0xC5); //VCOM
|
||||
LCD_WR_DATA8(0x0E);
|
||||
|
||||
LCD_WR_REG(0x36); //MX, MY, RGB mode
|
||||
LCD_WR_DATA8(0xC0);
|
||||
#ifdef USE_LANDSCAPE
|
||||
LCD_WR_DATA8(0xA8); //竖屏C8 横屏08 A8
|
||||
#else
|
||||
LCD_WR_DATA8(0xC8); //竖屏C8 横屏08 A8
|
||||
#endif
|
||||
//ST7735R Gamma Sequence
|
||||
LCD_WR_REG(0xe0);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x1a);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x18);
|
||||
LCD_WR_DATA8(0x2f);
|
||||
LCD_WR_DATA8(0x28);
|
||||
LCD_WR_DATA8(0x20);
|
||||
LCD_WR_DATA8(0x22);
|
||||
LCD_WR_DATA8(0x1f);
|
||||
LCD_WR_DATA8(0x1b);
|
||||
LCD_WR_DATA8(0x23);
|
||||
LCD_WR_DATA8(0x37);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x07);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(0x10);
|
||||
|
||||
LCD_WR_REG(0xe1);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x1b);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x17);
|
||||
LCD_WR_DATA8(0x33);
|
||||
LCD_WR_DATA8(0x2c);
|
||||
LCD_WR_DATA8(0x29);
|
||||
LCD_WR_DATA8(0x2e);
|
||||
LCD_WR_DATA8(0x30);
|
||||
LCD_WR_DATA8(0x30);
|
||||
LCD_WR_DATA8(0x39);
|
||||
LCD_WR_DATA8(0x3f);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x07);
|
||||
LCD_WR_DATA8(0x03);
|
||||
LCD_WR_DATA8(0x10);
|
||||
|
||||
LCD_WR_REG(0x2a);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x00+2);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x80+2);
|
||||
|
||||
LCD_WR_REG(0x2b);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x00+3);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x80+3);
|
||||
|
||||
LCD_WR_REG(0xF0); //Enable test command
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_REG(0xF6); //Disable ram power save mode
|
||||
LCD_WR_DATA8(0x00);
|
||||
|
||||
LCD_WR_REG(0x3A); //65k mode
|
||||
LCD_WR_DATA8(0x05);
|
||||
|
||||
|
||||
LCD_WR_REG(0x29);//Display on
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
|
||||
//清屏函数
|
||||
//Color:要清屏的填充色
|
||||
void LCD_Clear(u16 Color)
|
||||
{
|
||||
u16 i,j;
|
||||
Address_set(0,0,LCD_W-1,LCD_H-1);
|
||||
for(i=0;i<LCD_W;i++)
|
||||
{
|
||||
for (j=0;j<LCD_H;j++)
|
||||
{
|
||||
LCD_WR_DATA(Color);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//在指定位置显示一个汉字(32*33大小)
|
||||
//dcolor为内容颜色,gbcolor为背静颜色
|
||||
void showhanzi(unsigned int x,unsigned int y,unsigned char index)
|
||||
{
|
||||
unsigned char i,j;
|
||||
//unsigned char *temp=hanzi;
|
||||
unsigned char *temp=0;
|
||||
Address_set(x,y,x+31,y+31); //设置区域
|
||||
temp+=index*128;
|
||||
for(j=0;j<128;j++)
|
||||
{
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
if((*temp&(1<<i))!=0)
|
||||
{
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
LCD_WR_DATA(BACK_COLOR);
|
||||
}
|
||||
}
|
||||
temp++;
|
||||
}
|
||||
}
|
||||
//画点
|
||||
//POINT_COLOR:此点的颜色
|
||||
void LCD_DrawPoint(u16 x,u16 y)
|
||||
{
|
||||
Address_set(x,y,x,y);//设置光标位置
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
}
|
||||
//画一个大点
|
||||
//POINT_COLOR:此点的颜色
|
||||
void LCD_DrawPoint_big(u16 x,u16 y)
|
||||
{
|
||||
LCD_Fill(x-1,y-1,x+1,y+1,POINT_COLOR);
|
||||
}
|
||||
//在指定区域内填充指定颜色
|
||||
//区域大小:
|
||||
// (xend-xsta)*(yend-ysta)
|
||||
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color)
|
||||
{
|
||||
u16 i,j;
|
||||
Address_set(xsta,ysta,xend,yend); //设置光标位置
|
||||
for(i=ysta;i<=yend;i++)
|
||||
{
|
||||
for(j=xsta;j<=xend;j++)LCD_WR_DATA(color);//设置光标位置
|
||||
}
|
||||
}
|
||||
//画线
|
||||
//x1,y1:起点坐标
|
||||
//x2,y2:终点坐标
|
||||
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2)
|
||||
{
|
||||
u16 t;
|
||||
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
||||
int incx,incy,uRow,uCol;
|
||||
|
||||
delta_x=x2-x1; //计算坐标增量
|
||||
delta_y=y2-y1;
|
||||
uRow=x1;
|
||||
uCol=y1;
|
||||
if(delta_x>0)incx=1; //设置单步方向
|
||||
else if(delta_x==0)incx=0;//垂直线
|
||||
else {incx=-1;delta_x=-delta_x;}
|
||||
if(delta_y>0)incy=1;
|
||||
else if(delta_y==0)incy=0;//水平线
|
||||
else{incy=-1;delta_y=-delta_y;}
|
||||
if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
|
||||
else distance=delta_y;
|
||||
for(t=0;t<=distance+1;t++ )//画线输出
|
||||
{
|
||||
LCD_DrawPoint(uRow,uCol);//画点
|
||||
xerr+=delta_x ;
|
||||
yerr+=delta_y ;
|
||||
if(xerr>distance)
|
||||
{
|
||||
xerr-=distance;
|
||||
uRow+=incx;
|
||||
}
|
||||
if(yerr>distance)
|
||||
{
|
||||
yerr-=distance;
|
||||
uCol+=incy;
|
||||
}
|
||||
}
|
||||
}
|
||||
//画矩形
|
||||
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2)
|
||||
{
|
||||
LCD_DrawLine(x1,y1,x2,y1);
|
||||
LCD_DrawLine(x1,y1,x1,y2);
|
||||
LCD_DrawLine(x1,y2,x2,y2);
|
||||
LCD_DrawLine(x2,y1,x2,y2);
|
||||
}
|
||||
//在指定位置画一个指定大小的圆
|
||||
//(x,y):中心点
|
||||
//r :半径
|
||||
void Draw_Circle(u16 x0,u16 y0,u8 r)
|
||||
{
|
||||
int a,b;
|
||||
int di;
|
||||
a=0;b=r;
|
||||
di=3-(r<<1); //判断下个点位置的标志
|
||||
while(a<=b)
|
||||
{
|
||||
LCD_DrawPoint(x0-b,y0-a); //3
|
||||
LCD_DrawPoint(x0+b,y0-a); //0
|
||||
LCD_DrawPoint(x0-a,y0+b); //1
|
||||
LCD_DrawPoint(x0-b,y0-a); //7
|
||||
LCD_DrawPoint(x0-a,y0-b); //2
|
||||
LCD_DrawPoint(x0+b,y0+a); //4
|
||||
LCD_DrawPoint(x0+a,y0-b); //5
|
||||
LCD_DrawPoint(x0+a,y0+b); //6
|
||||
LCD_DrawPoint(x0-b,y0+a);
|
||||
a++;
|
||||
//使用Bresenham算法画圆
|
||||
if(di<0)di +=4*a+6;
|
||||
else
|
||||
{
|
||||
di+=10+4*(a-b);
|
||||
b--;
|
||||
}
|
||||
LCD_DrawPoint(x0+a,y0+b);
|
||||
}
|
||||
}
|
||||
//在指定位置显示一个字符
|
||||
|
||||
//num:要显示的字符:" "--->"~"
|
||||
//mode:叠加方式(1)还是非叠加方式(0)
|
||||
//在指定位置显示一个字符
|
||||
|
||||
//num:要显示的字符:" "--->"~"
|
||||
|
||||
//mode:叠加方式(1)还是非叠加方式(0)
|
||||
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 mode)
|
||||
{
|
||||
u8 temp;
|
||||
u8 pos,t;
|
||||
u16 x0=x;
|
||||
u16 colortemp=POINT_COLOR;
|
||||
if(x>LCD_W-16||y>LCD_H-16)return;
|
||||
//设置窗口
|
||||
num=num-' ';//得到偏移后的值
|
||||
Address_set(x,y,x+8-1,y+16-1); //设置光标位置
|
||||
if(!mode) //非叠加方式
|
||||
{
|
||||
for(pos=0;pos<16;pos++)
|
||||
{
|
||||
//temp=asc2_1608[(u16)num*16+pos]; //调用1608字体
|
||||
for(t=0;t<8;t++)
|
||||
{
|
||||
if(temp&0x01)POINT_COLOR=colortemp;
|
||||
else POINT_COLOR=BACK_COLOR;
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
temp>>=1;
|
||||
x++;
|
||||
}
|
||||
x=x0;
|
||||
y++;
|
||||
}
|
||||
}else//叠加方式
|
||||
{
|
||||
for(pos=0;pos<16;pos++)
|
||||
{
|
||||
//temp=asc2_1608[(u16)num*16+pos]; //调用1608字体
|
||||
for(t=0;t<8;t++)
|
||||
{
|
||||
if(temp&0x01)LCD_DrawPoint(x+t,y+pos);//画一个点
|
||||
temp>>=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
POINT_COLOR=colortemp;
|
||||
}
|
||||
//m^n函数
|
||||
u32 mypow(u8 m,u8 n)
|
||||
{
|
||||
u32 result=1;
|
||||
while(n--)result*=m;
|
||||
return result;
|
||||
}
|
||||
//显示2个数字
|
||||
//x,y :起点坐标
|
||||
//len :数字的位数
|
||||
//color:颜色
|
||||
//num:数值(0~4294967295);
|
||||
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len)
|
||||
{
|
||||
u8 t,temp;
|
||||
u8 enshow=0;
|
||||
num=(u16)num;
|
||||
for(t=0;t<len;t++)
|
||||
{
|
||||
temp=(num/mypow(10,len-t-1))%10;
|
||||
if(enshow==0&&t<(len-1))
|
||||
{
|
||||
if(temp==0)
|
||||
{
|
||||
LCD_ShowChar(x+8*t,y,' ',0);
|
||||
continue;
|
||||
}else enshow=1;
|
||||
|
||||
}
|
||||
LCD_ShowChar(x+8*t,y,temp+48,0);
|
||||
}
|
||||
}
|
||||
//显示2个数字
|
||||
//x,y:起点坐标
|
||||
//num:数值(0~99);
|
||||
void LCD_Show2Num(u16 x,u16 y,u16 num,u8 len)
|
||||
{
|
||||
u8 t,temp;
|
||||
for(t=0;t<len;t++)
|
||||
{
|
||||
temp=(num/mypow(10,len-t-1))%10;
|
||||
LCD_ShowChar(x+8*t,y,temp+'0',0);
|
||||
}
|
||||
}
|
||||
//显示字符串
|
||||
//x,y:起点坐标
|
||||
//*p:字符串起始地址
|
||||
//用16字体
|
||||
void LCD_ShowString(u16 x,u16 y,const u8 *p)
|
||||
{
|
||||
while(*p!='\0')
|
||||
{
|
||||
if(x>LCD_W-16){x=0;y+=16;}
|
||||
if(y>LCD_H-16){y=x=0;LCD_Clear(RED);}
|
||||
LCD_ShowChar(x,y,*p,0);
|
||||
x+=8;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
|
||||
//#include "font.h"
|
||||
//#include "sys.h"
|
||||
#include "lcd.h"
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
******************************************************/
|
||||
|
||||
u16 BACK_COLOR, POINT_COLOR; //背景色,画笔色
|
||||
|
||||
unsigned char bdata bitdata;
|
||||
sbit bit7=bitdata^7;
|
||||
sbit bit6=bitdata^6;
|
||||
sbit bit5=bitdata^5;
|
||||
sbit bit4=bitdata^4;
|
||||
sbit bit3=bitdata^3;
|
||||
sbit bit2=bitdata^2;
|
||||
sbit bit1=bitdata^1;
|
||||
sbit bit0=bitdata^0;
|
||||
|
||||
|
||||
void LCD_Writ_Bus(char da) //串行数据写入
|
||||
{
|
||||
bitdata=da;
|
||||
LCD_SDI=bit7;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit6;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit5;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit4;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit3;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit2;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit1;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit0;LCD_SCK=0;LCD_SCK=1;
|
||||
}
|
||||
|
||||
void LCD_WR_DATA8(char da) //发送数据-8位参数
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_DATA(int da)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_Writ_Bus(da>>8);
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_REG(char da)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=0;
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_REG_DATA(int reg,int da)
|
||||
{
|
||||
LCD_WR_REG(reg);
|
||||
LCD_WR_DATA(da);
|
||||
|
||||
}
|
||||
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)
|
||||
{
|
||||
LCD_WR_REG(0x2a);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(x1+2);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(x2+2);
|
||||
|
||||
LCD_WR_REG(0x2b);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(y1+1);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(y2+1);
|
||||
|
||||
LCD_WR_REG(0x2C);
|
||||
}
|
||||
|
||||
|
||||
void Lcd_Init(void)
|
||||
{//LCD_BLK=1;
|
||||
|
||||
//调用一次这些函数,免得编译的时候提示警告
|
||||
|
||||
|
||||
// LCD_WR_REG_DATA(0,0);
|
||||
// LCD_ShowString(0,0," ");
|
||||
// LCD_ShowNum(0,0,0,0);
|
||||
// LCD_Show2Num(0,0,0,0);
|
||||
// LCD_DrawPoint_big(0,0);
|
||||
// LCD_DrawRectangle(0,0,0,0);
|
||||
// Draw_Circle(0,0,0);
|
||||
|
||||
LCD_REST=0;
|
||||
delayms(20);
|
||||
LCD_REST=1;
|
||||
delayms(20);
|
||||
LCD_WR_REG(0x11);//Sleep exit
|
||||
delayms (120);
|
||||
|
||||
//ST7735R Frame Rate
|
||||
LCD_WR_REG(0xB1);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB2);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB3);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB4); //Column inveLCD_DC ion
|
||||
LCD_WR_DATA8(0x07);
|
||||
|
||||
//ST7735R Power Sequence
|
||||
LCD_WR_REG(0xC0);
|
||||
LCD_WR_DATA8(0xA2);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(0x84);
|
||||
LCD_WR_REG(0xC1);
|
||||
LCD_WR_DATA8(0xC5);
|
||||
|
||||
LCD_WR_REG(0xC2);
|
||||
LCD_WR_DATA8(0x0A);
|
||||
LCD_WR_DATA8(0x00);
|
||||
|
||||
LCD_WR_REG(0xC3);
|
||||
LCD_WR_DATA8(0x8A);
|
||||
LCD_WR_DATA8(0x2A);
|
||||
LCD_WR_REG(0xC4);
|
||||
LCD_WR_DATA8(0x8A);
|
||||
LCD_WR_DATA8(0xEE);
|
||||
|
||||
LCD_WR_REG(0xC5); //VCOM
|
||||
LCD_WR_DATA8(0x0E);
|
||||
|
||||
LCD_WR_REG(0x36); //MX, MY, RGB mode
|
||||
LCD_WR_DATA8(0xC0);
|
||||
#ifdef USE_LANDSCAPE
|
||||
LCD_WR_DATA8(0xA8); //竖屏C8 横屏08 A8
|
||||
#else
|
||||
LCD_WR_DATA8(0xC8); //竖屏C8 横屏08 A8
|
||||
#endif
|
||||
//ST7735R Gamma Sequence
|
||||
LCD_WR_REG(0xe0);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x1a);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x18);
|
||||
LCD_WR_DATA8(0x2f);
|
||||
LCD_WR_DATA8(0x28);
|
||||
LCD_WR_DATA8(0x20);
|
||||
LCD_WR_DATA8(0x22);
|
||||
LCD_WR_DATA8(0x1f);
|
||||
LCD_WR_DATA8(0x1b);
|
||||
LCD_WR_DATA8(0x23);
|
||||
LCD_WR_DATA8(0x37);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x07);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(0x10);
|
||||
|
||||
LCD_WR_REG(0xe1);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x1b);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x17);
|
||||
LCD_WR_DATA8(0x33);
|
||||
LCD_WR_DATA8(0x2c);
|
||||
LCD_WR_DATA8(0x29);
|
||||
LCD_WR_DATA8(0x2e);
|
||||
LCD_WR_DATA8(0x30);
|
||||
LCD_WR_DATA8(0x30);
|
||||
LCD_WR_DATA8(0x39);
|
||||
LCD_WR_DATA8(0x3f);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x07);
|
||||
LCD_WR_DATA8(0x03);
|
||||
LCD_WR_DATA8(0x10);
|
||||
|
||||
LCD_WR_REG(0x2a);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x00+2);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x80+2);
|
||||
|
||||
LCD_WR_REG(0x2b);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x00+3);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x80+3);
|
||||
|
||||
LCD_WR_REG(0xF0); //Enable test command
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_REG(0xF6); //Disable ram power save mode
|
||||
LCD_WR_DATA8(0x00);
|
||||
|
||||
LCD_WR_REG(0x3A); //65k mode
|
||||
LCD_WR_DATA8(0x05);
|
||||
|
||||
|
||||
LCD_WR_REG(0x29);//Display on
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
|
||||
//清屏函数
|
||||
//Color:要清屏的填充色
|
||||
void LCD_Clear(u16 Color)
|
||||
{
|
||||
u16 i,j;
|
||||
Address_set(0,0,LCD_W-1,LCD_H-1);
|
||||
for(i=0;i<LCD_W;i++)
|
||||
{
|
||||
for (j=0;j<LCD_H;j++)
|
||||
{
|
||||
LCD_WR_DATA(Color);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//在指定位置显示一个汉字(32*33大小)
|
||||
//dcolor为内容颜色,gbcolor为背静颜色
|
||||
void showhanzi(unsigned int x,unsigned int y,unsigned char index)
|
||||
{
|
||||
unsigned char i,j;
|
||||
//unsigned char *temp=hanzi;
|
||||
unsigned char *temp=0;
|
||||
Address_set(x,y,x+31,y+31); //设置区域
|
||||
temp+=index*128;
|
||||
for(j=0;j<128;j++)
|
||||
{
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
if((*temp&(1<<i))!=0)
|
||||
{
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
LCD_WR_DATA(BACK_COLOR);
|
||||
}
|
||||
}
|
||||
temp++;
|
||||
}
|
||||
}
|
||||
//画点
|
||||
//POINT_COLOR:此点的颜色
|
||||
void LCD_DrawPoint(u16 x,u16 y)
|
||||
{
|
||||
Address_set(x,y,x,y);//设置光标位置
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
}
|
||||
//画一个大点
|
||||
//POINT_COLOR:此点的颜色
|
||||
void LCD_DrawPoint_big(u16 x,u16 y)
|
||||
{
|
||||
LCD_Fill(x-1,y-1,x+1,y+1,POINT_COLOR);
|
||||
}
|
||||
//在指定区域内填充指定颜色
|
||||
//区域大小:
|
||||
// (xend-xsta)*(yend-ysta)
|
||||
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color)
|
||||
{
|
||||
u16 i,j;
|
||||
Address_set(xsta,ysta,xend,yend); //设置光标位置
|
||||
for(i=ysta;i<=yend;i++)
|
||||
{
|
||||
for(j=xsta;j<=xend;j++)LCD_WR_DATA(color);//设置光标位置
|
||||
}
|
||||
}
|
||||
//画线
|
||||
//x1,y1:起点坐标
|
||||
//x2,y2:终点坐标
|
||||
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2)
|
||||
{
|
||||
u16 t;
|
||||
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
||||
int incx,incy,uRow,uCol;
|
||||
|
||||
delta_x=x2-x1; //计算坐标增量
|
||||
delta_y=y2-y1;
|
||||
uRow=x1;
|
||||
uCol=y1;
|
||||
if(delta_x>0)incx=1; //设置单步方向
|
||||
else if(delta_x==0)incx=0;//垂直线
|
||||
else {incx=-1;delta_x=-delta_x;}
|
||||
if(delta_y>0)incy=1;
|
||||
else if(delta_y==0)incy=0;//水平线
|
||||
else{incy=-1;delta_y=-delta_y;}
|
||||
if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
|
||||
else distance=delta_y;
|
||||
for(t=0;t<=distance+1;t++ )//画线输出
|
||||
{
|
||||
LCD_DrawPoint(uRow,uCol);//画点
|
||||
xerr+=delta_x ;
|
||||
yerr+=delta_y ;
|
||||
if(xerr>distance)
|
||||
{
|
||||
xerr-=distance;
|
||||
uRow+=incx;
|
||||
}
|
||||
if(yerr>distance)
|
||||
{
|
||||
yerr-=distance;
|
||||
uCol+=incy;
|
||||
}
|
||||
}
|
||||
}
|
||||
//画矩形
|
||||
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2)
|
||||
{
|
||||
LCD_DrawLine(x1,y1,x2,y1);
|
||||
LCD_DrawLine(x1,y1,x1,y2);
|
||||
LCD_DrawLine(x1,y2,x2,y2);
|
||||
LCD_DrawLine(x2,y1,x2,y2);
|
||||
}
|
||||
//在指定位置画一个指定大小的圆
|
||||
//(x,y):中心点
|
||||
//r :半径
|
||||
void Draw_Circle(u16 x0,u16 y0,u8 r)
|
||||
{
|
||||
int a,b;
|
||||
int di;
|
||||
a=0;b=r;
|
||||
di=3-(r<<1); //判断下个点位置的标志
|
||||
while(a<=b)
|
||||
{
|
||||
LCD_DrawPoint(x0-b,y0-a); //3
|
||||
LCD_DrawPoint(x0+b,y0-a); //0
|
||||
LCD_DrawPoint(x0-a,y0+b); //1
|
||||
LCD_DrawPoint(x0-b,y0-a); //7
|
||||
LCD_DrawPoint(x0-a,y0-b); //2
|
||||
LCD_DrawPoint(x0+b,y0+a); //4
|
||||
LCD_DrawPoint(x0+a,y0-b); //5
|
||||
LCD_DrawPoint(x0+a,y0+b); //6
|
||||
LCD_DrawPoint(x0-b,y0+a);
|
||||
a++;
|
||||
//使用Bresenham算法画圆
|
||||
if(di<0)di +=4*a+6;
|
||||
else
|
||||
{
|
||||
di+=10+4*(a-b);
|
||||
b--;
|
||||
}
|
||||
LCD_DrawPoint(x0+a,y0+b);
|
||||
}
|
||||
}
|
||||
//在指定位置显示一个字符
|
||||
|
||||
//num:要显示的字符:" "--->"~"
|
||||
//mode:叠加方式(1)还是非叠加方式(0)
|
||||
//在指定位置显示一个字符
|
||||
|
||||
//num:要显示的字符:" "--->"~"
|
||||
|
||||
//mode:叠加方式(1)还是非叠加方式(0)
|
||||
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 mode)
|
||||
{
|
||||
u8 temp;
|
||||
u8 pos,t;
|
||||
u16 x0=x;
|
||||
u16 colortemp=POINT_COLOR;
|
||||
if(x>LCD_W-16||y>LCD_H-16)return;
|
||||
//设置窗口
|
||||
num=num-' ';//得到偏移后的值
|
||||
Address_set(x,y,x+8-1,y+16-1); //设置光标位置
|
||||
if(!mode) //非叠加方式
|
||||
{
|
||||
for(pos=0;pos<16;pos++)
|
||||
{
|
||||
//temp=asc2_1608[(u16)num*16+pos]; //调用1608字体
|
||||
for(t=0;t<8;t++)
|
||||
{
|
||||
if(temp&0x01)POINT_COLOR=colortemp;
|
||||
else POINT_COLOR=BACK_COLOR;
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
temp>>=1;
|
||||
x++;
|
||||
}
|
||||
x=x0;
|
||||
y++;
|
||||
}
|
||||
}else//叠加方式
|
||||
{
|
||||
for(pos=0;pos<16;pos++)
|
||||
{
|
||||
//temp=asc2_1608[(u16)num*16+pos]; //调用1608字体
|
||||
for(t=0;t<8;t++)
|
||||
{
|
||||
if(temp&0x01)LCD_DrawPoint(x+t,y+pos);//画一个点
|
||||
temp>>=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
POINT_COLOR=colortemp;
|
||||
}
|
||||
//m^n函数
|
||||
u32 mypow(u8 m,u8 n)
|
||||
{
|
||||
u32 result=1;
|
||||
while(n--)result*=m;
|
||||
return result;
|
||||
}
|
||||
//显示2个数字
|
||||
//x,y :起点坐标
|
||||
//len :数字的位数
|
||||
//color:颜色
|
||||
//num:数值(0~4294967295);
|
||||
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len)
|
||||
{
|
||||
u8 t,temp;
|
||||
u8 enshow=0;
|
||||
num=(u16)num;
|
||||
for(t=0;t<len;t++)
|
||||
{
|
||||
temp=(num/mypow(10,len-t-1))%10;
|
||||
if(enshow==0&&t<(len-1))
|
||||
{
|
||||
if(temp==0)
|
||||
{
|
||||
LCD_ShowChar(x+8*t,y,' ',0);
|
||||
continue;
|
||||
}else enshow=1;
|
||||
|
||||
}
|
||||
LCD_ShowChar(x+8*t,y,temp+48,0);
|
||||
}
|
||||
}
|
||||
//显示2个数字
|
||||
//x,y:起点坐标
|
||||
//num:数值(0~99);
|
||||
void LCD_Show2Num(u16 x,u16 y,u16 num,u8 len)
|
||||
{
|
||||
u8 t,temp;
|
||||
for(t=0;t<len;t++)
|
||||
{
|
||||
temp=(num/mypow(10,len-t-1))%10;
|
||||
LCD_ShowChar(x+8*t,y,temp+'0',0);
|
||||
}
|
||||
}
|
||||
//显示字符串
|
||||
//x,y:起点坐标
|
||||
//*p:字符串起始地址
|
||||
//用16字体
|
||||
void LCD_ShowString(u16 x,u16 y,const u8 *p)
|
||||
{
|
||||
while(*p!='\0')
|
||||
{
|
||||
if(x>LCD_W-16){x=0;y+=16;}
|
||||
if(y>LCD_H-16){y=x=0;LCD_Clear(RED);}
|
||||
LCD_ShowChar(x,y,*p,0);
|
||||
x+=8;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,112 +1,112 @@
|
||||
#ifndef __LCD_H
|
||||
#define __LCD_H
|
||||
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
//#include "sys.h"
|
||||
|
||||
#define u8 unsigned char
|
||||
#define u16 unsigned int
|
||||
#define u32 unsigned long
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
|
||||
******************************************************/
|
||||
|
||||
//定义LCD的尺寸
|
||||
#define LCD_W 128
|
||||
#define LCD_H 160
|
||||
|
||||
sbit LCD_CS1 =P1^4; //片选
|
||||
sbit LCD_DC =P1^3; //数据/命令切换
|
||||
sbit LCD_SDI =P1^1; //数据
|
||||
sbit LCD_SCK =P1^0; //时钟
|
||||
//sbit LCD_REST =P0^2; //复位
|
||||
sbit LCD_REST =P1^5; //复位
|
||||
|
||||
sbit ZK_MISO =P1^7; //时钟
|
||||
sbit ZK_CS2 =P1^6; //复位
|
||||
|
||||
extern u16 BACK_COLOR, POINT_COLOR; //背景色,画笔色
|
||||
|
||||
void Lcd_Init(void);
|
||||
void LCD_Clear(u16 Color);
|
||||
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2);
|
||||
void LCD_WR_DATA8(char da); //发送数据-8位参数
|
||||
void LCD_WR_DATA(int da);
|
||||
void LCD_WR_REG(char da);
|
||||
|
||||
void LCD_DrawPoint(u16 x,u16 y);//画点
|
||||
void LCD_DrawPoint_big(u16 x,u16 y);//画一个大点
|
||||
u16 LCD_ReadPoint(u16 x,u16 y); //读点
|
||||
void Draw_Circle(u16 x0,u16 y0,u8 r);
|
||||
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2);
|
||||
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2);
|
||||
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color);
|
||||
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 mode);//显示一个字符
|
||||
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len);//显示数字
|
||||
void LCD_Show2Num(u16 x,u16 y,u16 num,u8 len);//显示2个数字
|
||||
void LCD_ShowString(u16 x,u16 y,const u8 *p); //显示一个字符串,16字体
|
||||
|
||||
void showhanzi(unsigned int x,unsigned int y,unsigned char index);
|
||||
|
||||
void CL_Mem(void);
|
||||
void GBZK_ROMOUTSET(void); //字库输出设置
|
||||
void GBZK_ROMOUTRESET(void); //字库输出设置
|
||||
void GBZK_GPIO_Config(void); //字库芯片初始化
|
||||
void ZK_command( unsigned char dat );
|
||||
unsigned char get_data_from_ROM(void);
|
||||
void get_n_bytes_data_from_ROM(unsigned char AddrHigh,unsigned char AddrMid,unsigned char AddrLow,unsigned char *pBuff,unsigned char DataLen );
|
||||
void Display_Asc_String(unsigned char zk_num,unsigned int x, unsigned int y, unsigned char text[]);
|
||||
void Display_Asc( unsigned char zk_num,unsigned int x, unsigned int y );
|
||||
void zk_map( unsigned char *getdate, unsigned char *putdata, unsigned char high, unsigned char width);
|
||||
void Display_GB2312_String(unsigned char zk_num,unsigned int x,unsigned int y, unsigned char text[]);
|
||||
void Display_GB2312( unsigned char zk_num,unsigned int x, unsigned int y );
|
||||
|
||||
|
||||
//画笔颜色
|
||||
#define WHITE 0xFFFF
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define BRED 0XF81F
|
||||
#define GRED 0XFFE0
|
||||
#define GBLUE 0X07FF
|
||||
#define RED 0xF800
|
||||
#define MAGENTA 0xF81F
|
||||
#define GREEN 0x07E0
|
||||
#define CYAN 0x7FFF
|
||||
#define YELLOW 0xFFE0
|
||||
#define BROWN 0XBC40 //棕色
|
||||
#define BRRED 0XFC07 //棕红色
|
||||
#define GRAY 0X8430 //灰色
|
||||
//GUI颜色
|
||||
|
||||
#define DARKBLUE 0X01CF //深蓝色
|
||||
#define LIGHTBLUE 0X7D7C //浅蓝色
|
||||
#define GRAYBLUE 0X5458 //灰蓝色
|
||||
//以上三色为PANEL的颜色
|
||||
|
||||
#define LIGHTGREEN 0X841F //浅绿色
|
||||
#define LGRAY 0XC618 //浅灰色(PANNEL),窗体背景色
|
||||
|
||||
#define LGRAYBLUE 0XA651 //浅灰蓝色(中间层颜色)
|
||||
#define LBBLUE 0X2B12 //浅棕蓝色(选择条目的反色)
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __LCD_H
|
||||
#define __LCD_H
|
||||
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
//#include "sys.h"
|
||||
|
||||
#define u8 unsigned char
|
||||
#define u16 unsigned int
|
||||
#define u32 unsigned long
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
|
||||
******************************************************/
|
||||
|
||||
//定义LCD的尺寸
|
||||
#define LCD_W 128
|
||||
#define LCD_H 160
|
||||
|
||||
sbit LCD_CS1 =P1^4; //片选
|
||||
sbit LCD_DC =P1^3; //数据/命令切换
|
||||
sbit LCD_SDI =P1^1; //数据
|
||||
sbit LCD_SCK =P1^0; //时钟
|
||||
//sbit LCD_REST =P0^2; //复位
|
||||
sbit LCD_REST =P1^5; //复位
|
||||
|
||||
sbit ZK_MISO =P1^7; //时钟
|
||||
sbit ZK_CS2 =P1^6; //复位
|
||||
|
||||
extern u16 BACK_COLOR, POINT_COLOR; //背景色,画笔色
|
||||
|
||||
void Lcd_Init(void);
|
||||
void LCD_Clear(u16 Color);
|
||||
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2);
|
||||
void LCD_WR_DATA8(char da); //发送数据-8位参数
|
||||
void LCD_WR_DATA(int da);
|
||||
void LCD_WR_REG(char da);
|
||||
|
||||
void LCD_DrawPoint(u16 x,u16 y);//画点
|
||||
void LCD_DrawPoint_big(u16 x,u16 y);//画一个大点
|
||||
u16 LCD_ReadPoint(u16 x,u16 y); //读点
|
||||
void Draw_Circle(u16 x0,u16 y0,u8 r);
|
||||
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2);
|
||||
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2);
|
||||
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color);
|
||||
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 mode);//显示一个字符
|
||||
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len);//显示数字
|
||||
void LCD_Show2Num(u16 x,u16 y,u16 num,u8 len);//显示2个数字
|
||||
void LCD_ShowString(u16 x,u16 y,const u8 *p); //显示一个字符串,16字体
|
||||
|
||||
void showhanzi(unsigned int x,unsigned int y,unsigned char index);
|
||||
|
||||
void CL_Mem(void);
|
||||
void GBZK_ROMOUTSET(void); //字库输出设置
|
||||
void GBZK_ROMOUTRESET(void); //字库输出设置
|
||||
void GBZK_GPIO_Config(void); //字库芯片初始化
|
||||
void ZK_command( unsigned char dat );
|
||||
unsigned char get_data_from_ROM(void);
|
||||
void get_n_bytes_data_from_ROM(unsigned char AddrHigh,unsigned char AddrMid,unsigned char AddrLow,unsigned char *pBuff,unsigned char DataLen );
|
||||
void Display_Asc_String(unsigned char zk_num,unsigned int x, unsigned int y, unsigned char text[]);
|
||||
void Display_Asc( unsigned char zk_num,unsigned int x, unsigned int y );
|
||||
void zk_map( unsigned char *getdate, unsigned char *putdata, unsigned char high, unsigned char width);
|
||||
void Display_GB2312_String(unsigned char zk_num,unsigned int x,unsigned int y, unsigned char text[]);
|
||||
void Display_GB2312( unsigned char zk_num,unsigned int x, unsigned int y );
|
||||
|
||||
|
||||
//画笔颜色
|
||||
#define WHITE 0xFFFF
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define BRED 0XF81F
|
||||
#define GRED 0XFFE0
|
||||
#define GBLUE 0X07FF
|
||||
#define RED 0xF800
|
||||
#define MAGENTA 0xF81F
|
||||
#define GREEN 0x07E0
|
||||
#define CYAN 0x7FFF
|
||||
#define YELLOW 0xFFE0
|
||||
#define BROWN 0XBC40 //棕色
|
||||
#define BRRED 0XFC07 //棕红色
|
||||
#define GRAY 0X8430 //灰色
|
||||
//GUI颜色
|
||||
|
||||
#define DARKBLUE 0X01CF //深蓝色
|
||||
#define LIGHTBLUE 0X7D7C //浅蓝色
|
||||
#define GRAYBLUE 0X5458 //灰蓝色
|
||||
//以上三色为PANEL的颜色
|
||||
|
||||
#define LIGHTGREEN 0X841F //浅绿色
|
||||
#define LGRAY 0XC618 //浅灰色(PANNEL),窗体背景色
|
||||
|
||||
#define LGRAYBLUE 0XA651 //浅灰蓝色(中间层颜色)
|
||||
#define LBBLUE 0X2B12 //浅棕蓝色(选择条目的反色)
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,198 +1,198 @@
|
||||
$NOMOD51
|
||||
;------------------------------------------------------------------------------
|
||||
; This file is part of the C51 Compiler package
|
||||
; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
|
||||
; Version 8.01
|
||||
;
|
||||
; *** <<< Use Configuration Wizard in Context Menu >>> ***
|
||||
;------------------------------------------------------------------------------
|
||||
; STARTUP.A51: This code is executed after processor reset.
|
||||
;
|
||||
; To translate this file use A51 with the following invocation:
|
||||
;
|
||||
; A51 STARTUP.A51
|
||||
;
|
||||
; To link the modified STARTUP.OBJ file to your application use the following
|
||||
; Lx51 invocation:
|
||||
;
|
||||
; Lx51 your object file list, STARTUP.OBJ controls
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; User-defined <h> Power-On Initialization of Memory
|
||||
;
|
||||
; With the following EQU statements the initialization of memory
|
||||
; at processor reset can be defined:
|
||||
;
|
||||
; <o> IDATALEN: IDATA memory size <0x0-0x100>
|
||||
; <i> Note: The absolute start-address of IDATA memory is always 0
|
||||
; <i> The IDATA space overlaps physically the DATA and BIT areas.
|
||||
IDATALEN EQU 80H
|
||||
;
|
||||
; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
|
||||
; <i> The absolute start address of XDATA memory
|
||||
XDATASTART EQU 0
|
||||
;
|
||||
; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
|
||||
; <i> The length of XDATA memory in bytes.
|
||||
XDATALEN EQU 0
|
||||
;
|
||||
; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
|
||||
; <i> The absolute start address of PDATA memory
|
||||
PDATASTART EQU 0H
|
||||
;
|
||||
; <o> PDATALEN: PDATA memory size <0x0-0xFF>
|
||||
; <i> The length of PDATA memory in bytes.
|
||||
PDATALEN EQU 0H
|
||||
;
|
||||
;</h>
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
;<h> Reentrant Stack Initialization
|
||||
;
|
||||
; The following EQU statements define the stack pointer for reentrant
|
||||
; functions and initialized it:
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the SMALL model.
|
||||
; <q> IBPSTACK: Enable SMALL model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the SMALL model.
|
||||
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
|
||||
; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
|
||||
; </h>
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the LARGE model.
|
||||
; <q> XBPSTACK: Enable LARGE model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the LARGE model.
|
||||
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
|
||||
; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
|
||||
; </h>
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the COMPACT model.
|
||||
; <q> PBPSTACK: Enable COMPACT model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the COMPACT model.
|
||||
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
|
||||
;
|
||||
; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
|
||||
; </h>
|
||||
;</h>
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Memory Page for Using the Compact Model with 64 KByte xdata RAM
|
||||
; <e>Compact Model Page Definition
|
||||
;
|
||||
; <i>Define the XDATA page used for PDATA variables.
|
||||
; <i>PPAGE must conform with the PPAGE set in the linker invocation.
|
||||
;
|
||||
; Enable pdata memory page initalization
|
||||
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
|
||||
;
|
||||
; <o> PPAGE number <0x0-0xFF>
|
||||
; <i> uppermost 256-byte address of the page used for PDATA variables.
|
||||
PPAGE EQU 0
|
||||
;
|
||||
; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
|
||||
; <i> most 8051 variants use P2 as uppermost address byte
|
||||
PPAGE_SFR DATA 0A0H
|
||||
;
|
||||
; </e>
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
; Standard SFR Symbols
|
||||
ACC DATA 0E0H
|
||||
B DATA 0F0H
|
||||
SP DATA 81H
|
||||
DPL DATA 82H
|
||||
DPH DATA 83H
|
||||
|
||||
NAME ?C_STARTUP
|
||||
|
||||
|
||||
?C_C51STARTUP SEGMENT CODE
|
||||
?STACK SEGMENT IDATA
|
||||
|
||||
RSEG ?STACK
|
||||
DS 1
|
||||
|
||||
EXTRN CODE (?C_START)
|
||||
PUBLIC ?C_STARTUP
|
||||
|
||||
CSEG AT 0
|
||||
?C_STARTUP: LJMP STARTUP1
|
||||
|
||||
RSEG ?C_C51STARTUP
|
||||
|
||||
STARTUP1:
|
||||
|
||||
IF IDATALEN <> 0
|
||||
MOV R0,#IDATALEN - 1
|
||||
CLR A
|
||||
IDATALOOP: MOV @R0,A
|
||||
DJNZ R0,IDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF XDATALEN <> 0
|
||||
MOV DPTR,#XDATASTART
|
||||
MOV R7,#LOW (XDATALEN)
|
||||
IF (LOW (XDATALEN)) <> 0
|
||||
MOV R6,#(HIGH (XDATALEN)) +1
|
||||
ELSE
|
||||
MOV R6,#HIGH (XDATALEN)
|
||||
ENDIF
|
||||
CLR A
|
||||
XDATALOOP: MOVX @DPTR,A
|
||||
INC DPTR
|
||||
DJNZ R7,XDATALOOP
|
||||
DJNZ R6,XDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF PPAGEENABLE <> 0
|
||||
MOV PPAGE_SFR,#PPAGE
|
||||
ENDIF
|
||||
|
||||
IF PDATALEN <> 0
|
||||
MOV R0,#LOW (PDATASTART)
|
||||
MOV R7,#LOW (PDATALEN)
|
||||
CLR A
|
||||
PDATALOOP: MOVX @R0,A
|
||||
INC R0
|
||||
DJNZ R7,PDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF IBPSTACK <> 0
|
||||
EXTRN DATA (?C_IBP)
|
||||
|
||||
MOV ?C_IBP,#LOW IBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
IF XBPSTACK <> 0
|
||||
EXTRN DATA (?C_XBP)
|
||||
|
||||
MOV ?C_XBP,#HIGH XBPSTACKTOP
|
||||
MOV ?C_XBP+1,#LOW XBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
IF PBPSTACK <> 0
|
||||
EXTRN DATA (?C_PBP)
|
||||
MOV ?C_PBP,#LOW PBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
MOV SP,#?STACK-1
|
||||
|
||||
; This code is required if you use L51_BANK.A51 with Banking Mode 4
|
||||
;<h> Code Banking
|
||||
; <q> Select Bank 0 for L51_BANK.A51 Mode 4
|
||||
#if 0
|
||||
; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
|
||||
EXTRN CODE (?B_SWITCH0)
|
||||
CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
|
||||
#endif
|
||||
;</h>
|
||||
LJMP ?C_START
|
||||
|
||||
END
|
||||
$NOMOD51
|
||||
;------------------------------------------------------------------------------
|
||||
; This file is part of the C51 Compiler package
|
||||
; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
|
||||
; Version 8.01
|
||||
;
|
||||
; *** <<< Use Configuration Wizard in Context Menu >>> ***
|
||||
;------------------------------------------------------------------------------
|
||||
; STARTUP.A51: This code is executed after processor reset.
|
||||
;
|
||||
; To translate this file use A51 with the following invocation:
|
||||
;
|
||||
; A51 STARTUP.A51
|
||||
;
|
||||
; To link the modified STARTUP.OBJ file to your application use the following
|
||||
; Lx51 invocation:
|
||||
;
|
||||
; Lx51 your object file list, STARTUP.OBJ controls
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; User-defined <h> Power-On Initialization of Memory
|
||||
;
|
||||
; With the following EQU statements the initialization of memory
|
||||
; at processor reset can be defined:
|
||||
;
|
||||
; <o> IDATALEN: IDATA memory size <0x0-0x100>
|
||||
; <i> Note: The absolute start-address of IDATA memory is always 0
|
||||
; <i> The IDATA space overlaps physically the DATA and BIT areas.
|
||||
IDATALEN EQU 80H
|
||||
;
|
||||
; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
|
||||
; <i> The absolute start address of XDATA memory
|
||||
XDATASTART EQU 0
|
||||
;
|
||||
; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
|
||||
; <i> The length of XDATA memory in bytes.
|
||||
XDATALEN EQU 0
|
||||
;
|
||||
; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
|
||||
; <i> The absolute start address of PDATA memory
|
||||
PDATASTART EQU 0H
|
||||
;
|
||||
; <o> PDATALEN: PDATA memory size <0x0-0xFF>
|
||||
; <i> The length of PDATA memory in bytes.
|
||||
PDATALEN EQU 0H
|
||||
;
|
||||
;</h>
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
;<h> Reentrant Stack Initialization
|
||||
;
|
||||
; The following EQU statements define the stack pointer for reentrant
|
||||
; functions and initialized it:
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the SMALL model.
|
||||
; <q> IBPSTACK: Enable SMALL model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the SMALL model.
|
||||
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
|
||||
; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
|
||||
; </h>
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the LARGE model.
|
||||
; <q> XBPSTACK: Enable LARGE model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the LARGE model.
|
||||
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
|
||||
; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
|
||||
; </h>
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the COMPACT model.
|
||||
; <q> PBPSTACK: Enable COMPACT model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the COMPACT model.
|
||||
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
|
||||
;
|
||||
; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
|
||||
; </h>
|
||||
;</h>
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Memory Page for Using the Compact Model with 64 KByte xdata RAM
|
||||
; <e>Compact Model Page Definition
|
||||
;
|
||||
; <i>Define the XDATA page used for PDATA variables.
|
||||
; <i>PPAGE must conform with the PPAGE set in the linker invocation.
|
||||
;
|
||||
; Enable pdata memory page initalization
|
||||
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
|
||||
;
|
||||
; <o> PPAGE number <0x0-0xFF>
|
||||
; <i> uppermost 256-byte address of the page used for PDATA variables.
|
||||
PPAGE EQU 0
|
||||
;
|
||||
; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
|
||||
; <i> most 8051 variants use P2 as uppermost address byte
|
||||
PPAGE_SFR DATA 0A0H
|
||||
;
|
||||
; </e>
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
; Standard SFR Symbols
|
||||
ACC DATA 0E0H
|
||||
B DATA 0F0H
|
||||
SP DATA 81H
|
||||
DPL DATA 82H
|
||||
DPH DATA 83H
|
||||
|
||||
NAME ?C_STARTUP
|
||||
|
||||
|
||||
?C_C51STARTUP SEGMENT CODE
|
||||
?STACK SEGMENT IDATA
|
||||
|
||||
RSEG ?STACK
|
||||
DS 1
|
||||
|
||||
EXTRN CODE (?C_START)
|
||||
PUBLIC ?C_STARTUP
|
||||
|
||||
CSEG AT 0
|
||||
?C_STARTUP: LJMP STARTUP1
|
||||
|
||||
RSEG ?C_C51STARTUP
|
||||
|
||||
STARTUP1:
|
||||
|
||||
IF IDATALEN <> 0
|
||||
MOV R0,#IDATALEN - 1
|
||||
CLR A
|
||||
IDATALOOP: MOV @R0,A
|
||||
DJNZ R0,IDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF XDATALEN <> 0
|
||||
MOV DPTR,#XDATASTART
|
||||
MOV R7,#LOW (XDATALEN)
|
||||
IF (LOW (XDATALEN)) <> 0
|
||||
MOV R6,#(HIGH (XDATALEN)) +1
|
||||
ELSE
|
||||
MOV R6,#HIGH (XDATALEN)
|
||||
ENDIF
|
||||
CLR A
|
||||
XDATALOOP: MOVX @DPTR,A
|
||||
INC DPTR
|
||||
DJNZ R7,XDATALOOP
|
||||
DJNZ R6,XDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF PPAGEENABLE <> 0
|
||||
MOV PPAGE_SFR,#PPAGE
|
||||
ENDIF
|
||||
|
||||
IF PDATALEN <> 0
|
||||
MOV R0,#LOW (PDATASTART)
|
||||
MOV R7,#LOW (PDATALEN)
|
||||
CLR A
|
||||
PDATALOOP: MOVX @R0,A
|
||||
INC R0
|
||||
DJNZ R7,PDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF IBPSTACK <> 0
|
||||
EXTRN DATA (?C_IBP)
|
||||
|
||||
MOV ?C_IBP,#LOW IBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
IF XBPSTACK <> 0
|
||||
EXTRN DATA (?C_XBP)
|
||||
|
||||
MOV ?C_XBP,#HIGH XBPSTACKTOP
|
||||
MOV ?C_XBP+1,#LOW XBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
IF PBPSTACK <> 0
|
||||
EXTRN DATA (?C_PBP)
|
||||
MOV ?C_PBP,#LOW PBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
MOV SP,#?STACK-1
|
||||
|
||||
; This code is required if you use L51_BANK.A51 with Banking Mode 4
|
||||
;<h> Code Banking
|
||||
; <q> Select Bank 0 for L51_BANK.A51 Mode 4
|
||||
#if 0
|
||||
; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
|
||||
EXTRN CODE (?B_SWITCH0)
|
||||
CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
|
||||
#endif
|
||||
;</h>
|
||||
LJMP ?C_START
|
||||
|
||||
END
|
@ -1,159 +1,159 @@
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : Timer.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 Time 初始化、定时器、计数器赋值、T2捕捉功能开启函数等
|
||||
定时器中断函数
|
||||
*******************************************************************************/
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
#include "Timer.h"
|
||||
#include "stdio.h"
|
||||
#include "USB.h"
|
||||
|
||||
UINT8 Tim_3ms;
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
* Description : CH554定时计数器x模式设置
|
||||
* Input : UINT8 mode,Timer模式选择
|
||||
0:模式0,13位定时器,TLn的高3位无效
|
||||
1:模式1,16位定时器
|
||||
2:模式2,8位自动重装定时器
|
||||
3:模式3,两个8位定时器 Timer0
|
||||
3:模式3,Timer1停止
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
{
|
||||
if(x == 0){TMOD = TMOD & 0xf0 | mode;}
|
||||
else if(x == 1){TMOD = TMOD & 0x0f | (mode<<4);}
|
||||
else if(x == 2){RCLK = 0;TCLK = 0;CP_RL2 = 0;} //16位自动重载定时器
|
||||
else return FAIL;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
* Description : CH554Timer0 TH0和TL0赋值
|
||||
* Input : UINT16 dat;定时器赋值
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
{
|
||||
UINT16 tmp;
|
||||
tmp = 65536 - dat;
|
||||
if(x == 0){TL0 = tmp & 0xff;TH0 = (tmp>>8) & 0xff;}
|
||||
else if(x == 1){TL1 = tmp & 0xff;TH1 = (tmp>>8) & 0xff;}
|
||||
else if(x == 2)
|
||||
{
|
||||
RCAP2L = TL2 = tmp & 0xff; //16位自动重载定时器
|
||||
RCAP2H = TH2 = (tmp>>8) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP2Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2EX引脚捕捉功能初始化
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP2Init(UINT8 mode)
|
||||
{
|
||||
RCLK = 0;
|
||||
TCLK = 0;
|
||||
C_T2 = 0;
|
||||
EXEN2 = 1;
|
||||
CP_RL2 = 1; //启动T2ex的捕捉功能
|
||||
T2MOD |= mode << 2; //边沿捕捉模式选择
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP1Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2引脚捕捉功能初始化T2
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP1Init(UINT8 mode)
|
||||
{
|
||||
RCLK = 0;
|
||||
TCLK = 0;
|
||||
CP_RL2 = 1;
|
||||
C_T2 = 0;
|
||||
T2MOD = T2MOD & ~T2OE | (mode << 2) | bT2_CAP1_EN; //使能T2引脚捕捉功能,边沿捕捉模式选择
|
||||
}
|
||||
|
||||
#ifdef T0_INT
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer0Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
void mTimer0Interrupt( void ) interrupt INT_NO_TMR0 using 1 //timer0中断服务程序,使用寄存器组1
|
||||
{ //方式3时,TH0使用Timer1的中断资源
|
||||
SCK = ~SCK;
|
||||
// mTimer_x_SetData(0,0x0000); //非自动重载方式需重新给TH0和TL0赋值
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef T1_INT
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer1Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
void mTimer1Interrupt( void ) interrupt INT_NO_TMR1 using 2 //timer1中断服务程序,使用寄存器组2
|
||||
{ //方式3时,Timer1停止
|
||||
SCK = ~SCK;
|
||||
// mTimer_x_SetData(1,0x0000); //非自动重载方式需重新给TH1和TL1赋值
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer2Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
#ifdef T2_INT
|
||||
void mTimer2Interrupt(void) interrupt INT_NO_TMR2 using 3 //timer2中断服务程序,使用寄存器组3
|
||||
{
|
||||
mTimer2RunCTL( 0 ); //关定时器
|
||||
#ifdef T2_CAP
|
||||
if(EXF2) //T2ex电平变化中断中断标志
|
||||
{
|
||||
SCK = ~SCK; //P17电平指示监控
|
||||
Cap[FLAG++] = RCAP2; //T2EX
|
||||
printf("RCAP2 %04x \n",RCAP2);
|
||||
EXF2 = 0; //清空T2ex捕捉中断标志
|
||||
}
|
||||
if(CAP1F) //T2电平捕捉中断标志
|
||||
{
|
||||
Cap[FLAG++] = T2CAP1; //T2;
|
||||
printf("T2CAP1 %04x \n",T2CAP1);
|
||||
CAP1F = 0; //清空T2捕捉中断标志
|
||||
}
|
||||
#endif
|
||||
if(TF2)
|
||||
{
|
||||
Tim_3ms++;
|
||||
TF2 = 0; //清空定时器2溢出中断
|
||||
}
|
||||
mTimer2RunCTL(1); //开定时器
|
||||
}
|
||||
#endif
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : Timer.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 Time 初始化、定时器、计数器赋值、T2捕捉功能开启函数等
|
||||
定时器中断函数
|
||||
*******************************************************************************/
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
#include "Timer.h"
|
||||
#include "stdio.h"
|
||||
#include "USB.h"
|
||||
|
||||
UINT8 Tim_3ms;
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
* Description : CH554定时计数器x模式设置
|
||||
* Input : UINT8 mode,Timer模式选择
|
||||
0:模式0,13位定时器,TLn的高3位无效
|
||||
1:模式1,16位定时器
|
||||
2:模式2,8位自动重装定时器
|
||||
3:模式3,两个8位定时器 Timer0
|
||||
3:模式3,Timer1停止
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
{
|
||||
if(x == 0){TMOD = TMOD & 0xf0 | mode;}
|
||||
else if(x == 1){TMOD = TMOD & 0x0f | (mode<<4);}
|
||||
else if(x == 2){RCLK = 0;TCLK = 0;CP_RL2 = 0;} //16位自动重载定时器
|
||||
else return FAIL;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
* Description : CH554Timer0 TH0和TL0赋值
|
||||
* Input : UINT16 dat;定时器赋值
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
{
|
||||
UINT16 tmp;
|
||||
tmp = 65536 - dat;
|
||||
if(x == 0){TL0 = tmp & 0xff;TH0 = (tmp>>8) & 0xff;}
|
||||
else if(x == 1){TL1 = tmp & 0xff;TH1 = (tmp>>8) & 0xff;}
|
||||
else if(x == 2)
|
||||
{
|
||||
RCAP2L = TL2 = tmp & 0xff; //16位自动重载定时器
|
||||
RCAP2H = TH2 = (tmp>>8) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP2Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2EX引脚捕捉功能初始化
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP2Init(UINT8 mode)
|
||||
{
|
||||
RCLK = 0;
|
||||
TCLK = 0;
|
||||
C_T2 = 0;
|
||||
EXEN2 = 1;
|
||||
CP_RL2 = 1; //启动T2ex的捕捉功能
|
||||
T2MOD |= mode << 2; //边沿捕捉模式选择
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP1Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2引脚捕捉功能初始化T2
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP1Init(UINT8 mode)
|
||||
{
|
||||
RCLK = 0;
|
||||
TCLK = 0;
|
||||
CP_RL2 = 1;
|
||||
C_T2 = 0;
|
||||
T2MOD = T2MOD & ~T2OE | (mode << 2) | bT2_CAP1_EN; //使能T2引脚捕捉功能,边沿捕捉模式选择
|
||||
}
|
||||
|
||||
#ifdef T0_INT
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer0Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
void mTimer0Interrupt( void ) interrupt INT_NO_TMR0 using 1 //timer0中断服务程序,使用寄存器组1
|
||||
{ //方式3时,TH0使用Timer1的中断资源
|
||||
SCK = ~SCK;
|
||||
// mTimer_x_SetData(0,0x0000); //非自动重载方式需重新给TH0和TL0赋值
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef T1_INT
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer1Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
void mTimer1Interrupt( void ) interrupt INT_NO_TMR1 using 2 //timer1中断服务程序,使用寄存器组2
|
||||
{ //方式3时,Timer1停止
|
||||
SCK = ~SCK;
|
||||
// mTimer_x_SetData(1,0x0000); //非自动重载方式需重新给TH1和TL1赋值
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer2Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
#ifdef T2_INT
|
||||
void mTimer2Interrupt(void) interrupt INT_NO_TMR2 using 3 //timer2中断服务程序,使用寄存器组3
|
||||
{
|
||||
mTimer2RunCTL( 0 ); //关定时器
|
||||
#ifdef T2_CAP
|
||||
if(EXF2) //T2ex电平变化中断中断标志
|
||||
{
|
||||
SCK = ~SCK; //P17电平指示监控
|
||||
Cap[FLAG++] = RCAP2; //T2EX
|
||||
printf("RCAP2 %04x \n",RCAP2);
|
||||
EXF2 = 0; //清空T2ex捕捉中断标志
|
||||
}
|
||||
if(CAP1F) //T2电平捕捉中断标志
|
||||
{
|
||||
Cap[FLAG++] = T2CAP1; //T2;
|
||||
printf("T2CAP1 %04x \n",T2CAP1);
|
||||
CAP1F = 0; //清空T2捕捉中断标志
|
||||
}
|
||||
#endif
|
||||
if(TF2)
|
||||
{
|
||||
Tim_3ms++;
|
||||
TF2 = 0; //清空定时器2溢出中断
|
||||
}
|
||||
mTimer2RunCTL(1); //开定时器
|
||||
}
|
||||
#endif
|
@ -1,94 +1,94 @@
|
||||
|
||||
|
||||
// #define T0_INT 1 //T中断开启
|
||||
//#define T1_INT 1
|
||||
#define T2_INT 1
|
||||
// #define T2_CAP 1
|
||||
|
||||
extern UINT8 Tim_3ms;
|
||||
|
||||
extern UINT8 FLAG;
|
||||
extern UINT16 Cap[8];
|
||||
|
||||
//CH554 Timer0时钟选择
|
||||
//bTMR_CLK同时影响Timer0&1&2,使用时要注意 (除定时使用标准时钟)
|
||||
#define mTimer0Clk12DivFsys( ) (T2MOD &= ~bT0_CLK) //定时器,时钟=Fsys/12 T0标准时钟
|
||||
#define mTimer0ClkFsys( ) (T2MOD |= bTMR_CLK | bT0_CLK) //定时器,时钟=Fsys
|
||||
#define mTimer0Clk4DivFsys( ) (T2MOD &= ~bTMR_CLK;T2MOD |= bT0_CLK) //定时器,时钟=Fsys/4
|
||||
#define mTimer0CountClk( ) (TMOD |= bT0_CT) //计数器,T0引脚的下降沿有效
|
||||
|
||||
//CH554 Timer0 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer0RunCTL( SS ) (TR0 = SS ? START : STOP)
|
||||
|
||||
|
||||
#define mTimer1Clk12DivFsys( ) (T2MOD &= ~bT1_CLK) //定时器,时钟=Fsys/12 T1标准时钟
|
||||
#define mTimer1ClkFsys( ) (T2MOD |= bTMR_CLK | bT1_CLK) //定时器,时钟=Fsys
|
||||
#define mTimer1Clk4DivFsys( ) (T2MOD &= ~bTMR_CLK;T2MOD |= bT1_CLK) //定时器,时钟=Fsys/4
|
||||
#define mTimer1CountClk( ) (TMOD |= bT1_CT) //计数器,T0引脚的下降沿有效
|
||||
|
||||
//CH554 Timer1 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer1RunCTL( SS ) (TR1 = SS ? START : STOP)
|
||||
|
||||
|
||||
#define mTimer2Clk12DivFsys( ) {T2MOD &= ~(bTMR_CLK | bT2_CLK);C_T2 = 0;} //定时器,时钟=Fsys/12 T2标准时钟
|
||||
#define mTimer2ClkFsys( ) {T2MOD |= (bTMR_CLK | bT2_CLK);C_T2=0;} //定时器,时钟=Fsys
|
||||
#define mTimer2Clk4DivFsys( ) {T2MOD &= ~bTMR_CLK;T2MOD |= bT2_CLK;C_T2 = 0;}//定时器,时钟=Fsys/4
|
||||
#define mTimer2CountClk( ) {C_T2 = 1;} //计数器,T2引脚的下降沿有效
|
||||
|
||||
//CH554 Timer2 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer2RunCTL( SS ) {TR2 = SS ? START : STOP;}
|
||||
#define mTimer2OutCTL( ) (T2MOD |= T2OE) //T2输出 频率TF2/2
|
||||
#define CAP1Alter( ) (PIN_FUNC |= bT2_PIN_X;) //CAP1由P10 映射到P14
|
||||
#define CAP2Alter( ) (PIN_FUNC |= bT2EX_PIN_X;) //CAP2由P11 映射RST
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
* Description : CH554定时计数器x模式设置
|
||||
* Input : UINT8 mode,Timer模式选择
|
||||
0:模式0,13位定时器,TLn的高3位无效
|
||||
1:模式1,16位定时器
|
||||
2:模式2,8位自动重装定时器
|
||||
3:模式3,两个8位定时器 Timer0
|
||||
3:模式3,Timer1停止
|
||||
UINT8 x 定时器 0 1 2
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 mTimer_x_ModInit(UINT8 x ,UINT8 mode);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
* Description : CH554Timer
|
||||
* Input : UINT16 dat;定时器赋值
|
||||
UINT8 x 定时器 0 1 2
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mTimer_x_SetData(UINT8 x,UINT16 dat);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP2Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2EX引脚捕捉功能初始化
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP2Init(UINT8 mode);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP1Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2引脚捕捉功能初始化T2
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
// #define T0_INT 1 //T中断开启
|
||||
//#define T1_INT 1
|
||||
#define T2_INT 1
|
||||
// #define T2_CAP 1
|
||||
|
||||
extern UINT8 Tim_3ms;
|
||||
|
||||
extern UINT8 FLAG;
|
||||
extern UINT16 Cap[8];
|
||||
|
||||
//CH554 Timer0时钟选择
|
||||
//bTMR_CLK同时影响Timer0&1&2,使用时要注意 (除定时使用标准时钟)
|
||||
#define mTimer0Clk12DivFsys( ) (T2MOD &= ~bT0_CLK) //定时器,时钟=Fsys/12 T0标准时钟
|
||||
#define mTimer0ClkFsys( ) (T2MOD |= bTMR_CLK | bT0_CLK) //定时器,时钟=Fsys
|
||||
#define mTimer0Clk4DivFsys( ) (T2MOD &= ~bTMR_CLK;T2MOD |= bT0_CLK) //定时器,时钟=Fsys/4
|
||||
#define mTimer0CountClk( ) (TMOD |= bT0_CT) //计数器,T0引脚的下降沿有效
|
||||
|
||||
//CH554 Timer0 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer0RunCTL( SS ) (TR0 = SS ? START : STOP)
|
||||
|
||||
|
||||
#define mTimer1Clk12DivFsys( ) (T2MOD &= ~bT1_CLK) //定时器,时钟=Fsys/12 T1标准时钟
|
||||
#define mTimer1ClkFsys( ) (T2MOD |= bTMR_CLK | bT1_CLK) //定时器,时钟=Fsys
|
||||
#define mTimer1Clk4DivFsys( ) (T2MOD &= ~bTMR_CLK;T2MOD |= bT1_CLK) //定时器,时钟=Fsys/4
|
||||
#define mTimer1CountClk( ) (TMOD |= bT1_CT) //计数器,T0引脚的下降沿有效
|
||||
|
||||
//CH554 Timer1 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer1RunCTL( SS ) (TR1 = SS ? START : STOP)
|
||||
|
||||
|
||||
#define mTimer2Clk12DivFsys( ) {T2MOD &= ~(bTMR_CLK | bT2_CLK);C_T2 = 0;} //定时器,时钟=Fsys/12 T2标准时钟
|
||||
#define mTimer2ClkFsys( ) {T2MOD |= (bTMR_CLK | bT2_CLK);C_T2=0;} //定时器,时钟=Fsys
|
||||
#define mTimer2Clk4DivFsys( ) {T2MOD &= ~bTMR_CLK;T2MOD |= bT2_CLK;C_T2 = 0;}//定时器,时钟=Fsys/4
|
||||
#define mTimer2CountClk( ) {C_T2 = 1;} //计数器,T2引脚的下降沿有效
|
||||
|
||||
//CH554 Timer2 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer2RunCTL( SS ) {TR2 = SS ? START : STOP;}
|
||||
#define mTimer2OutCTL( ) (T2MOD |= T2OE) //T2输出 频率TF2/2
|
||||
#define CAP1Alter( ) (PIN_FUNC |= bT2_PIN_X;) //CAP1由P10 映射到P14
|
||||
#define CAP2Alter( ) (PIN_FUNC |= bT2EX_PIN_X;) //CAP2由P11 映射RST
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
* Description : CH554定时计数器x模式设置
|
||||
* Input : UINT8 mode,Timer模式选择
|
||||
0:模式0,13位定时器,TLn的高3位无效
|
||||
1:模式1,16位定时器
|
||||
2:模式2,8位自动重装定时器
|
||||
3:模式3,两个8位定时器 Timer0
|
||||
3:模式3,Timer1停止
|
||||
UINT8 x 定时器 0 1 2
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 mTimer_x_ModInit(UINT8 x ,UINT8 mode);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
* Description : CH554Timer
|
||||
* Input : UINT16 dat;定时器赋值
|
||||
UINT8 x 定时器 0 1 2
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mTimer_x_SetData(UINT8 x,UINT16 dat);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP2Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2EX引脚捕捉功能初始化
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP2Init(UINT8 mode);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP1Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2引脚捕捉功能初始化T2
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP1Init(UINT8 mode);
|
File diff suppressed because it is too large
Load Diff
@ -1,72 +1,72 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : USB.C *
|
||||
* Author : QITAS *
|
||||
* Version : V1.0 *
|
||||
* Date : 2018/06/06 *
|
||||
* Description : USB通信定义
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef __USB_H__
|
||||
#define __USB_H__
|
||||
|
||||
#define L_WIN 0X08
|
||||
#define L_ALT 0X04
|
||||
#define L_SHIFT 0X02
|
||||
#define L_CTL 0X01
|
||||
#define R_WIN 0X80
|
||||
#define R_ALT 0X40
|
||||
#define R_SHIFT 0X20
|
||||
#define R_CTL 0X10
|
||||
#define SPACE 0X2C
|
||||
#define ENTER 0X28
|
||||
|
||||
#define PowerON 26 //&
|
||||
#define PowerOFF 21 //!
|
||||
#define KEY_1 65 //A
|
||||
#define KEY_2 66
|
||||
#define KEY_3 67
|
||||
#define KEY_4 68
|
||||
#define KEY_5 69
|
||||
#define KEY_6 70
|
||||
#define KEY_0 71
|
||||
|
||||
//发送通道选择,通过TXflag标记
|
||||
#define SENDK 0x02
|
||||
#define SENDD 0x04
|
||||
|
||||
|
||||
//发送通道选择,通过RXflag标记
|
||||
#define ERROR 0xEE
|
||||
#define LONG 0xFF
|
||||
|
||||
|
||||
|
||||
//帧头数据
|
||||
#define HEADER_MAGIC 0x5A
|
||||
|
||||
//上位机发送给MCU的命令类型
|
||||
|
||||
#define CMD_SET_USB 0x01
|
||||
#define CMD_SET_POP 0x02
|
||||
#define CMD_SET_TST 0x40
|
||||
|
||||
//MCU返回给上位机的命令类型
|
||||
#define RTNN 0x60
|
||||
#define CMD_RTN_SET_DISPLAY RTNN+CMD_SET_DISPLAY
|
||||
#define CMD_RTN_GET_VOLUME RTNN+CMD_GET_VOLUME
|
||||
|
||||
extern UINT16I TouchKeyButton;
|
||||
|
||||
//extern UINT8X TX[64]; //发送数据
|
||||
//extern UINT8X RX[64]; //放置其他接收数据
|
||||
extern UINT8X USB_BUF[128];
|
||||
|
||||
extern UINT8 TXflag;
|
||||
extern UINT8 RXflag;
|
||||
|
||||
extern void USBDeviceInit();
|
||||
extern void TXflagHandle(UINT8 val); //val参数根据TXflag有不同的意义
|
||||
|
||||
#endif
|
||||
/**************************** END *************************************/
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : USB.C *
|
||||
* Author : QITAS *
|
||||
* Version : V1.0 *
|
||||
* Date : 2018/06/06 *
|
||||
* Description : USB通信定义
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef __USB_H__
|
||||
#define __USB_H__
|
||||
|
||||
#define L_WIN 0X08
|
||||
#define L_ALT 0X04
|
||||
#define L_SHIFT 0X02
|
||||
#define L_CTL 0X01
|
||||
#define R_WIN 0X80
|
||||
#define R_ALT 0X40
|
||||
#define R_SHIFT 0X20
|
||||
#define R_CTL 0X10
|
||||
#define SPACE 0X2C
|
||||
#define ENTER 0X28
|
||||
|
||||
#define PowerON 26 //&
|
||||
#define PowerOFF 21 //!
|
||||
#define KEY_1 65 //A
|
||||
#define KEY_2 66
|
||||
#define KEY_3 67
|
||||
#define KEY_4 68
|
||||
#define KEY_5 69
|
||||
#define KEY_6 70
|
||||
#define KEY_0 71
|
||||
|
||||
//发送通道选择,通过TXflag标记
|
||||
#define SENDK 0x02
|
||||
#define SENDD 0x04
|
||||
|
||||
|
||||
//发送通道选择,通过RXflag标记
|
||||
#define ERROR 0xEE
|
||||
#define LONG 0xFF
|
||||
|
||||
|
||||
|
||||
//帧头数据
|
||||
#define HEADER_MAGIC 0x5A
|
||||
|
||||
//上位机发送给MCU的命令类型
|
||||
|
||||
#define CMD_SET_USB 0x01
|
||||
#define CMD_SET_POP 0x02
|
||||
#define CMD_SET_TST 0x40
|
||||
|
||||
//MCU返回给上位机的命令类型
|
||||
#define RTNN 0x60
|
||||
#define CMD_RTN_SET_DISPLAY RTNN+CMD_SET_DISPLAY
|
||||
#define CMD_RTN_GET_VOLUME RTNN+CMD_GET_VOLUME
|
||||
|
||||
extern UINT16I TouchKeyButton;
|
||||
|
||||
//extern UINT8X TX[64]; //发送数据
|
||||
//extern UINT8X RX[64]; //放置其他接收数据
|
||||
extern UINT8X USB_BUF[128];
|
||||
|
||||
extern UINT8 TXflag;
|
||||
extern UINT8 RXflag;
|
||||
|
||||
extern void USBDeviceInit();
|
||||
extern void TXflagHandle(UINT8 val); //val参数根据TXflag有不同的意义
|
||||
|
||||
#endif
|
||||
/**************************** END *************************************/
|
@ -1,244 +1,244 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : Debug.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 DEBUG Interface
|
||||
CH554主频修改、延时函数定义
|
||||
串口0和串口1初始化
|
||||
串口0和串口1的收发子函数
|
||||
看门狗初始化
|
||||
*******************************************************************************/
|
||||
#include <intrins.h>
|
||||
#include "CH554.H"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CfgFsys( )
|
||||
* Description : CH554时钟选择和配置函数,默认使用Fsys 6MHz,FREQ_SYS可以通过
|
||||
CLOCK_CFG配置得到,公式如下:
|
||||
Fsys = (Fosc * 4/(CLOCK_CFG & MASK_SYS_CK_SEL);具体时钟需要自己配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CfgFsys( )
|
||||
{
|
||||
// SAFE_MOD = 0x55;
|
||||
// SAFE_MOD = 0xAA; //进入安全模式 SFR寄存器修改必须先进入安全模式下
|
||||
|
||||
// CLOCK_CFG |= bOSC_EN_XT; //使能外部晶振
|
||||
// CLOCK_CFG &= ~bOSC_EN_INT; //关闭内部晶振 切换到外部晶振
|
||||
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x07; // 32MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x05; // 16MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x04; // 12MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x03; // 6MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x02; // 3MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x01; // 750KHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x00; // 187.5MHz
|
||||
SAFE_MOD = 0x00; //退出安全模式
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : L0_nop_1us(void)
|
||||
* Description : 1us延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void L0_nop_1us(void) // 以uS为单位延时
|
||||
{
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayus(UNIT16 n)
|
||||
* Description : us延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void delayus( UINT16 n ) // 以uS为单位延时
|
||||
{
|
||||
while( n )
|
||||
{
|
||||
L0_nop_1us();
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayms(UNIT16 n)
|
||||
* Description : ms延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void delayms( UINT16 n ) // 以mS为单位延时
|
||||
{
|
||||
while ( n )
|
||||
{
|
||||
delayus(1000);
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0Alter()
|
||||
* Description : CH554串口0引脚映射,串口映射到P0.2和P0.3
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0Alter()
|
||||
{
|
||||
PIN_FUNC |= bUART0_PIN_X; //串口映射到P1.2和P1.3
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mInitSTDIO()
|
||||
* Description : CH554串口0初始化,默认使用T1作UART0的波特率发生器,也可以使用T2
|
||||
作为波特率发生器
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mInitSTDIO( )
|
||||
{
|
||||
UINT32 x;
|
||||
UINT8 x2;
|
||||
|
||||
SM0 = 0; //串口数据位数 8位
|
||||
SM1 = 1; //串口波特率选择 0-设置固定波特率 1-可变波特率 由t1t2产生
|
||||
SM2 = 0; //串口0使用模式1
|
||||
//使用Timer1作为波特率发生器
|
||||
RCLK = 0; //UART0接收时钟
|
||||
TCLK = 0; //UART0发送时钟
|
||||
PCON |= SMOD;
|
||||
x = 10 * FREQ_SYS / UART0_BUAD / 16; //如果更改主频,注意x的值不要溢出
|
||||
x2 = x % 10;
|
||||
x /= 10;
|
||||
if ( x2 >= 5 ) x ++; //四舍五入
|
||||
//PIN_FUNC
|
||||
TMOD = TMOD & ~ bT1_GATE & ~ bT1_CT & ~ MASK_T1_MOD | bT1_M1; //0X20,Timer1作为8位自动重载定时器
|
||||
T2MOD = T2MOD | bTMR_CLK | bT1_CLK; //Timer1时钟选择
|
||||
TH1 = 0-x; //12MHz晶振,buad/12为实际需设置波特率
|
||||
TR1 = 1; //启动定时器1
|
||||
TI = 1;
|
||||
REN = 1; //串口0接收使能
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0RcvByte()
|
||||
* Description : CH554UART0接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART0RcvByte( )
|
||||
{
|
||||
while(RI == 0); //查询接收,中断方式可不用
|
||||
RI = 0;
|
||||
return SBUF;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART0发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(TI ==0);
|
||||
TI = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : UART1Setup()
|
||||
* Description : CH554串口1初始化
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void UART1Setup( )
|
||||
{
|
||||
U1SM0 = 0; //UART1选择8位数据位
|
||||
U1SMOD = 1; //快速模式
|
||||
U1REN = 1; //使能接收
|
||||
SBAUD1 = 0 - FREQ_SYS/16/UART1_BUAD;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1RcvByte()
|
||||
* Description : CH554UART1接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART1RcvByte( )
|
||||
{
|
||||
while(U1RI == 0); //查询接收,中断方式可不用
|
||||
U1RI = 0;
|
||||
return SBUF1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART1发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART1SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF1 = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(U1TI ==0);
|
||||
U1TI = 1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTModeSelect(UINT8 mode)
|
||||
* Description : CH554看门狗模式选择
|
||||
* Input : UINT8 mode
|
||||
0 timer
|
||||
1 watchDog
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WDTModeSelect(UINT8 mode)
|
||||
{
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xaa; //进入安全模式
|
||||
if(mode){
|
||||
GLOBAL_CFG |= bWDOG_EN; //启动看门狗复位
|
||||
}
|
||||
else GLOBAL_CFG &= ~bWDOG_EN; //启动看门狗仅仅作为定时器
|
||||
SAFE_MOD = 0x00; //退出安全模式
|
||||
WDOG_COUNT = 0; //看门狗赋初值
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTFeed(UINT8 tim)
|
||||
* Description : CH554看门狗定时时间设置
|
||||
* Input : UINT8 tim 看门狗复位时间设置
|
||||
00H(6MHz)=2.8s
|
||||
80H(6MHz)=1.4s
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WDTFeed(UINT8 tim)
|
||||
{
|
||||
WDOG_COUNT = tim; //看门狗计数器赋值
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : Debug.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 DEBUG Interface
|
||||
CH554主频修改、延时函数定义
|
||||
串口0和串口1初始化
|
||||
串口0和串口1的收发子函数
|
||||
看门狗初始化
|
||||
*******************************************************************************/
|
||||
#include <intrins.h>
|
||||
#include "CH554.H"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CfgFsys( )
|
||||
* Description : CH554时钟选择和配置函数,默认使用Fsys 6MHz,FREQ_SYS可以通过
|
||||
CLOCK_CFG配置得到,公式如下:
|
||||
Fsys = (Fosc * 4/(CLOCK_CFG & MASK_SYS_CK_SEL);具体时钟需要自己配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CfgFsys( )
|
||||
{
|
||||
// SAFE_MOD = 0x55;
|
||||
// SAFE_MOD = 0xAA; //进入安全模式 SFR寄存器修改必须先进入安全模式下
|
||||
|
||||
// CLOCK_CFG |= bOSC_EN_XT; //使能外部晶振
|
||||
// CLOCK_CFG &= ~bOSC_EN_INT; //关闭内部晶振 切换到外部晶振
|
||||
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x07; // 32MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x05; // 16MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x04; // 12MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x03; // 6MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x02; // 3MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x01; // 750KHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x00; // 187.5MHz
|
||||
SAFE_MOD = 0x00; //退出安全模式
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : L0_nop_1us(void)
|
||||
* Description : 1us延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void L0_nop_1us(void) // 以uS为单位延时
|
||||
{
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayus(UNIT16 n)
|
||||
* Description : us延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void delayus( UINT16 n ) // 以uS为单位延时
|
||||
{
|
||||
while( n )
|
||||
{
|
||||
L0_nop_1us();
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayms(UNIT16 n)
|
||||
* Description : ms延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void delayms( UINT16 n ) // 以mS为单位延时
|
||||
{
|
||||
while ( n )
|
||||
{
|
||||
delayus(1000);
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0Alter()
|
||||
* Description : CH554串口0引脚映射,串口映射到P0.2和P0.3
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0Alter()
|
||||
{
|
||||
PIN_FUNC |= bUART0_PIN_X; //串口映射到P1.2和P1.3
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mInitSTDIO()
|
||||
* Description : CH554串口0初始化,默认使用T1作UART0的波特率发生器,也可以使用T2
|
||||
作为波特率发生器
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mInitSTDIO( )
|
||||
{
|
||||
UINT32 x;
|
||||
UINT8 x2;
|
||||
|
||||
SM0 = 0; //串口数据位数 8位
|
||||
SM1 = 1; //串口波特率选择 0-设置固定波特率 1-可变波特率 由t1t2产生
|
||||
SM2 = 0; //串口0使用模式1
|
||||
//使用Timer1作为波特率发生器
|
||||
RCLK = 0; //UART0接收时钟
|
||||
TCLK = 0; //UART0发送时钟
|
||||
PCON |= SMOD;
|
||||
x = 10 * FREQ_SYS / UART0_BUAD / 16; //如果更改主频,注意x的值不要溢出
|
||||
x2 = x % 10;
|
||||
x /= 10;
|
||||
if ( x2 >= 5 ) x ++; //四舍五入
|
||||
//PIN_FUNC
|
||||
TMOD = TMOD & ~ bT1_GATE & ~ bT1_CT & ~ MASK_T1_MOD | bT1_M1; //0X20,Timer1作为8位自动重载定时器
|
||||
T2MOD = T2MOD | bTMR_CLK | bT1_CLK; //Timer1时钟选择
|
||||
TH1 = 0-x; //12MHz晶振,buad/12为实际需设置波特率
|
||||
TR1 = 1; //启动定时器1
|
||||
TI = 1;
|
||||
REN = 1; //串口0接收使能
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0RcvByte()
|
||||
* Description : CH554UART0接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART0RcvByte( )
|
||||
{
|
||||
while(RI == 0); //查询接收,中断方式可不用
|
||||
RI = 0;
|
||||
return SBUF;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART0发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(TI ==0);
|
||||
TI = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : UART1Setup()
|
||||
* Description : CH554串口1初始化
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void UART1Setup( )
|
||||
{
|
||||
U1SM0 = 0; //UART1选择8位数据位
|
||||
U1SMOD = 1; //快速模式
|
||||
U1REN = 1; //使能接收
|
||||
SBAUD1 = 0 - FREQ_SYS/16/UART1_BUAD;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1RcvByte()
|
||||
* Description : CH554UART1接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART1RcvByte( )
|
||||
{
|
||||
while(U1RI == 0); //查询接收,中断方式可不用
|
||||
U1RI = 0;
|
||||
return SBUF1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART1发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART1SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF1 = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(U1TI ==0);
|
||||
U1TI = 1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTModeSelect(UINT8 mode)
|
||||
* Description : CH554看门狗模式选择
|
||||
* Input : UINT8 mode
|
||||
0 timer
|
||||
1 watchDog
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WDTModeSelect(UINT8 mode)
|
||||
{
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xaa; //进入安全模式
|
||||
if(mode){
|
||||
GLOBAL_CFG |= bWDOG_EN; //启动看门狗复位
|
||||
}
|
||||
else GLOBAL_CFG &= ~bWDOG_EN; //启动看门狗仅仅作为定时器
|
||||
SAFE_MOD = 0x00; //退出安全模式
|
||||
WDOG_COUNT = 0; //看门狗赋初值
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTFeed(UINT8 tim)
|
||||
* Description : CH554看门狗定时时间设置
|
||||
* Input : UINT8 tim 看门狗复位时间设置
|
||||
00H(6MHz)=2.8s
|
||||
80H(6MHz)=1.4s
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WDTFeed(UINT8 tim)
|
||||
{
|
||||
WDOG_COUNT = tim; //看门狗计数器赋值
|
||||
}
|
@ -1,49 +1,49 @@
|
||||
/* 调试 */
|
||||
/* 提供printf子程序和延时函数 */
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
//定义函数返回值
|
||||
#ifndef SUCCESS
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
#ifndef FAIL
|
||||
#define FAIL 0xFF
|
||||
#endif
|
||||
|
||||
//定义定时器起始
|
||||
#ifndef START
|
||||
#define START 1
|
||||
#endif
|
||||
#ifndef STOP
|
||||
#define STOP 0
|
||||
#endif
|
||||
|
||||
#ifndef DE_PRINTF
|
||||
#define DE_PRINTF 0
|
||||
#endif
|
||||
#define FREQ_SYS 12000000 //系统主频12MHz
|
||||
#ifndef UART0_BUAD
|
||||
#define UART0_BUAD 9600
|
||||
#define UART1_BUAD 9600
|
||||
#endif
|
||||
|
||||
void CfgFsys( ); //CH554时钟选择和配置
|
||||
void L0_nop_1us(void);
|
||||
|
||||
void delayus( UINT16 n ); // 以uS为单位延时
|
||||
void delayms( UINT16 n ); // 以mS为单位延时
|
||||
|
||||
void CH554UART0Alter(); //CH554串口0引脚映射到P0.2/P0.3
|
||||
void mInitSTDIO( ); //T1作为波特率发生器
|
||||
UINT8 CH554UART0RcvByte( ); //CH554 UART0查询方式接收一个字节
|
||||
void CH554UART0SendByte(UINT8 SendDat); //CH554UART0发送一个字节
|
||||
|
||||
void UART1Setup( ); //
|
||||
UINT8 CH554UART1RcvByte( ); //CH554 UART1查询方式接收一个字节
|
||||
void CH554UART1SendByte(UINT8 SendDat); //CH554UART1发送一个字节
|
||||
|
||||
void WDTModeSelect(UINT8 mode); //CH554看门狗模式设置
|
||||
void WDTFeed(UINT8 tim); //CH554看门狗喂狗
|
||||
#endif
|
||||
/* 调试 */
|
||||
/* 提供printf子程序和延时函数 */
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
//定义函数返回值
|
||||
#ifndef SUCCESS
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
#ifndef FAIL
|
||||
#define FAIL 0xFF
|
||||
#endif
|
||||
|
||||
//定义定时器起始
|
||||
#ifndef START
|
||||
#define START 1
|
||||
#endif
|
||||
#ifndef STOP
|
||||
#define STOP 0
|
||||
#endif
|
||||
|
||||
#ifndef DE_PRINTF
|
||||
#define DE_PRINTF 0
|
||||
#endif
|
||||
#define FREQ_SYS 12000000 //系统主频12MHz
|
||||
#ifndef UART0_BUAD
|
||||
#define UART0_BUAD 9600
|
||||
#define UART1_BUAD 9600
|
||||
#endif
|
||||
|
||||
void CfgFsys( ); //CH554时钟选择和配置
|
||||
void L0_nop_1us(void);
|
||||
|
||||
void delayus( UINT16 n ); // 以uS为单位延时
|
||||
void delayms( UINT16 n ); // 以mS为单位延时
|
||||
|
||||
void CH554UART0Alter(); //CH554串口0引脚映射到P0.2/P0.3
|
||||
void mInitSTDIO( ); //T1作为波特率发生器
|
||||
UINT8 CH554UART0RcvByte( ); //CH554 UART0查询方式接收一个字节
|
||||
void CH554UART0SendByte(UINT8 SendDat); //CH554UART0发送一个字节
|
||||
|
||||
void UART1Setup( ); //
|
||||
UINT8 CH554UART1RcvByte( ); //CH554 UART1查询方式接收一个字节
|
||||
void CH554UART1SendByte(UINT8 SendDat); //CH554UART1发送一个字节
|
||||
|
||||
void WDTModeSelect(UINT8 mode); //CH554看门狗模式设置
|
||||
void WDTFeed(UINT8 tim); //CH554看门狗喂狗
|
||||
#endif
|
@ -1,347 +1,347 @@
|
||||
|
||||
#include "CH554.h"
|
||||
#include "Debug.h"
|
||||
#include "font.h"
|
||||
//#include "sys.h"
|
||||
|
||||
u8 code image[]={ /* 0X00,0X10,0X28,0X00,0X28,0X00,0X01,0X1B,*/
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,
|
||||
0XBA,0XD6,0XB6,0XB5,0XF3,0X9C,0XB2,0X94,0XB3,0X9C,0XB2,0X94,0X34,0XA5,0XF7,0XBD,
|
||||
0XFB,0XDE,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0XFB,0XDE,0XF3,0X9C,0XCB,0X5A,
|
||||
0XC7,0X39,0X04,0X21,0X82,0X10,0X42,0X10,0X42,0X10,0X41,0X08,0X83,0X18,0X45,0X29,
|
||||
0XC7,0X39,0X0C,0X63,0X75,0XAD,0X3C,0XE7,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0X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XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0XB2,0X8C,0X41,0X08,
|
||||
0XC7,0X39,0X08,0X42,0X49,0X4A,0X49,0X4A,0X8A,0X52,0X8A,0X52,0X4A,0X4A,0XD0,0X7B,
|
||||
0X7A,0XC6,0X7B,0XBE,0X90,0X6B,0XC9,0X39,0X88,0X31,0XC9,0X39,0XB3,0X84,0XBB,0XC6,
|
||||
0XF8,0XB5,0XCC,0X5A,0X86,0X31,0XC7,0X39,0XC7,0X39,0X86,0X31,0X45,0X29,0X45,0X29,
|
||||
0XC4,0X20,0X41,0X08,0X30,0X84,0X3C,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3C,0XE7,0X8A,0X4A,0XC3,0X10,
|
||||
0XC7,0X39,0X08,0X42,0X49,0X4A,0X49,0X4A,0X4A,0X4A,0X4A,0X42,0X09,0X3A,0X08,0X4A,
|
||||
0X09,0X6B,0X49,0X7B,0XC6,0X7A,0X05,0X83,0X46,0X83,0XC5,0X7A,0XC6,0X72,0X09,0X7B,
|
||||
0X48,0X5A,0X87,0X31,0X88,0X21,0X88,0X29,0X86,0X31,0X86,0X31,0X45,0X29,0X45,0X29,
|
||||
0X04,0X21,0X41,0X08,0X4A,0X4A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF7,0XC5,0X82,0X50,0X05,0X41,
|
||||
0XC7,0X29,0X08,0X42,0X49,0X4A,0X4A,0X42,0X49,0X4A,0X09,0X7B,0X88,0X9B,0XC6,0XB3,
|
||||
0X21,0XD4,0XA0,0XDC,0XE1,0XE4,0X61,0XED,0X61,0XED,0X21,0XED,0XA0,0XE4,0X20,0XDC,
|
||||
0X80,0XCB,0X43,0XAB,0XC4,0X82,0X06,0X5A,0X47,0X21,0X46,0X29,0X45,0X29,0X04,0X29,
|
||||
0X04,0X19,0X82,0X10,0X82,0X18,0XF3,0X9C,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0X4D,0X93,0X00,0XA0,0X82,0XB8,
|
||||
0XC7,0X31,0X09,0X32,0X49,0X4A,0X86,0X7A,0X43,0XC3,0X6B,0XED,0XF4,0XF6,0XEB,0XFD,
|
||||
0X20,0XFD,0X20,0XFD,0X60,0XFD,0XA0,0XFD,0XA0,0XFD,0X60,0XFD,0X60,0XFD,0X20,0XFD,
|
||||
0XE0,0XFC,0XA0,0XFC,0X60,0XF4,0XC1,0XDB,0X83,0X9A,0XC5,0X49,0X45,0X29,0X04,0X19,
|
||||
0XC4,0X20,0X82,0X38,0X00,0X50,0XCB,0X6A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XEE,0X04,0XA1,0X00,0XC0,0X00,0XF0,
|
||||
0XC3,0XA0,0XC8,0X41,0X49,0X42,0X05,0X9B,0X20,0XFC,0XA4,0XFC,0X69,0XFD,0XE8,0XFD,
|
||||
0X63,0XFD,0X20,0XFD,0X60,0XFD,0X60,0XFD,0X60,0XFD,0X20,0XFD,0X20,0XFD,0XE0,0XFC,
|
||||
0XE0,0XFC,0XA0,0XFC,0X60,0XFC,0X20,0XFC,0X41,0XD3,0XC5,0X49,0X45,0X19,0XC4,0X38,
|
||||
0X82,0X68,0X41,0X88,0X00,0X70,0X49,0X5A,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XF6,0X82,0XC0,0X00,0XD0,0X86,0XC1,
|
||||
0X46,0XF1,0X41,0XC8,0X45,0X79,0X89,0X52,0X88,0X62,0X86,0X6A,0XC6,0X7A,0XC4,0XBB,
|
||||
0XE1,0XFC,0X60,0XFD,0X60,0XFD,0XA0,0XFD,0XA0,0XFD,0X60,0XFD,0X60,0XFD,0XE0,0XFC,
|
||||
0X60,0XE4,0X03,0X93,0X84,0X72,0X44,0X6A,0XC5,0X41,0X45,0X29,0XC3,0X58,0X41,0XA8,
|
||||
0X40,0X98,0X00,0XB0,0X00,0X60,0X0C,0X6B,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0XCE,0X83,0X82,0X88,0X00,0XF8,0XC4,0XD8,
|
||||
0X0C,0XF3,0X8A,0XFA,0X82,0XE8,0X82,0XB0,0X45,0X69,0XC7,0X51,0X08,0X42,0X08,0X3A,
|
||||
0X86,0X5A,0X83,0X9B,0XA2,0XBC,0X22,0XCD,0X21,0XCD,0XA1,0XC4,0X22,0XB4,0XC4,0X7A,
|
||||
0X06,0X3A,0X86,0X29,0X45,0X29,0X05,0X31,0XC4,0X50,0X41,0X90,0X00,0XC0,0X00,0XA8,
|
||||
0X00,0XA0,0X00,0XA8,0X00,0X30,0X4A,0X4A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0X8E,0X73,0XC3,0X18,0X05,0X39,0X82,0XA8,0X00,0XF8,
|
||||
0XC3,0XF8,0X4D,0XFB,0X4D,0XFB,0XC7,0XF9,0XC3,0XF0,0X82,0XD8,0XC3,0XB0,0X04,0X81,
|
||||
0X45,0X61,0X46,0X51,0X86,0X49,0X86,0X49,0X46,0X41,0X45,0X41,0X45,0X41,0X45,0X41,
|
||||
0X05,0X49,0X04,0X61,0X82,0X90,0X41,0XB0,0X00,0XD0,0X00,0XC8,0X00,0XA8,0X00,0XA8,
|
||||
0X00,0XB8,0X41,0X58,0X82,0X10,0X82,0X10,0XB2,0X94,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XBE,0XF7,0XCF,0X7B,0X82,0X10,0X04,0X21,0X86,0X29,0X86,0X41,0X04,0X99,
|
||||
0X40,0XE8,0X41,0XF8,0X86,0XF9,0XCB,0XFA,0X49,0XFA,0X82,0XF8,0X00,0XF8,0X00,0XF0,
|
||||
0X00,0XE8,0X41,0XD8,0X41,0XD0,0X41,0XC0,0X41,0XC0,0X41,0XC0,0X41,0XC0,0X41,0XC8,
|
||||
0X00,0XD0,0X00,0XE0,0X00,0XE0,0X00,0XD8,0X00,0XD0,0X00,0XB8,0X00,0XA8,0X41,0X88,
|
||||
0X82,0X48,0X82,0X10,0X82,0X10,0X00,0X00,0X45,0X29,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,
|
||||
0XBE,0XF7,0XF3,0X9C,0X82,0X10,0XC3,0X18,0X45,0X29,0X86,0X31,0XC7,0X31,0X30,0X7C,
|
||||
0XF3,0XDC,0X86,0XE1,0X00,0XF0,0X00,0XF8,0X41,0XF8,0X41,0XF8,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XE8,0X00,0XE0,0X00,0XE0,0X00,0XD8,0X00,0XC8,0X41,0XA0,0X8A,0X9A,0X0C,0X63,
|
||||
0X04,0X11,0X82,0X10,0X82,0X10,0X41,0X08,0X00,0X00,0X4D,0X6B,0X7D,0XEF,0XFF,0XFF,
|
||||
0XFB,0XDE,0X08,0X42,0X42,0X10,0X45,0X29,0X86,0X31,0X86,0X31,0X49,0X4A,0X38,0XBE,
|
||||
0XFF,0XFF,0X38,0XD6,0X86,0XA9,0X00,0XC8,0X00,0XE0,0X00,0XF0,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF0,0X00,0XF0,
|
||||
0X00,0XE8,0X00,0XE0,0X00,0XD0,0XC3,0X98,0X8A,0X8A,0XB2,0XA4,0XBA,0XC6,0XF7,0XB5,
|
||||
0X08,0X42,0X41,0X08,0X82,0X10,0X41,0X08,0X00,0X00,0X45,0X29,0XF7,0XBD,0XFF,0XFF,
|
||||
0X71,0X8C,0X41,0X08,0X04,0X21,0X45,0X29,0X86,0X31,0X86,0X31,0X0C,0X63,0X3C,0XE7,
|
||||
0XFF,0XFF,0X79,0XD6,0X46,0XB9,0X00,0XE0,0X42,0XC8,0X82,0XA8,0X82,0XB0,0X41,0XD8,
|
||||
0X82,0XE8,0X82,0XF0,0X41,0XE8,0X41,0XE8,0X41,0XE8,0X41,0XF0,0X41,0XE8,0X41,0XD8,
|
||||
0X04,0XC1,0X08,0X92,0X4D,0X8B,0X34,0XA5,0XFB,0XC6,0XFB,0XD6,0XBA,0XCE,0X3C,0XE7,
|
||||
0X30,0X84,0XC3,0X18,0X41,0X08,0X41,0X08,0X00,0X00,0X41,0X08,0XCF,0X7B,0X7D,0XEF,
|
||||
0X49,0X4A,0X00,0X00,0X04,0X21,0X45,0X29,0X46,0X31,0X86,0X31,0X30,0X84,0XFF,0XFF,
|
||||
0XFF,0XF7,0XF7,0XDD,0X09,0XDA,0X83,0XF8,0X01,0XF0,0X42,0XC0,0X82,0X98,0X49,0X9A,
|
||||
0XF3,0XB4,0XF3,0XCC,0X71,0XBC,0X8E,0XBB,0X8E,0XBB,0X30,0XBC,0X71,0XBC,0XF3,0XBC,
|
||||
0XB6,0XBD,0XFB,0XCE,0XBE,0XE7,0X7D,0XE7,0X3B,0XDF,0XBA,0XD6,0X79,0XCE,0XFB,0XDE,
|
||||
0X75,0XAD,0X86,0X31,0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00,0X49,0X4A,0XFB,0XDE,
|
||||
0X04,0X21,0X41,0X08,0X04,0X21,0X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||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x10,0x80,0x01,0x0C,0xF0,0xFF,0xFF,0x0F,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0xF0,0xFF,0xFF,0x07,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,/*"ヨミ",0*/
|
||||
/* (32 X 32 , ?? )*/
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,
|
||||
0x00,0xFF,0xFF,0x01,0x00,0x03,0x80,0x01,0x00,0x03,0x80,0x01,0x00,0xFF,0xFF,0x01,
|
||||
0x00,0x03,0x80,0x01,0x00,0x03,0x80,0x01,0x00,0xFF,0xFF,0x01,0x00,0x81,0x81,0x00,
|
||||
0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x1C,0xFC,0xFF,0xFF,0x3F,0x00,0x00,0x40,0x00,
|
||||
0x00,0x03,0xC0,0x01,0x00,0xFF,0xFF,0x01,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x00,0x03,0xC0,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x41,0x00,0x00,0x04,0x01,0x00,
|
||||
0x00,0x0E,0x71,0x00,0x00,0x07,0x81,0x01,0x80,0x01,0x01,0x07,0x60,0x00,0x01,0x0E,
|
||||
0x18,0x98,0x01,0x1C,0x04,0xE0,0x01,0x18,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,/*"セー",1*/
|
||||
/* (32 X 32 , ?? )*/
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xF0,0xFF,0xFF,0x1F,
|
||||
0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x10,0x0C,0x30,0xFE,0x3F,0x0C,
|
||||
0x30,0x04,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,
|
||||
0x30,0x00,0xC0,0x0C,0xF0,0xFF,0xFF,0x0D,0x30,0x30,0x06,0x0E,0x30,0x30,0x06,0x0C,
|
||||
0x30,0x10,0x06,0x0C,0x30,0x10,0x06,0x0C,0x30,0x10,0x06,0x0C,0x30,0x18,0x86,0x0C,
|
||||
0x30,0x18,0x86,0x0C,0x30,0x08,0x06,0x0D,0x30,0x0C,0x86,0x0D,0x30,0x06,0xEE,0x0F,
|
||||
0x30,0x02,0xFC,0x0D,0x30,0x01,0x00,0x0C,0xF0,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,
|
||||
0xF0,0xFF,0xFF,0x0F,0x30,0x00,0x00,0x0C,0x10,0x00,0x00,0x04,0x00,0x00,0x00,0x00,/*"ヤー",2*/
|
||||
};
|
||||
u8 code asc2_1608[1520]={
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x48,0x6C,0x24,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x24,0x24,0x24,0x7F,0x12,0x12,0x12,0x7F,0x12,0x12,0x12,0x00,0x00,
|
||||
0x00,0x00,0x08,0x1C,0x2A,0x2A,0x0A,0x0C,0x18,0x28,0x28,0x2A,0x2A,0x1C,0x08,0x08,
|
||||
0x00,0x00,0x00,0x22,0x25,0x15,0x15,0x15,0x2A,0x58,0x54,0x54,0x54,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0C,0x12,0x12,0x12,0x0A,0x76,0x25,0x29,0x11,0x91,0x6E,0x00,0x00,
|
||||
0x00,0x06,0x06,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00,
|
||||
0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00,
|
||||
0x00,0x00,0x00,0x00,0x08,0x08,0x6B,0x1C,0x1C,0x6B,0x08,0x08,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x08,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x04,0x03,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,
|
||||
0x00,0x00,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00,
|
||||
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x20,0x20,0x10,0x08,0x04,0x42,0x7E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x20,0x18,0x20,0x40,0x40,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x20,0x30,0x28,0x24,0x24,0x22,0x22,0x7E,0x20,0x20,0x78,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x02,0x02,0x02,0x1A,0x26,0x40,0x40,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x38,0x24,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x22,0x22,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x64,0x58,0x40,0x40,0x24,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x04,
|
||||
0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x46,0x40,0x20,0x10,0x10,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x5A,0x55,0x55,0x55,0x55,0x2D,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x08,0x18,0x14,0x14,0x24,0x3C,0x22,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x1E,0x22,0x42,0x42,0x42,0x22,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x42,0x42,0x01,0x01,0x01,0x01,0x01,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1F,0x22,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x12,0x12,0x1E,0x12,0x12,0x02,0x42,0x42,0x3F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x12,0x12,0x1E,0x12,0x12,0x02,0x02,0x02,0x07,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x22,0x22,0x01,0x01,0x01,0x71,0x21,0x22,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x0F,
|
||||
0x00,0x00,0x00,0x77,0x22,0x12,0x0A,0x0E,0x0A,0x12,0x12,0x22,0x22,0x77,0x00,0x00,
|
||||
0x00,0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x42,0x7F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x77,0x36,0x36,0x36,0x36,0x2A,0x2A,0x2A,0x2A,0x2A,0x6B,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE3,0x46,0x46,0x4A,0x4A,0x52,0x52,0x52,0x62,0x62,0x47,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x42,0x3E,0x02,0x02,0x02,0x02,0x07,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x41,0x4D,0x53,0x32,0x1C,0x60,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x3E,0x12,0x12,0x22,0x22,0x42,0xC7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x42,0x42,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7F,0x49,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x22,0x24,0x24,0x14,0x14,0x18,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x6B,0x49,0x49,0x49,0x49,0x55,0x55,0x36,0x22,0x22,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x77,0x22,0x22,0x14,0x14,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x21,0x20,0x10,0x10,0x08,0x04,0x04,0x42,0x42,0x3F,0x00,0x00,
|
||||
0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00,
|
||||
0x00,0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40,
|
||||
0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00,
|
||||
0x00,0x38,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
|
||||
0x00,0x06,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x78,0x44,0x42,0x42,0xFC,0x00,0x00,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x26,0x1A,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x02,0x02,0x02,0x44,0x38,0x00,0x00,
|
||||
0x00,0x00,0x00,0x60,0x40,0x40,0x40,0x78,0x44,0x42,0x42,0x42,0x64,0xD8,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x02,0x02,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xF0,0x88,0x08,0x08,0x7E,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x22,0x22,0x1C,0x02,0x3C,0x42,0x42,0x3C,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x3A,0x46,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x1E,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x72,0x12,0x0A,0x16,0x12,0x22,0x77,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x92,0x92,0x92,0x92,0x92,0xB7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x46,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0x26,0x42,0x42,0x42,0x22,0x1E,0x02,0x07,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x44,0x78,0x40,0xE0,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x4C,0x04,0x04,0x04,0x04,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x42,0x02,0x3C,0x40,0x42,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x42,0x42,0x42,0x42,0x62,0xDC,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x14,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEB,0x49,0x49,0x55,0x55,0x22,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x24,0x18,0x18,0x18,0x24,0x6E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x14,0x18,0x08,0x08,0x07,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x22,0x10,0x08,0x08,0x44,0x7E,0x00,0x00,
|
||||
0x00,0xC0,0x20,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0xC0,0x00,
|
||||
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
|
||||
0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x06,0x00,
|
||||
0x0C,0x32,0xC2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CH554.h"
|
||||
#include "Debug.h"
|
||||
#include "font.h"
|
||||
//#include "sys.h"
|
||||
|
||||
u8 code image[]={ /* 0X00,0X10,0X28,0X00,0X28,0X00,0X01,0X1B,*/
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,
|
||||
0XBA,0XD6,0XB6,0XB5,0XF3,0X9C,0XB2,0X94,0XB3,0X9C,0XB2,0X94,0X34,0XA5,0XF7,0XBD,
|
||||
0XFB,0XDE,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,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X18,0X45,0X29,0XC7,0X39,
|
||||
0X08,0X42,0X08,0X42,0X08,0X42,0X08,0X42,0X08,0X42,0X08,0X42,0XC7,0X39,0XC7,0X39,
|
||||
0X86,0X31,0X86,0X31,0X04,0X21,0X41,0X08,0X82,0X10,0XCB,0X5A,0XBA,0XD6,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFB,0XDE,0XCB,0X5A,0X82,0X10,0X45,0X29,0XC7,0X39,0X08,0X42,0X08,0X42,
|
||||
0X09,0X4A,0X49,0X4A,0X49,0X4A,0X49,0X4A,0X49,0X4A,0X49,0X4A,0X08,0X42,0XC7,0X39,
|
||||
0XC7,0X39,0XC7,0X39,0X86,0X31,0X45,0X29,0X83,0X18,0X00,0X00,0XC8,0X41,0X38,0XC6,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0X7D,0XEF,0X8E,0X73,0X82,0X10,0X45,0X29,0XC7,0X39,0X08,0X42,0X09,0X4A,0X8A,0X52,
|
||||
0X30,0X84,0XCF,0X7B,0X8A,0X52,0X49,0X4A,0X4A,0X52,0X49,0X4A,0XCB,0X5A,0XCF,0X7B,
|
||||
0X0C,0X63,0X08,0X42,0XC7,0X39,0X86,0X31,0X45,0X29,0XC3,0X18,0X00,0X00,0X49,0X4A,
|
||||
0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF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,0XC6,0X72,0X09,0X7B,
|
||||
0X48,0X5A,0X87,0X31,0X88,0X21,0X88,0X29,0X86,0X31,0X86,0X31,0X45,0X29,0X45,0X29,
|
||||
0X04,0X21,0X41,0X08,0X4A,0X4A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF7,0XC5,0X82,0X50,0X05,0X41,
|
||||
0XC7,0X29,0X08,0X42,0X49,0X4A,0X4A,0X42,0X49,0X4A,0X09,0X7B,0X88,0X9B,0XC6,0XB3,
|
||||
0X21,0XD4,0XA0,0XDC,0XE1,0XE4,0X61,0XED,0X61,0XED,0X21,0XED,0XA0,0XE4,0X20,0XDC,
|
||||
0X80,0XCB,0X43,0XAB,0XC4,0X82,0X06,0X5A,0X47,0X21,0X46,0X29,0X45,0X29,0X04,0X29,
|
||||
0X04,0X19,0X82,0X10,0X82,0X18,0XF3,0X9C,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0X4D,0X93,0X00,0XA0,0X82,0XB8,
|
||||
0XC7,0X31,0X09,0X32,0X49,0X4A,0X86,0X7A,0X43,0XC3,0X6B,0XED,0XF4,0XF6,0XEB,0XFD,
|
||||
0X20,0XFD,0X20,0XFD,0X60,0XFD,0XA0,0XFD,0XA0,0XFD,0X60,0XFD,0X60,0XFD,0X20,0XFD,
|
||||
0XE0,0XFC,0XA0,0XFC,0X60,0XF4,0XC1,0XDB,0X83,0X9A,0XC5,0X49,0X45,0X29,0X04,0X19,
|
||||
0XC4,0X20,0X82,0X38,0X00,0X50,0XCB,0X6A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XEE,0X04,0XA1,0X00,0XC0,0X00,0XF0,
|
||||
0XC3,0XA0,0XC8,0X41,0X49,0X42,0X05,0X9B,0X20,0XFC,0XA4,0XFC,0X69,0XFD,0XE8,0XFD,
|
||||
0X63,0XFD,0X20,0XFD,0X60,0XFD,0X60,0XFD,0X60,0XFD,0X20,0XFD,0X20,0XFD,0XE0,0XFC,
|
||||
0XE0,0XFC,0XA0,0XFC,0X60,0XFC,0X20,0XFC,0X41,0XD3,0XC5,0X49,0X45,0X19,0XC4,0X38,
|
||||
0X82,0X68,0X41,0X88,0X00,0X70,0X49,0X5A,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XF6,0X82,0XC0,0X00,0XD0,0X86,0XC1,
|
||||
0X46,0XF1,0X41,0XC8,0X45,0X79,0X89,0X52,0X88,0X62,0X86,0X6A,0XC6,0X7A,0XC4,0XBB,
|
||||
0XE1,0XFC,0X60,0XFD,0X60,0XFD,0XA0,0XFD,0XA0,0XFD,0X60,0XFD,0X60,0XFD,0XE0,0XFC,
|
||||
0X60,0XE4,0X03,0X93,0X84,0X72,0X44,0X6A,0XC5,0X41,0X45,0X29,0XC3,0X58,0X41,0XA8,
|
||||
0X40,0X98,0X00,0XB0,0X00,0X60,0X0C,0X6B,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0XCE,0X83,0X82,0X88,0X00,0XF8,0XC4,0XD8,
|
||||
0X0C,0XF3,0X8A,0XFA,0X82,0XE8,0X82,0XB0,0X45,0X69,0XC7,0X51,0X08,0X42,0X08,0X3A,
|
||||
0X86,0X5A,0X83,0X9B,0XA2,0XBC,0X22,0XCD,0X21,0XCD,0XA1,0XC4,0X22,0XB4,0XC4,0X7A,
|
||||
0X06,0X3A,0X86,0X29,0X45,0X29,0X05,0X31,0XC4,0X50,0X41,0X90,0X00,0XC0,0X00,0XA8,
|
||||
0X00,0XA0,0X00,0XA8,0X00,0X30,0X4A,0X4A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0X8E,0X73,0XC3,0X18,0X05,0X39,0X82,0XA8,0X00,0XF8,
|
||||
0XC3,0XF8,0X4D,0XFB,0X4D,0XFB,0XC7,0XF9,0XC3,0XF0,0X82,0XD8,0XC3,0XB0,0X04,0X81,
|
||||
0X45,0X61,0X46,0X51,0X86,0X49,0X86,0X49,0X46,0X41,0X45,0X41,0X45,0X41,0X45,0X41,
|
||||
0X05,0X49,0X04,0X61,0X82,0X90,0X41,0XB0,0X00,0XD0,0X00,0XC8,0X00,0XA8,0X00,0XA8,
|
||||
0X00,0XB8,0X41,0X58,0X82,0X10,0X82,0X10,0XB2,0X94,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XBE,0XF7,0XCF,0X7B,0X82,0X10,0X04,0X21,0X86,0X29,0X86,0X41,0X04,0X99,
|
||||
0X40,0XE8,0X41,0XF8,0X86,0XF9,0XCB,0XFA,0X49,0XFA,0X82,0XF8,0X00,0XF8,0X00,0XF0,
|
||||
0X00,0XE8,0X41,0XD8,0X41,0XD0,0X41,0XC0,0X41,0XC0,0X41,0XC0,0X41,0XC0,0X41,0XC8,
|
||||
0X00,0XD0,0X00,0XE0,0X00,0XE0,0X00,0XD8,0X00,0XD0,0X00,0XB8,0X00,0XA8,0X41,0X88,
|
||||
0X82,0X48,0X82,0X10,0X82,0X10,0X00,0X00,0X45,0X29,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,
|
||||
0XBE,0XF7,0XF3,0X9C,0X82,0X10,0XC3,0X18,0X45,0X29,0X86,0X31,0XC7,0X31,0X30,0X7C,
|
||||
0XF3,0XDC,0X86,0XE1,0X00,0XF0,0X00,0XF8,0X41,0XF8,0X41,0XF8,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XE8,0X00,0XE0,0X00,0XE0,0X00,0XD8,0X00,0XC8,0X41,0XA0,0X8A,0X9A,0X0C,0X63,
|
||||
0X04,0X11,0X82,0X10,0X82,0X10,0X41,0X08,0X00,0X00,0X4D,0X6B,0X7D,0XEF,0XFF,0XFF,
|
||||
0XFB,0XDE,0X08,0X42,0X42,0X10,0X45,0X29,0X86,0X31,0X86,0X31,0X49,0X4A,0X38,0XBE,
|
||||
0XFF,0XFF,0X38,0XD6,0X86,0XA9,0X00,0XC8,0X00,0XE0,0X00,0XF0,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF0,0X00,0XF0,
|
||||
0X00,0XE8,0X00,0XE0,0X00,0XD0,0XC3,0X98,0X8A,0X8A,0XB2,0XA4,0XBA,0XC6,0XF7,0XB5,
|
||||
0X08,0X42,0X41,0X08,0X82,0X10,0X41,0X08,0X00,0X00,0X45,0X29,0XF7,0XBD,0XFF,0XFF,
|
||||
0X71,0X8C,0X41,0X08,0X04,0X21,0X45,0X29,0X86,0X31,0X86,0X31,0X0C,0X63,0X3C,0XE7,
|
||||
0XFF,0XFF,0X79,0XD6,0X46,0XB9,0X00,0XE0,0X42,0XC8,0X82,0XA8,0X82,0XB0,0X41,0XD8,
|
||||
0X82,0XE8,0X82,0XF0,0X41,0XE8,0X41,0XE8,0X41,0XE8,0X41,0XF0,0X41,0XE8,0X41,0XD8,
|
||||
0X04,0XC1,0X08,0X92,0X4D,0X8B,0X34,0XA5,0XFB,0XC6,0XFB,0XD6,0XBA,0XCE,0X3C,0XE7,
|
||||
0X30,0X84,0XC3,0X18,0X41,0X08,0X41,0X08,0X00,0X00,0X41,0X08,0XCF,0X7B,0X7D,0XEF,
|
||||
0X49,0X4A,0X00,0X00,0X04,0X21,0X45,0X29,0X46,0X31,0X86,0X31,0X30,0X84,0XFF,0XFF,
|
||||
0XFF,0XF7,0XF7,0XDD,0X09,0XDA,0X83,0XF8,0X01,0XF0,0X42,0XC0,0X82,0X98,0X49,0X9A,
|
||||
0XF3,0XB4,0XF3,0XCC,0X71,0XBC,0X8E,0XBB,0X8E,0XBB,0X30,0XBC,0X71,0XBC,0XF3,0XBC,
|
||||
0XB6,0XBD,0XFB,0XCE,0XBE,0XE7,0X7D,0XE7,0X3B,0XDF,0XBA,0XD6,0X79,0XCE,0XFB,0XDE,
|
||||
0X75,0XAD,0X86,0X31,0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00,0X49,0X4A,0XFB,0XDE,
|
||||
0X04,0X21,0X41,0X08,0X04,0X21,0X45,0X29,0X45,0X29,0X87,0X39,0XB2,0X94,0XFF,0XFF,
|
||||
0XBE,0XF7,0X34,0XDD,0X0C,0XEB,0X09,0XFA,0X00,0XF0,0X01,0XD8,0X00,0XD8,0X8B,0XD2,
|
||||
0X7D,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XBE,0XFF,0X7D,0XEF,0XFB,0XDE,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0XBA,0XD6,
|
||||
0X78,0XC6,0XC7,0X39,0X00,0X00,0X41,0X08,0X00,0X00,0X00,0X00,0XC7,0X39,0X79,0XCE,
|
||||
0X00,0X00,0X82,0X10,0XC3,0X18,0X04,0X21,0X05,0X29,0X86,0X31,0XB3,0X9C,0XFF,0XFF,
|
||||
0XFF,0XF7,0X75,0XDD,0XC7,0XE9,0XC7,0XF9,0X01,0XF8,0X01,0XF0,0X00,0XE8,0X49,0XE2,
|
||||
0XFB,0XEE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,0XFB,0XDE,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0XBA,0XD6,
|
||||
0XB9,0XCE,0X08,0X42,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XC7,0X39,0X38,0XC6,
|
||||
0X00,0X00,0X82,0X10,0X82,0X10,0X04,0X21,0X04,0X21,0X45,0X29,0X30,0X84,0XFF,0XFF,
|
||||
0XFF,0XFF,0X38,0XDE,0XC4,0XD0,0X00,0XF0,0X01,0XF8,0X00,0XF8,0X00,0XF0,0X08,0XD2,
|
||||
0XFB,0XE6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0X79,0XCE,0XBA,0XD6,
|
||||
0X79,0XCE,0XC7,0X39,0X41,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X86,0X31,0X38,0XC6,
|
||||
0X00,0X00,0X00,0X00,0XC3,0X18,0XCB,0X5A,0X86,0X31,0XC3,0X18,0XCB,0X5A,0X7D,0XEF,
|
||||
0XFF,0XFF,0X7D,0XEF,0XCF,0XBB,0XC3,0XB0,0X41,0XD0,0X41,0XD0,0X82,0XB8,0X4D,0XB3,
|
||||
0X7D,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XBE,0XF7,0XBE,0XF7,0X3D,0XEF,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0X79,0XCE,0XFA,0XD6,
|
||||
0XF7,0XBD,0X04,0X21,0X86,0X31,0X04,0X21,0X00,0X00,0X00,0X00,0X86,0X31,0X38,0XC6,
|
||||
0X86,0X31,0XC3,0X18,0XCB,0X5A,0X75,0XAD,0XCF,0X7B,0X41,0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XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3C,0XDF,0X38,0XBE,
|
||||
0X75,0XB5,0X33,0XA5,0X33,0XA5,0XF3,0X9C,0XF3,0X9C,0XF3,0X9C,0XF3,0X94,0XF3,0X9C,
|
||||
0X35,0XA5,0XF8,0XBD,0XFB,0XDE,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7E,0XEF,
|
||||
0XBB,0XD6,0XF8,0XBD,0XB6,0XAD,0X75,0XAD,0X34,0XA5,0X33,0X9D,0X34,0X9D,0X35,0XA5,
|
||||
0XB7,0XAD,0X79,0XC6,0X3C,0XE7,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
};
|
||||
|
||||
u8 code hanzi[]={
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x10,0x80,0x01,0x0C,0xF0,0xFF,0xFF,0x0F,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0xF0,0xFF,0xFF,0x07,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,/*"ヨミ",0*/
|
||||
/* (32 X 32 , ?? )*/
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,
|
||||
0x00,0xFF,0xFF,0x01,0x00,0x03,0x80,0x01,0x00,0x03,0x80,0x01,0x00,0xFF,0xFF,0x01,
|
||||
0x00,0x03,0x80,0x01,0x00,0x03,0x80,0x01,0x00,0xFF,0xFF,0x01,0x00,0x81,0x81,0x00,
|
||||
0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x1C,0xFC,0xFF,0xFF,0x3F,0x00,0x00,0x40,0x00,
|
||||
0x00,0x03,0xC0,0x01,0x00,0xFF,0xFF,0x01,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x00,0x03,0xC0,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x41,0x00,0x00,0x04,0x01,0x00,
|
||||
0x00,0x0E,0x71,0x00,0x00,0x07,0x81,0x01,0x80,0x01,0x01,0x07,0x60,0x00,0x01,0x0E,
|
||||
0x18,0x98,0x01,0x1C,0x04,0xE0,0x01,0x18,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,/*"セー",1*/
|
||||
/* (32 X 32 , ?? )*/
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xF0,0xFF,0xFF,0x1F,
|
||||
0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x10,0x0C,0x30,0xFE,0x3F,0x0C,
|
||||
0x30,0x04,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,
|
||||
0x30,0x00,0xC0,0x0C,0xF0,0xFF,0xFF,0x0D,0x30,0x30,0x06,0x0E,0x30,0x30,0x06,0x0C,
|
||||
0x30,0x10,0x06,0x0C,0x30,0x10,0x06,0x0C,0x30,0x10,0x06,0x0C,0x30,0x18,0x86,0x0C,
|
||||
0x30,0x18,0x86,0x0C,0x30,0x08,0x06,0x0D,0x30,0x0C,0x86,0x0D,0x30,0x06,0xEE,0x0F,
|
||||
0x30,0x02,0xFC,0x0D,0x30,0x01,0x00,0x0C,0xF0,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,
|
||||
0xF0,0xFF,0xFF,0x0F,0x30,0x00,0x00,0x0C,0x10,0x00,0x00,0x04,0x00,0x00,0x00,0x00,/*"ヤー",2*/
|
||||
};
|
||||
u8 code asc2_1608[1520]={
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x48,0x6C,0x24,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x24,0x24,0x24,0x7F,0x12,0x12,0x12,0x7F,0x12,0x12,0x12,0x00,0x00,
|
||||
0x00,0x00,0x08,0x1C,0x2A,0x2A,0x0A,0x0C,0x18,0x28,0x28,0x2A,0x2A,0x1C,0x08,0x08,
|
||||
0x00,0x00,0x00,0x22,0x25,0x15,0x15,0x15,0x2A,0x58,0x54,0x54,0x54,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0C,0x12,0x12,0x12,0x0A,0x76,0x25,0x29,0x11,0x91,0x6E,0x00,0x00,
|
||||
0x00,0x06,0x06,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00,
|
||||
0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00,
|
||||
0x00,0x00,0x00,0x00,0x08,0x08,0x6B,0x1C,0x1C,0x6B,0x08,0x08,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x08,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x04,0x03,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,
|
||||
0x00,0x00,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00,
|
||||
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x20,0x20,0x10,0x08,0x04,0x42,0x7E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x20,0x18,0x20,0x40,0x40,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x20,0x30,0x28,0x24,0x24,0x22,0x22,0x7E,0x20,0x20,0x78,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x02,0x02,0x02,0x1A,0x26,0x40,0x40,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x38,0x24,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x22,0x22,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x64,0x58,0x40,0x40,0x24,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x04,
|
||||
0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x46,0x40,0x20,0x10,0x10,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x5A,0x55,0x55,0x55,0x55,0x2D,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x08,0x18,0x14,0x14,0x24,0x3C,0x22,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x1E,0x22,0x42,0x42,0x42,0x22,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x42,0x42,0x01,0x01,0x01,0x01,0x01,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1F,0x22,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x12,0x12,0x1E,0x12,0x12,0x02,0x42,0x42,0x3F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x12,0x12,0x1E,0x12,0x12,0x02,0x02,0x02,0x07,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x22,0x22,0x01,0x01,0x01,0x71,0x21,0x22,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x0F,
|
||||
0x00,0x00,0x00,0x77,0x22,0x12,0x0A,0x0E,0x0A,0x12,0x12,0x22,0x22,0x77,0x00,0x00,
|
||||
0x00,0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x42,0x7F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x77,0x36,0x36,0x36,0x36,0x2A,0x2A,0x2A,0x2A,0x2A,0x6B,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE3,0x46,0x46,0x4A,0x4A,0x52,0x52,0x52,0x62,0x62,0x47,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x42,0x3E,0x02,0x02,0x02,0x02,0x07,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x41,0x4D,0x53,0x32,0x1C,0x60,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x3E,0x12,0x12,0x22,0x22,0x42,0xC7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x42,0x42,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7F,0x49,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x22,0x24,0x24,0x14,0x14,0x18,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x6B,0x49,0x49,0x49,0x49,0x55,0x55,0x36,0x22,0x22,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x77,0x22,0x22,0x14,0x14,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x21,0x20,0x10,0x10,0x08,0x04,0x04,0x42,0x42,0x3F,0x00,0x00,
|
||||
0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00,
|
||||
0x00,0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40,
|
||||
0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00,
|
||||
0x00,0x38,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
|
||||
0x00,0x06,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x78,0x44,0x42,0x42,0xFC,0x00,0x00,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x26,0x1A,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x02,0x02,0x02,0x44,0x38,0x00,0x00,
|
||||
0x00,0x00,0x00,0x60,0x40,0x40,0x40,0x78,0x44,0x42,0x42,0x42,0x64,0xD8,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x02,0x02,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xF0,0x88,0x08,0x08,0x7E,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x22,0x22,0x1C,0x02,0x3C,0x42,0x42,0x3C,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x3A,0x46,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x1E,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x72,0x12,0x0A,0x16,0x12,0x22,0x77,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x92,0x92,0x92,0x92,0x92,0xB7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x46,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0x26,0x42,0x42,0x42,0x22,0x1E,0x02,0x07,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x44,0x78,0x40,0xE0,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x4C,0x04,0x04,0x04,0x04,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x42,0x02,0x3C,0x40,0x42,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x42,0x42,0x42,0x42,0x62,0xDC,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x14,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEB,0x49,0x49,0x55,0x55,0x22,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x24,0x18,0x18,0x18,0x24,0x6E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x14,0x18,0x08,0x08,0x07,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x22,0x10,0x08,0x08,0x44,0x7E,0x00,0x00,
|
||||
0x00,0xC0,0x20,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0xC0,0x00,
|
||||
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
|
||||
0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x06,0x00,
|
||||
0x0C,0x32,0xC2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
#ifndef __FONT_H
|
||||
#define __FONT_H
|
||||
|
||||
extern unsigned char code image[];
|
||||
extern unsigned char code hanzi[];
|
||||
extern unsigned char code asc2_1608[1520];
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __FONT_H
|
||||
#define __FONT_H
|
||||
|
||||
extern unsigned char code image[];
|
||||
extern unsigned char code hanzi[];
|
||||
extern unsigned char code asc2_1608[1520];
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,118 +1,118 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <intrins.h>
|
||||
|
||||
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
#include "Timer.h"
|
||||
#include "USB.h"
|
||||
#include "GPIO.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
|
||||
******************************************************/
|
||||
|
||||
u8 ref=0;//刷新显示
|
||||
|
||||
void xianshi()//显示信息
|
||||
{
|
||||
u16 lx,ly;
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
showhanzi(10,0,0); //中
|
||||
showhanzi(45,0,1); //景
|
||||
showhanzi(80,0,2); //园
|
||||
LCD_ShowString(10,35,"3.2 TFT SPI 240*320");
|
||||
LCD_ShowString(10,55,"LCD_W:"); LCD_ShowNum(70,55,LCD_W,3);
|
||||
LCD_ShowString(110,55,"LCD_H:");LCD_ShowNum(160,55,LCD_H,3);
|
||||
lx=10;ly=75;
|
||||
}
|
||||
|
||||
void showimage() //显示40*40图片
|
||||
{
|
||||
int i,j,k;
|
||||
//LCD_Clear(WHITE); //清屏
|
||||
//xianshi(); //显示信息
|
||||
for(k=3;k<4;k++)
|
||||
{
|
||||
for(j=0;j<3;j++)
|
||||
{
|
||||
Address_set(40*j,40*k,40*j+39,40*k+39); //坐标设置
|
||||
for(i=0;i<1600;i++)
|
||||
{
|
||||
//LCD_WR_DATA8(image[i*2+1]);
|
||||
//LCD_WR_DATA8(image[i*2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ref=0;
|
||||
}
|
||||
|
||||
void main1()
|
||||
{
|
||||
//Set_All_GPIO_Quasi_Mode; // Define in Function_define.h
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
//Lcd_Init(); //tft初始化
|
||||
while(1)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_REST=0;
|
||||
delayms (200);
|
||||
LCD_CS1=1;
|
||||
LCD_DC=0;
|
||||
LCD_REST=1;
|
||||
delayms (200);
|
||||
|
||||
//delayms (200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
//Set_All_GPIO_Quasi_Mode; // Define in Function_define.h
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
Lcd_Init(); //tft初始化
|
||||
LCD_Clear(WHITE); //清屏
|
||||
while(1)
|
||||
{
|
||||
//Display_Asc_String('6',0,0, "2.4'TFT"); //ASC 16X32点阵
|
||||
//Display_Asc_String('1',0,34, "ASCII_5x7");//ASC 5X7点阵
|
||||
//Display_Asc_String('2',0,45, "ASCII_7x8"); //ASC 7X8点阵
|
||||
//Display_Asc_String('3',0,54, "ASCII_6x12"); //ASC 6X12点阵
|
||||
//Display_Asc_String('4',0,70, "ASCII_8x16"); //ASC 8X16点阵
|
||||
//Display_Asc_String('5',0,90, "AS12x24");//ASC 12X24点阵
|
||||
//Display_Asc_String('6',0,130, "16x32"); //ASC 16X32点阵
|
||||
delayms (2000);
|
||||
LCD_Clear(RED); //清屏
|
||||
//Display_GB2312_String('1',0,0, "专业显示屏");//12x12汉字
|
||||
//Display_GB2312_String('2',0,16, "中景园电子");//15x16汉字
|
||||
//Display_GB2312_String('3',0,40, "中景园电子"); //24x24汉字
|
||||
//Display_GB2312_String('4',16,70, "中景园"); //32x32汉字
|
||||
//showimage(); //显示40*40图片
|
||||
delayms (2000);
|
||||
LCD_Clear(BLUE); //清屏
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <intrins.h>
|
||||
|
||||
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
#include "Timer.h"
|
||||
#include "USB.h"
|
||||
#include "GPIO.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
|
||||
******************************************************/
|
||||
|
||||
u8 ref=0;//刷新显示
|
||||
|
||||
void xianshi()//显示信息
|
||||
{
|
||||
u16 lx,ly;
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
showhanzi(10,0,0); //中
|
||||
showhanzi(45,0,1); //景
|
||||
showhanzi(80,0,2); //园
|
||||
LCD_ShowString(10,35,"3.2 TFT SPI 240*320");
|
||||
LCD_ShowString(10,55,"LCD_W:"); LCD_ShowNum(70,55,LCD_W,3);
|
||||
LCD_ShowString(110,55,"LCD_H:");LCD_ShowNum(160,55,LCD_H,3);
|
||||
lx=10;ly=75;
|
||||
}
|
||||
|
||||
void showimage() //显示40*40图片
|
||||
{
|
||||
int i,j,k;
|
||||
//LCD_Clear(WHITE); //清屏
|
||||
//xianshi(); //显示信息
|
||||
for(k=3;k<4;k++)
|
||||
{
|
||||
for(j=0;j<3;j++)
|
||||
{
|
||||
Address_set(40*j,40*k,40*j+39,40*k+39); //坐标设置
|
||||
for(i=0;i<1600;i++)
|
||||
{
|
||||
//LCD_WR_DATA8(image[i*2+1]);
|
||||
//LCD_WR_DATA8(image[i*2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ref=0;
|
||||
}
|
||||
|
||||
void main1()
|
||||
{
|
||||
//Set_All_GPIO_Quasi_Mode; // Define in Function_define.h
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
//Lcd_Init(); //tft初始化
|
||||
while(1)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_REST=0;
|
||||
delayms (200);
|
||||
LCD_CS1=1;
|
||||
LCD_DC=0;
|
||||
LCD_REST=1;
|
||||
delayms (200);
|
||||
|
||||
//delayms (200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
//Set_All_GPIO_Quasi_Mode; // Define in Function_define.h
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
Lcd_Init(); //tft初始化
|
||||
LCD_Clear(WHITE); //清屏
|
||||
while(1)
|
||||
{
|
||||
//Display_Asc_String('6',0,0, "2.4'TFT"); //ASC 16X32点阵
|
||||
//Display_Asc_String('1',0,34, "ASCII_5x7");//ASC 5X7点阵
|
||||
//Display_Asc_String('2',0,45, "ASCII_7x8"); //ASC 7X8点阵
|
||||
//Display_Asc_String('3',0,54, "ASCII_6x12"); //ASC 6X12点阵
|
||||
//Display_Asc_String('4',0,70, "ASCII_8x16"); //ASC 8X16点阵
|
||||
//Display_Asc_String('5',0,90, "AS12x24");//ASC 12X24点阵
|
||||
//Display_Asc_String('6',0,130, "16x32"); //ASC 16X32点阵
|
||||
delayms (2000);
|
||||
LCD_Clear(RED); //清屏
|
||||
//Display_GB2312_String('1',0,0, "专业显示屏");//12x12汉字
|
||||
//Display_GB2312_String('2',0,16, "中景园电子");//15x16汉字
|
||||
//Display_GB2312_String('3',0,40, "中景园电子"); //24x24汉字
|
||||
//Display_GB2312_String('4',16,70, "中景园"); //32x32汉字
|
||||
//showimage(); //显示40*40图片
|
||||
delayms (2000);
|
||||
LCD_Clear(BLUE); //清屏
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
jump_to_bl.bin: jump_to_bl.ihx
|
||||
objcopy -I ihex -O binary jump_to_bl.ihx jump_to_bl.bin
|
||||
|
||||
jump_to_bl.ihx: jump_to_bl.c
|
||||
sdcc -I. -mmcs51 --model-small --opt-code-speed jump_to_bl.c
|
||||
|
||||
clean:
|
||||
rm -f *.asm *.ihx *.lk *.lst *.bin *.map *.mem *.rel *.rst *.sym
|
||||
|
||||
flash: jump_to_bl.bin
|
||||
wchisptool -f jump_to_bl.bin -g
|
||||
jump_to_bl.bin: jump_to_bl.ihx
|
||||
objcopy -I ihex -O binary jump_to_bl.ihx jump_to_bl.bin
|
||||
|
||||
jump_to_bl.ihx: jump_to_bl.c
|
||||
sdcc -I. -mmcs51 --model-small --opt-code-speed jump_to_bl.c
|
||||
|
||||
clean:
|
||||
rm -f *.asm *.ihx *.lk *.lst *.bin *.map *.mem *.rel *.rst *.sym
|
||||
|
||||
flash: jump_to_bl.bin
|
||||
wchisptool -f jump_to_bl.bin -g
|
@ -1,15 +1,15 @@
|
||||
#include <8051.h>
|
||||
|
||||
#define BOOT_ADDR 0x3800
|
||||
|
||||
/* This program just execute bootloader rom directly */
|
||||
|
||||
void main( void )
|
||||
{
|
||||
EA = 0;/* Disable all interrupts */
|
||||
|
||||
__asm
|
||||
LJMP BOOT_ADDR /* Jump to bootloader */
|
||||
__endasm;
|
||||
while(1);
|
||||
}
|
||||
#include <8051.h>
|
||||
|
||||
#define BOOT_ADDR 0x3800
|
||||
|
||||
/* This program just execute bootloader rom directly */
|
||||
|
||||
void main( void )
|
||||
{
|
||||
EA = 0;/* Disable all interrupts */
|
||||
|
||||
__asm
|
||||
LJMP BOOT_ADDR /* Jump to bootloader */
|
||||
__endasm;
|
||||
while(1);
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
si5351.bin: si5351.ihx
|
||||
objcopy -I ihex -O binary si5351.ihx si5351.bin
|
||||
|
||||
si5351.ihx: si5351.c i2c.c si5351.h
|
||||
sdcc -I. -mmcs51 --model-small --xram-size 1024 --opt-code-speed -c i2c.c
|
||||
sdcc -I. -mmcs51 --model-small --xram-size 1024 --opt-code-speed si5351.c i2c.rel
|
||||
|
||||
clean:
|
||||
rm -f *.asm *.ihx *.lk *.lst *.bin *.map *.mem *.rel *.rst *.sym
|
||||
|
||||
flash: si5351.bin
|
||||
wchisptool -f si5351.bin -g
|
||||
si5351.bin: si5351.ihx
|
||||
objcopy -I ihex -O binary si5351.ihx si5351.bin
|
||||
|
||||
si5351.ihx: si5351.c i2c.c si5351.h
|
||||
sdcc -I. -mmcs51 --model-small --xram-size 1024 --opt-code-speed -c i2c.c
|
||||
sdcc -I. -mmcs51 --model-small --xram-size 1024 --opt-code-speed si5351.c i2c.rel
|
||||
|
||||
clean:
|
||||
rm -f *.asm *.ihx *.lk *.lst *.bin *.map *.mem *.rel *.rst *.sym
|
||||
|
||||
flash: si5351.bin
|
||||
wchisptool -f si5351.bin -g
|
@ -1,100 +1,100 @@
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
#include "i2c.h"
|
||||
|
||||
#define I2C_SDAT P3_4
|
||||
#define I2C_SCLK P3_3
|
||||
|
||||
|
||||
|
||||
void i2c_init()
|
||||
{ /* GPIO port initial */
|
||||
I2C_SDAT = 1;
|
||||
I2C_SCLK = 1;
|
||||
}
|
||||
|
||||
void i2c_delay()
|
||||
{
|
||||
volatile char i = 20;
|
||||
while(i--);
|
||||
}
|
||||
|
||||
void i2c_start()
|
||||
{
|
||||
I2C_SDAT = 0;
|
||||
i2c_delay();
|
||||
|
||||
I2C_SCLK = 0;
|
||||
i2c_delay();
|
||||
}
|
||||
|
||||
void i2c_stop()
|
||||
{
|
||||
I2C_SDAT = 0;
|
||||
I2C_SCLK = 1;
|
||||
i2c_delay();
|
||||
|
||||
I2C_SDAT = 1;
|
||||
i2c_delay();
|
||||
}
|
||||
|
||||
void i2c_write(uint8_t data)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
data <<= 1;
|
||||
I2C_SDAT = CY;
|
||||
|
||||
I2C_SCLK = 1;
|
||||
i2c_delay();
|
||||
|
||||
I2C_SCLK = 0;
|
||||
i2c_delay();
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t i2c_read()
|
||||
{
|
||||
int i;
|
||||
uint8_t ret = 0;
|
||||
|
||||
I2C_SDAT = 1;
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
ret <<= 1;
|
||||
I2C_SCLK = 1;
|
||||
i2c_delay();
|
||||
|
||||
if(I2C_SDAT)
|
||||
ret |= 0x01;
|
||||
|
||||
I2C_SCLK = 0;
|
||||
i2c_delay();
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool i2c_read_ack()
|
||||
{
|
||||
bool status;
|
||||
|
||||
I2C_SDAT = 1;
|
||||
|
||||
I2C_SCLK = 1;
|
||||
i2c_delay();
|
||||
|
||||
status = I2C_SDAT;
|
||||
|
||||
I2C_SCLK = 0;
|
||||
i2c_delay();
|
||||
|
||||
return !status;
|
||||
}
|
||||
|
||||
bool i2c_read_nak()
|
||||
{
|
||||
return !i2c_read_ack();
|
||||
}
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
#include "i2c.h"
|
||||
|
||||
#define I2C_SDAT P3_4
|
||||
#define I2C_SCLK P3_3
|
||||
|
||||
|
||||
|
||||
void i2c_init()
|
||||
{ /* GPIO port initial */
|
||||
I2C_SDAT = 1;
|
||||
I2C_SCLK = 1;
|
||||
}
|
||||
|
||||
void i2c_delay()
|
||||
{
|
||||
volatile char i = 20;
|
||||
while(i--);
|
||||
}
|
||||
|
||||
void i2c_start()
|
||||
{
|
||||
I2C_SDAT = 0;
|
||||
i2c_delay();
|
||||
|
||||
I2C_SCLK = 0;
|
||||
i2c_delay();
|
||||
}
|
||||
|
||||
void i2c_stop()
|
||||
{
|
||||
I2C_SDAT = 0;
|
||||
I2C_SCLK = 1;
|
||||
i2c_delay();
|
||||
|
||||
I2C_SDAT = 1;
|
||||
i2c_delay();
|
||||
}
|
||||
|
||||
void i2c_write(uint8_t data)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
data <<= 1;
|
||||
I2C_SDAT = CY;
|
||||
|
||||
I2C_SCLK = 1;
|
||||
i2c_delay();
|
||||
|
||||
I2C_SCLK = 0;
|
||||
i2c_delay();
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t i2c_read()
|
||||
{
|
||||
int i;
|
||||
uint8_t ret = 0;
|
||||
|
||||
I2C_SDAT = 1;
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
ret <<= 1;
|
||||
I2C_SCLK = 1;
|
||||
i2c_delay();
|
||||
|
||||
if(I2C_SDAT)
|
||||
ret |= 0x01;
|
||||
|
||||
I2C_SCLK = 0;
|
||||
i2c_delay();
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool i2c_read_ack()
|
||||
{
|
||||
bool status;
|
||||
|
||||
I2C_SDAT = 1;
|
||||
|
||||
I2C_SCLK = 1;
|
||||
i2c_delay();
|
||||
|
||||
status = I2C_SDAT;
|
||||
|
||||
I2C_SCLK = 0;
|
||||
i2c_delay();
|
||||
|
||||
return !status;
|
||||
}
|
||||
|
||||
bool i2c_read_nak()
|
||||
{
|
||||
return !i2c_read_ack();
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
typedef __bit bool;
|
||||
|
||||
extern void i2c_init();
|
||||
|
||||
extern void i2c_start();
|
||||
|
||||
extern void i2c_stop();
|
||||
|
||||
extern void i2c_write(uint8_t data);
|
||||
|
||||
extern bool i2c_read_ack();
|
||||
|
||||
extern bool i2c_read_nak();
|
||||
|
||||
extern uint8_t i2c_read();
|
||||
|
||||
#define TW_READ 0x01
|
||||
typedef __bit bool;
|
||||
|
||||
extern void i2c_init();
|
||||
|
||||
extern void i2c_start();
|
||||
|
||||
extern void i2c_stop();
|
||||
|
||||
extern void i2c_write(uint8_t data);
|
||||
|
||||
extern bool i2c_read_ack();
|
||||
|
||||
extern bool i2c_read_nak();
|
||||
|
||||
extern uint8_t i2c_read();
|
||||
|
||||
#define TW_READ 0x01
|
@ -1,63 +1,63 @@
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "i2c.h"
|
||||
#include "si5351.h"
|
||||
|
||||
|
||||
#define BOOT_ADDR 0x3800
|
||||
|
||||
/* This function provided a way to the internal bootloader */
|
||||
void jump_to_bootloader()
|
||||
{
|
||||
EA = 0;/* Disable all interrupts */
|
||||
|
||||
__asm
|
||||
LJMP BOOT_ADDR /* Jump to bootloader */
|
||||
__endasm;
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
||||
bool si5351_write(uint8_t reg_address, uint8_t value)
|
||||
{
|
||||
i2c_start();
|
||||
i2c_write(SI5351_AR);
|
||||
if(i2c_read_nak())
|
||||
goto fault;
|
||||
|
||||
i2c_write(reg_address);
|
||||
if(i2c_read_nak())
|
||||
goto fault;
|
||||
|
||||
i2c_write(value);
|
||||
if(i2c_read_nak())
|
||||
goto fault;
|
||||
|
||||
i2c_stop();
|
||||
return 1;
|
||||
fault:
|
||||
i2c_stop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool si5351_init()
|
||||
{
|
||||
si5351a_revb_register_t __code *pair;
|
||||
int i;
|
||||
for(i = 0; i < SI5351A_REVB_REG_CONFIG_NUM_REGS; i++)
|
||||
{
|
||||
pair = &si5351a_revb_registers[i];
|
||||
if(!si5351_write(pair->address & 0xff, pair->value))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void main( void )
|
||||
{
|
||||
i2c_init();
|
||||
si5351_init();
|
||||
jump_to_bootloader();
|
||||
}
|
||||
#include <8051.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "i2c.h"
|
||||
#include "si5351.h"
|
||||
|
||||
|
||||
#define BOOT_ADDR 0x3800
|
||||
|
||||
/* This function provided a way to the internal bootloader */
|
||||
void jump_to_bootloader()
|
||||
{
|
||||
EA = 0;/* Disable all interrupts */
|
||||
|
||||
__asm
|
||||
LJMP BOOT_ADDR /* Jump to bootloader */
|
||||
__endasm;
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
||||
bool si5351_write(uint8_t reg_address, uint8_t value)
|
||||
{
|
||||
i2c_start();
|
||||
i2c_write(SI5351_AR);
|
||||
if(i2c_read_nak())
|
||||
goto fault;
|
||||
|
||||
i2c_write(reg_address);
|
||||
if(i2c_read_nak())
|
||||
goto fault;
|
||||
|
||||
i2c_write(value);
|
||||
if(i2c_read_nak())
|
||||
goto fault;
|
||||
|
||||
i2c_stop();
|
||||
return 1;
|
||||
fault:
|
||||
i2c_stop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool si5351_init()
|
||||
{
|
||||
si5351a_revb_register_t __code *pair;
|
||||
int i;
|
||||
for(i = 0; i < SI5351A_REVB_REG_CONFIG_NUM_REGS; i++)
|
||||
{
|
||||
pair = &si5351a_revb_registers[i];
|
||||
if(!si5351_write(pair->address & 0xff, pair->value))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void main( void )
|
||||
{
|
||||
i2c_init();
|
||||
si5351_init();
|
||||
jump_to_bootloader();
|
||||
}
|
@ -1,290 +1,290 @@
|
||||
/*
|
||||
* si5351.h - Si5351 library for ch55x 8051 series usb micro controller
|
||||
*
|
||||
* Copyright (C) 2018 Zhiyuan Wan <h@iloli.bid>
|
||||
*
|
||||
* This file is deriived from Jason Milldrum's AVR SI5351 library.
|
||||
* Copyright (C) 2014 Jason Milldrum <milldrum@gmail.com>
|
||||
*
|
||||
* Many defines derived from clk-si5351.h in the Linux kernel.
|
||||
* Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
|
||||
* Rabeeh Khoury <rabeeh@solid-run.com>
|
||||
*
|
||||
* do_div() macro derived from /include/asm-generic/div64.h in
|
||||
* the Linux kernel.
|
||||
* Copyright (C) 2003 Bernardo Innocenti <bernie@develer.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SI5351_H_
|
||||
#define SI5351_H_
|
||||
|
||||
/* Define definitions */
|
||||
|
||||
#define SI5351_BUS_BASE_ADDR 0xC0
|
||||
#define SI5351_XTAL_FREQ 26000000
|
||||
#define SI5351_PLL_FIXED 900000000
|
||||
|
||||
/*
|
||||
* Si5351A Rev B Configuration Register Export Header File
|
||||
*
|
||||
* This file represents a series of Silicon Labs Si5351A Rev B
|
||||
* register writes that can be performed to load a single configuration
|
||||
* on a device. It was created by a Silicon Labs ClockBuilder Pro
|
||||
* export tool.
|
||||
*
|
||||
* Part: Si5351A Rev B
|
||||
* Design ID:
|
||||
* Includes Pre/Post Download Control Register Writes: Yes
|
||||
* Created By: ClockBuilder Pro v2.21 [2018-01-19]
|
||||
* Timestamp: 2018-03-16 18:42:24 GMT+08:00
|
||||
*
|
||||
* A complete design report corresponding to this export is included at the end
|
||||
* of this header file.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SI5351A_REVB_REG_CONFIG_NUM_REGS 57
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int address; /* 16-bit register address */
|
||||
unsigned char value; /* 8-bit register data */
|
||||
|
||||
} si5351a_revb_register_t;
|
||||
|
||||
si5351a_revb_register_t const si5351a_revb_registers[SI5351A_REVB_REG_CONFIG_NUM_REGS] =
|
||||
{
|
||||
{ 0x0002, 0x53 },
|
||||
{ 0x0003, 0x00 },
|
||||
{ 0x0007, 0x00 },
|
||||
{ 0x000F, 0x00 },
|
||||
{ 0x0010, 0x4F },
|
||||
{ 0x0011, 0x0F },
|
||||
{ 0x0012, 0x0F },
|
||||
{ 0x0013, 0x8C },
|
||||
{ 0x0014, 0x8C },
|
||||
{ 0x0015, 0x8C },
|
||||
{ 0x0016, 0x8C },
|
||||
{ 0x0017, 0x8C },
|
||||
{ 0x001A, 0x00 },
|
||||
{ 0x001B, 0x0D },
|
||||
{ 0x001C, 0x00 },
|
||||
{ 0x001D, 0x0D },
|
||||
{ 0x001E, 0x93 },
|
||||
{ 0x001F, 0x00 },
|
||||
{ 0x0020, 0x00 },
|
||||
{ 0x0021, 0x09 },
|
||||
{ 0x002A, 0x00 },
|
||||
{ 0x002B, 0x01 },
|
||||
{ 0x002C, 0x00 },
|
||||
{ 0x002D, 0x01 },
|
||||
{ 0x002E, 0x00 },
|
||||
{ 0x002F, 0x00 },
|
||||
{ 0x0030, 0x00 },
|
||||
{ 0x0031, 0x00 },
|
||||
{ 0x0032, 0x00 },
|
||||
{ 0x0033, 0x01 },
|
||||
{ 0x0034, 0x00 },
|
||||
{ 0x0035, 0x19 },
|
||||
{ 0x0036, 0x00 },
|
||||
{ 0x0037, 0x00 },
|
||||
{ 0x0038, 0x00 },
|
||||
{ 0x0039, 0x00 },
|
||||
{ 0x003A, 0x00 },
|
||||
{ 0x003B, 0x01 },
|
||||
{ 0x003C, 0x01 },
|
||||
{ 0x003D, 0x93 },
|
||||
{ 0x003E, 0x00 },
|
||||
{ 0x003F, 0x00 },
|
||||
{ 0x0040, 0x00 },
|
||||
{ 0x0041, 0x00 },
|
||||
{ 0x005A, 0x00 },
|
||||
{ 0x005B, 0x00 },
|
||||
{ 0x0095, 0x00 },
|
||||
{ 0x0096, 0x00 },
|
||||
{ 0x0097, 0x00 },
|
||||
{ 0x0098, 0x00 },
|
||||
{ 0x0099, 0x00 },
|
||||
{ 0x009A, 0x00 },
|
||||
{ 0x009B, 0x00 },
|
||||
{ 0x00A2, 0x00 },
|
||||
{ 0x00A3, 0x00 },
|
||||
{ 0x00A4, 0x00 },
|
||||
{ 0x00B7, 0x12 },
|
||||
|
||||
};
|
||||
|
||||
#define SI5351_AR 0xC0
|
||||
|
||||
/*
|
||||
* Design Report
|
||||
*
|
||||
* Overview
|
||||
* ========
|
||||
* Part: Si5351A
|
||||
* Project File: C:\Users\ZHIYUAN\Documents\Si5351A-RevB-Project.slabtimeproj
|
||||
* Created By: ClockBuilder Pro v2.21 [2018-01-19]
|
||||
* Timestamp: 2018-03-16 18:42:24 GMT+08:00
|
||||
*
|
||||
* Design Rule Check
|
||||
* =================
|
||||
* Errors:
|
||||
* - No errors
|
||||
*
|
||||
* Warnings:
|
||||
* - No warnings
|
||||
*
|
||||
* Design
|
||||
* ======
|
||||
* Inputs:
|
||||
* IN0: 26 MHz
|
||||
*
|
||||
* Outputs:
|
||||
* OUT0: 30 MHz
|
||||
* Enabled LVCMOS 8 mA
|
||||
* Offset 0.000 s
|
||||
* OUT1: 15 MHz
|
||||
* Enabled LVCMOS 8 mA
|
||||
* Offset 0.000 s
|
||||
* OUT2: 1 MHz
|
||||
* Enabled LVCMOS 8 mA
|
||||
* Offset 0.000 s
|
||||
*
|
||||
* Frequency Plan
|
||||
* ==============
|
||||
* PLL_A:
|
||||
* Enabled Features = None
|
||||
* Fvco = 900 MHz
|
||||
* M = 34.6153846153846153... [ 34 + 8/13 ]
|
||||
* Input0:
|
||||
* Source = Crystal
|
||||
* Source Frequency = 26 MHz
|
||||
* Fpfd = 26 MHz
|
||||
* Load Capacitance = Not_Applicable
|
||||
* Output0:
|
||||
* Features = None
|
||||
* Disabled State = StopLow
|
||||
* R = 1 (2^0)
|
||||
* Fout = 30 MHz
|
||||
* N = 30
|
||||
* Output1:
|
||||
* Features = None
|
||||
* Disabled State = StopLow
|
||||
* R = 1 (2^0)
|
||||
* Fout = 15 MHz
|
||||
* N = 60
|
||||
* Output2:
|
||||
* Features = None
|
||||
* Disabled State = StopLow
|
||||
* R = 1 (2^0)
|
||||
* Fout = 1 MHz
|
||||
* N = 900
|
||||
*
|
||||
* Settings
|
||||
* ========
|
||||
*
|
||||
* Location Setting Name Decimal Value Hex Value
|
||||
* ------------ ------------- ----------------- -----------------
|
||||
* 0x0002[3] XO_LOS_MASK 0 0x0
|
||||
* 0x0002[4] CLK_LOS_MASK 1 0x1
|
||||
* 0x0002[5] LOL_A_MASK 0 0x0
|
||||
* 0x0002[6] LOL_B_MASK 1 0x1
|
||||
* 0x0002[7] SYS_INIT_MASK 0 0x0
|
||||
* 0x0003[7:0] CLK_OEB 0 0x00
|
||||
* 0x0007[7:4] I2C_ADDR_CTRL 0 0x0
|
||||
* 0x000F[2] PLLA_SRC 0 0x0
|
||||
* 0x000F[3] PLLB_SRC 0 0x0
|
||||
* 0x000F[4] PLLA_INSELB 0 0x0
|
||||
* 0x000F[5] PLLB_INSELB 0 0x0
|
||||
* 0x000F[7:6] CLKIN_DIV 0 0x0
|
||||
* 0x0010[1:0] CLK0_IDRV 3 0x3
|
||||
* 0x0010[3:2] CLK0_SRC 3 0x3
|
||||
* 0x0010[4] CLK0_INV 0 0x0
|
||||
* 0x0010[5] MS0_SRC 0 0x0
|
||||
* 0x0010[6] MS0_INT 0 0x0
|
||||
* 0x0010[7] CLK0_PDN 0 0x0
|
||||
* 0x0011[1:0] CLK1_IDRV 3 0x3
|
||||
* 0x0011[3:2] CLK1_SRC 3 0x3
|
||||
* 0x0011[4] CLK1_INV 0 0x0
|
||||
* 0x0011[5] MS1_SRC 0 0x0
|
||||
* 0x0011[6] MS1_INT 0 0x0
|
||||
* 0x0011[7] CLK1_PDN 0 0x0
|
||||
* 0x0012[1:0] CLK2_IDRV 3 0x3
|
||||
* 0x0012[3:2] CLK2_SRC 3 0x3
|
||||
* 0x0012[4] CLK2_INV 0 0x0
|
||||
* 0x0012[5] MS2_SRC 0 0x0
|
||||
* 0x0012[6] MS2_INT 0 0x0
|
||||
* 0x0012[7] CLK2_PDN 0 0x0
|
||||
* 0x0013[1:0] CLK3_IDRV 0 0x0
|
||||
* 0x0013[3:2] CLK3_SRC 3 0x3
|
||||
* 0x0013[4] CLK3_INV 0 0x0
|
||||
* 0x0013[5] MS3_SRC 0 0x0
|
||||
* 0x0013[6] MS3_INT 0 0x0
|
||||
* 0x0013[7] CLK3_PDN 1 0x1
|
||||
* 0x0014[1:0] CLK4_IDRV 0 0x0
|
||||
* 0x0014[3:2] CLK4_SRC 3 0x3
|
||||
* 0x0014[4] CLK4_INV 0 0x0
|
||||
* 0x0014[5] MS4_SRC 0 0x0
|
||||
* 0x0014[6] MS4_INT 0 0x0
|
||||
* 0x0014[7] CLK4_PDN 1 0x1
|
||||
* 0x0015[1:0] CLK5_IDRV 0 0x0
|
||||
* 0x0015[3:2] CLK5_SRC 3 0x3
|
||||
* 0x0015[4] CLK5_INV 0 0x0
|
||||
* 0x0015[5] MS5_SRC 0 0x0
|
||||
* 0x0015[6] MS5_INT 0 0x0
|
||||
* 0x0015[7] CLK5_PDN 1 0x1
|
||||
* 0x0016[1:0] CLK6_IDRV 0 0x0
|
||||
* 0x0016[3:2] CLK6_SRC 3 0x3
|
||||
* 0x0016[4] CLK6_INV 0 0x0
|
||||
* 0x0016[5] MS6_SRC 0 0x0
|
||||
* 0x0016[6] FBA_INT 0 0x0
|
||||
* 0x0016[7] CLK6_PDN 1 0x1
|
||||
* 0x0017[1:0] CLK7_IDRV 0 0x0
|
||||
* 0x0017[3:2] CLK7_SRC 3 0x3
|
||||
* 0x0017[4] CLK7_INV 0 0x0
|
||||
* 0x0017[5] MS7_SRC 0 0x0
|
||||
* 0x0017[6] FBB_INT 0 0x0
|
||||
* 0x0017[7] CLK7_PDN 1 0x1
|
||||
* 0x001C[17:0] MSNA_P1 3918 0x00F4E
|
||||
* 0x001F[19:0] MSNA_P2 10 0x0000A
|
||||
* 0x001F[23:4] MSNA_P3 13 0x0000D
|
||||
* 0x002C[17:0] MS0_P1 3328 0x00D00
|
||||
* 0x002F[19:0] MS0_P2 0 0x00000
|
||||
* 0x002F[23:4] MS0_P4 1 0x00001
|
||||
* 0x0034[17:0] MS1_P1 7168 0x01C00
|
||||
* 0x0037[19:0] MS1_P2 0 0x00000
|
||||
* 0x0037[23:4] MS1_P4 1 0x00001
|
||||
* 0x003C[17:0] MS2_P1 114688 0x1C000
|
||||
* 0x003F[19:0] MS2_P2 0 0x00000
|
||||
* 0x003F[23:4] MS2_P4 1 0x00001
|
||||
* 0x005A[7:0] MS6_P2 0 0x00
|
||||
* 0x005B[7:0] MS7_P2 0 0x00
|
||||
* 0x0095[14:0] SSDN_P2 0 0x0000
|
||||
* 0x0095[7] SSC_EN 0 0x0
|
||||
* 0x0097[14:0] SSDN_P3 0 0x0000
|
||||
* 0x0097[7] SSC_MODE 0 0x0
|
||||
* 0x0099[11:0] SSDN_P1 0 0x000
|
||||
* 0x009A[15:4] SSUDP 0 0x000
|
||||
* 0x00A2[21:0] VCXO_PARAM 0 0x000000
|
||||
* 0x00B7[7:6] XTAL_CL 0 0x0
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* SI5351_H_ */
|
||||
|
||||
/*
|
||||
* si5351.h - Si5351 library for ch55x 8051 series usb micro controller
|
||||
*
|
||||
* Copyright (C) 2018 Zhiyuan Wan <h@iloli.bid>
|
||||
*
|
||||
* This file is deriived from Jason Milldrum's AVR SI5351 library.
|
||||
* Copyright (C) 2014 Jason Milldrum <milldrum@gmail.com>
|
||||
*
|
||||
* Many defines derived from clk-si5351.h in the Linux kernel.
|
||||
* Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
|
||||
* Rabeeh Khoury <rabeeh@solid-run.com>
|
||||
*
|
||||
* do_div() macro derived from /include/asm-generic/div64.h in
|
||||
* the Linux kernel.
|
||||
* Copyright (C) 2003 Bernardo Innocenti <bernie@develer.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SI5351_H_
|
||||
#define SI5351_H_
|
||||
|
||||
/* Define definitions */
|
||||
|
||||
#define SI5351_BUS_BASE_ADDR 0xC0
|
||||
#define SI5351_XTAL_FREQ 26000000
|
||||
#define SI5351_PLL_FIXED 900000000
|
||||
|
||||
/*
|
||||
* Si5351A Rev B Configuration Register Export Header File
|
||||
*
|
||||
* This file represents a series of Silicon Labs Si5351A Rev B
|
||||
* register writes that can be performed to load a single configuration
|
||||
* on a device. It was created by a Silicon Labs ClockBuilder Pro
|
||||
* export tool.
|
||||
*
|
||||
* Part: Si5351A Rev B
|
||||
* Design ID:
|
||||
* Includes Pre/Post Download Control Register Writes: Yes
|
||||
* Created By: ClockBuilder Pro v2.21 [2018-01-19]
|
||||
* Timestamp: 2018-03-16 18:42:24 GMT+08:00
|
||||
*
|
||||
* A complete design report corresponding to this export is included at the end
|
||||
* of this header file.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SI5351A_REVB_REG_CONFIG_NUM_REGS 57
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int address; /* 16-bit register address */
|
||||
unsigned char value; /* 8-bit register data */
|
||||
|
||||
} si5351a_revb_register_t;
|
||||
|
||||
si5351a_revb_register_t const si5351a_revb_registers[SI5351A_REVB_REG_CONFIG_NUM_REGS] =
|
||||
{
|
||||
{ 0x0002, 0x53 },
|
||||
{ 0x0003, 0x00 },
|
||||
{ 0x0007, 0x00 },
|
||||
{ 0x000F, 0x00 },
|
||||
{ 0x0010, 0x4F },
|
||||
{ 0x0011, 0x0F },
|
||||
{ 0x0012, 0x0F },
|
||||
{ 0x0013, 0x8C },
|
||||
{ 0x0014, 0x8C },
|
||||
{ 0x0015, 0x8C },
|
||||
{ 0x0016, 0x8C },
|
||||
{ 0x0017, 0x8C },
|
||||
{ 0x001A, 0x00 },
|
||||
{ 0x001B, 0x0D },
|
||||
{ 0x001C, 0x00 },
|
||||
{ 0x001D, 0x0D },
|
||||
{ 0x001E, 0x93 },
|
||||
{ 0x001F, 0x00 },
|
||||
{ 0x0020, 0x00 },
|
||||
{ 0x0021, 0x09 },
|
||||
{ 0x002A, 0x00 },
|
||||
{ 0x002B, 0x01 },
|
||||
{ 0x002C, 0x00 },
|
||||
{ 0x002D, 0x01 },
|
||||
{ 0x002E, 0x00 },
|
||||
{ 0x002F, 0x00 },
|
||||
{ 0x0030, 0x00 },
|
||||
{ 0x0031, 0x00 },
|
||||
{ 0x0032, 0x00 },
|
||||
{ 0x0033, 0x01 },
|
||||
{ 0x0034, 0x00 },
|
||||
{ 0x0035, 0x19 },
|
||||
{ 0x0036, 0x00 },
|
||||
{ 0x0037, 0x00 },
|
||||
{ 0x0038, 0x00 },
|
||||
{ 0x0039, 0x00 },
|
||||
{ 0x003A, 0x00 },
|
||||
{ 0x003B, 0x01 },
|
||||
{ 0x003C, 0x01 },
|
||||
{ 0x003D, 0x93 },
|
||||
{ 0x003E, 0x00 },
|
||||
{ 0x003F, 0x00 },
|
||||
{ 0x0040, 0x00 },
|
||||
{ 0x0041, 0x00 },
|
||||
{ 0x005A, 0x00 },
|
||||
{ 0x005B, 0x00 },
|
||||
{ 0x0095, 0x00 },
|
||||
{ 0x0096, 0x00 },
|
||||
{ 0x0097, 0x00 },
|
||||
{ 0x0098, 0x00 },
|
||||
{ 0x0099, 0x00 },
|
||||
{ 0x009A, 0x00 },
|
||||
{ 0x009B, 0x00 },
|
||||
{ 0x00A2, 0x00 },
|
||||
{ 0x00A3, 0x00 },
|
||||
{ 0x00A4, 0x00 },
|
||||
{ 0x00B7, 0x12 },
|
||||
|
||||
};
|
||||
|
||||
#define SI5351_AR 0xC0
|
||||
|
||||
/*
|
||||
* Design Report
|
||||
*
|
||||
* Overview
|
||||
* ========
|
||||
* Part: Si5351A
|
||||
* Project File: C:\Users\ZHIYUAN\Documents\Si5351A-RevB-Project.slabtimeproj
|
||||
* Created By: ClockBuilder Pro v2.21 [2018-01-19]
|
||||
* Timestamp: 2018-03-16 18:42:24 GMT+08:00
|
||||
*
|
||||
* Design Rule Check
|
||||
* =================
|
||||
* Errors:
|
||||
* - No errors
|
||||
*
|
||||
* Warnings:
|
||||
* - No warnings
|
||||
*
|
||||
* Design
|
||||
* ======
|
||||
* Inputs:
|
||||
* IN0: 26 MHz
|
||||
*
|
||||
* Outputs:
|
||||
* OUT0: 30 MHz
|
||||
* Enabled LVCMOS 8 mA
|
||||
* Offset 0.000 s
|
||||
* OUT1: 15 MHz
|
||||
* Enabled LVCMOS 8 mA
|
||||
* Offset 0.000 s
|
||||
* OUT2: 1 MHz
|
||||
* Enabled LVCMOS 8 mA
|
||||
* Offset 0.000 s
|
||||
*
|
||||
* Frequency Plan
|
||||
* ==============
|
||||
* PLL_A:
|
||||
* Enabled Features = None
|
||||
* Fvco = 900 MHz
|
||||
* M = 34.6153846153846153... [ 34 + 8/13 ]
|
||||
* Input0:
|
||||
* Source = Crystal
|
||||
* Source Frequency = 26 MHz
|
||||
* Fpfd = 26 MHz
|
||||
* Load Capacitance = Not_Applicable
|
||||
* Output0:
|
||||
* Features = None
|
||||
* Disabled State = StopLow
|
||||
* R = 1 (2^0)
|
||||
* Fout = 30 MHz
|
||||
* N = 30
|
||||
* Output1:
|
||||
* Features = None
|
||||
* Disabled State = StopLow
|
||||
* R = 1 (2^0)
|
||||
* Fout = 15 MHz
|
||||
* N = 60
|
||||
* Output2:
|
||||
* Features = None
|
||||
* Disabled State = StopLow
|
||||
* R = 1 (2^0)
|
||||
* Fout = 1 MHz
|
||||
* N = 900
|
||||
*
|
||||
* Settings
|
||||
* ========
|
||||
*
|
||||
* Location Setting Name Decimal Value Hex Value
|
||||
* ------------ ------------- ----------------- -----------------
|
||||
* 0x0002[3] XO_LOS_MASK 0 0x0
|
||||
* 0x0002[4] CLK_LOS_MASK 1 0x1
|
||||
* 0x0002[5] LOL_A_MASK 0 0x0
|
||||
* 0x0002[6] LOL_B_MASK 1 0x1
|
||||
* 0x0002[7] SYS_INIT_MASK 0 0x0
|
||||
* 0x0003[7:0] CLK_OEB 0 0x00
|
||||
* 0x0007[7:4] I2C_ADDR_CTRL 0 0x0
|
||||
* 0x000F[2] PLLA_SRC 0 0x0
|
||||
* 0x000F[3] PLLB_SRC 0 0x0
|
||||
* 0x000F[4] PLLA_INSELB 0 0x0
|
||||
* 0x000F[5] PLLB_INSELB 0 0x0
|
||||
* 0x000F[7:6] CLKIN_DIV 0 0x0
|
||||
* 0x0010[1:0] CLK0_IDRV 3 0x3
|
||||
* 0x0010[3:2] CLK0_SRC 3 0x3
|
||||
* 0x0010[4] CLK0_INV 0 0x0
|
||||
* 0x0010[5] MS0_SRC 0 0x0
|
||||
* 0x0010[6] MS0_INT 0 0x0
|
||||
* 0x0010[7] CLK0_PDN 0 0x0
|
||||
* 0x0011[1:0] CLK1_IDRV 3 0x3
|
||||
* 0x0011[3:2] CLK1_SRC 3 0x3
|
||||
* 0x0011[4] CLK1_INV 0 0x0
|
||||
* 0x0011[5] MS1_SRC 0 0x0
|
||||
* 0x0011[6] MS1_INT 0 0x0
|
||||
* 0x0011[7] CLK1_PDN 0 0x0
|
||||
* 0x0012[1:0] CLK2_IDRV 3 0x3
|
||||
* 0x0012[3:2] CLK2_SRC 3 0x3
|
||||
* 0x0012[4] CLK2_INV 0 0x0
|
||||
* 0x0012[5] MS2_SRC 0 0x0
|
||||
* 0x0012[6] MS2_INT 0 0x0
|
||||
* 0x0012[7] CLK2_PDN 0 0x0
|
||||
* 0x0013[1:0] CLK3_IDRV 0 0x0
|
||||
* 0x0013[3:2] CLK3_SRC 3 0x3
|
||||
* 0x0013[4] CLK3_INV 0 0x0
|
||||
* 0x0013[5] MS3_SRC 0 0x0
|
||||
* 0x0013[6] MS3_INT 0 0x0
|
||||
* 0x0013[7] CLK3_PDN 1 0x1
|
||||
* 0x0014[1:0] CLK4_IDRV 0 0x0
|
||||
* 0x0014[3:2] CLK4_SRC 3 0x3
|
||||
* 0x0014[4] CLK4_INV 0 0x0
|
||||
* 0x0014[5] MS4_SRC 0 0x0
|
||||
* 0x0014[6] MS4_INT 0 0x0
|
||||
* 0x0014[7] CLK4_PDN 1 0x1
|
||||
* 0x0015[1:0] CLK5_IDRV 0 0x0
|
||||
* 0x0015[3:2] CLK5_SRC 3 0x3
|
||||
* 0x0015[4] CLK5_INV 0 0x0
|
||||
* 0x0015[5] MS5_SRC 0 0x0
|
||||
* 0x0015[6] MS5_INT 0 0x0
|
||||
* 0x0015[7] CLK5_PDN 1 0x1
|
||||
* 0x0016[1:0] CLK6_IDRV 0 0x0
|
||||
* 0x0016[3:2] CLK6_SRC 3 0x3
|
||||
* 0x0016[4] CLK6_INV 0 0x0
|
||||
* 0x0016[5] MS6_SRC 0 0x0
|
||||
* 0x0016[6] FBA_INT 0 0x0
|
||||
* 0x0016[7] CLK6_PDN 1 0x1
|
||||
* 0x0017[1:0] CLK7_IDRV 0 0x0
|
||||
* 0x0017[3:2] CLK7_SRC 3 0x3
|
||||
* 0x0017[4] CLK7_INV 0 0x0
|
||||
* 0x0017[5] MS7_SRC 0 0x0
|
||||
* 0x0017[6] FBB_INT 0 0x0
|
||||
* 0x0017[7] CLK7_PDN 1 0x1
|
||||
* 0x001C[17:0] MSNA_P1 3918 0x00F4E
|
||||
* 0x001F[19:0] MSNA_P2 10 0x0000A
|
||||
* 0x001F[23:4] MSNA_P3 13 0x0000D
|
||||
* 0x002C[17:0] MS0_P1 3328 0x00D00
|
||||
* 0x002F[19:0] MS0_P2 0 0x00000
|
||||
* 0x002F[23:4] MS0_P4 1 0x00001
|
||||
* 0x0034[17:0] MS1_P1 7168 0x01C00
|
||||
* 0x0037[19:0] MS1_P2 0 0x00000
|
||||
* 0x0037[23:4] MS1_P4 1 0x00001
|
||||
* 0x003C[17:0] MS2_P1 114688 0x1C000
|
||||
* 0x003F[19:0] MS2_P2 0 0x00000
|
||||
* 0x003F[23:4] MS2_P4 1 0x00001
|
||||
* 0x005A[7:0] MS6_P2 0 0x00
|
||||
* 0x005B[7:0] MS7_P2 0 0x00
|
||||
* 0x0095[14:0] SSDN_P2 0 0x0000
|
||||
* 0x0095[7] SSC_EN 0 0x0
|
||||
* 0x0097[14:0] SSDN_P3 0 0x0000
|
||||
* 0x0097[7] SSC_MODE 0 0x0
|
||||
* 0x0099[11:0] SSDN_P1 0 0x000
|
||||
* 0x009A[15:4] SSUDP 0 0x000
|
||||
* 0x00A2[21:0] VCXO_PARAM 0 0x000000
|
||||
* 0x00B7[7:6] XTAL_CL 0 0x0
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* SI5351_H_ */
|
||||
|
@ -1,108 +1,108 @@
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : ADC.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 ADC采样时钟设置,ADC通道设置函数,电压比较模式设置
|
||||
*******************************************************************************/
|
||||
|
||||
#include "..\Public\CH554.H"
|
||||
#include "..\Public\Debug.H"
|
||||
#include "ADC.H"
|
||||
#include "stdio.h"
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
#define ADC_INTERRUPT 1
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : ADCInit(UINT8 div)
|
||||
* Description : ADC采样时钟设置,模块开启,中断开启
|
||||
* Input : UINT8 div 时钟设置
|
||||
1 慢 384个Fosc
|
||||
0 快 96个Fosc
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void ADCInit(UINT8 div)
|
||||
{
|
||||
ADC_CFG &= ~bADC_CLK | div;
|
||||
ADC_CFG |= bADC_EN; //ADC电源使能
|
||||
#if ADC_INTERRUPT
|
||||
ADC_IF = 0; //清空中断
|
||||
IE_ADC = 1; //使能ADC中断
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : ADC_ChannelSelect(UINT8 ch)
|
||||
* Description : ADC采样启用
|
||||
* Input : UINT8 ch 采用通道
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 ADC_ChannelSelect(UINT8 ch)
|
||||
{
|
||||
if(ch == 0){ADC_CHAN1 =0;ADC_CHAN0=0;P1_DIR_PU &= ~bAIN0;} //AIN0
|
||||
else if(ch == 1){ADC_CHAN1 =0;ADC_CHAN0=1;P1_DIR_PU &= ~bAIN1;} //AIN1
|
||||
else if(ch == 2){ADC_CHAN1 =1;ADC_CHAN0=0;P1_DIR_PU &= ~bAIN2;} //AIN2
|
||||
else if(ch == 3){ADC_CHAN1 =1;ADC_CHAN0=1;P3_DIR_PU &= ~bAIN3;} //AIN3
|
||||
else return FAIL;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : VoltageCMPModeInit()
|
||||
* Description : 电压比较器模式初始化
|
||||
* Input : UINT8 fo 正向端口 0\1\2\3
|
||||
UINT8 re 反向端口 1\3
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 VoltageCMPModeInit(UINT8 fo,UINT8 re)
|
||||
{
|
||||
ADC_CFG |= bCMP_EN; //电平比较电源使能
|
||||
if(re == 1){
|
||||
if(fo == 0) {ADC_CHAN1 =0;ADC_CHAN0=0;CMP_CHAN =0;} //AIN0和AIN1
|
||||
else if(fo == 2) {ADC_CHAN1 =1;ADC_CHAN0=0;CMP_CHAN =0;} //AIN2和AIN1
|
||||
else if(fo == 3) {ADC_CHAN1 =1;ADC_CHAN0=1;CMP_CHAN =0; } //AIN3和AIN1
|
||||
else return FAIL;
|
||||
}
|
||||
else if(re == 3){
|
||||
if(fo == 0) {ADC_CHAN1 =0;ADC_CHAN0=0;CMP_CHAN =0;} //AIN0和AIN1
|
||||
else if(fo == 1) {ADC_CHAN1 =0;ADC_CHAN0=1;CMP_CHAN =0;} //AIN1和AIN1
|
||||
else if(fo == 2) {ADC_CHAN1 =1;ADC_CHAN0=0;CMP_CHAN =0;} //AIN2和AIN1
|
||||
else return FAIL;
|
||||
}
|
||||
else return FAIL;
|
||||
#if ADC_INTERRUPT
|
||||
CMP_IF = 0; //清空中断
|
||||
IE_ADC = 1; //使能ADC中断
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#if ADC_INTERRUPT
|
||||
/*******************************************************************************
|
||||
* Function Name : ADCInterrupt(void)
|
||||
* Description : ADC 中断服务程序
|
||||
*******************************************************************************/
|
||||
void ADCInterrupt( void ) interrupt INT_NO_ADC using 1 //ADC中断服务程序,使用寄存器组1
|
||||
{
|
||||
if(ADC_IF == 1) //ADC完成中断
|
||||
{
|
||||
// UserData = ADC_DATA; //取走ADC采样数据
|
||||
ADC_IF = 0; //清空ADC中断标志
|
||||
}
|
||||
if(CMP_IF == 1) //电压比较完成中断
|
||||
{
|
||||
// UserData = ADC_CTRL&0x80 >> 7); //保存比较器结果
|
||||
CMP_IF = 0; //清空比较器完成中断
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : ADC.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 ADC采样时钟设置,ADC通道设置函数,电压比较模式设置
|
||||
*******************************************************************************/
|
||||
|
||||
#include "..\Public\CH554.H"
|
||||
#include "..\Public\Debug.H"
|
||||
#include "ADC.H"
|
||||
#include "stdio.h"
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
#define ADC_INTERRUPT 1
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : ADCInit(UINT8 div)
|
||||
* Description : ADC采样时钟设置,模块开启,中断开启
|
||||
* Input : UINT8 div 时钟设置
|
||||
1 慢 384个Fosc
|
||||
0 快 96个Fosc
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void ADCInit(UINT8 div)
|
||||