📄 am12864.c
字号:
* Col->显示的起始列号
Row->显示的起始行号
Str->显示输出字符
Mode->显示输出方式( 是否反显示)
* 返回值 :
* 作者 :qsw
* 创建日期 :
* 全局变量 :
* 全局静态变量:
* 局部静态变量:
*----------------------------------------修改历史-------------------------------------
* 当前版本 : 修改人: 修改日期:
* 修改说明 :
******************************************************************************************/
void AM12864_8x8_Display(uint8 Col, uint8 Row, uint8 Str, uint8 Mode)
{
uint8 ucTemp;
AM12864_SendData((0xB0 |Row), AM12864_Cmd, AM12864_Natural); // X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 0; ucTemp < 7; ucTemp++)
{
AM12864_SendData(Char_8x8[Str - 0x20][ ucTemp], AM12864_Dat, Mode);
}
}
/******************************************************************************************
* 函数名称 :
* 功能描述 :
* 参数名称 :
* Col->显示的起始列号
Row->显示的起始行号
Str->显示输出字符
Mode->显示输出方式( 是否反显示)
* 返回值 :
* 作者 :qsw
* 创建日期 :
* 全局变量 :
* 全局静态变量:
* 局部静态变量:
*----------------------------------------修改历史-------------------------------------
* 当前版本 : 修改人: 修改日期:
* 修改说明 :
******************************************************************************************/
void AM12864_8x16_Display(uint8 Col, uint8 Row, uint8 Str, uint8 Mode)
{
uint8 ucTemp;
AM12864_SendData((0xB0 |Row), AM12864_Cmd, AM12864_Natural); // X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 0; ucTemp < 8; ucTemp++)
{
AM12864_SendData(Char_8x16[Str - 0x20][ ucTemp], AM12864_Dat, Mode);
}
AM12864_SendData((0xB0 |(Row + 1)), AM12864_Cmd, AM12864_Natural); // X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 8; ucTemp < 16; ucTemp++)
{
AM12864_SendData(Char_8x16[Str - 0x20][ ucTemp], AM12864_Dat, Mode);
}
}
/******************************************************************************************
* 函数名称 :
* 功能描述 :
* 参数名称 :
* Col->显示的起始列号
Row->显示的起始行号
Str->显示输出字符
Mode->显示输出方式( 是否反显示)
* 返回值 :
* 作者 :qsw
* 创建日期 :
* 全局变量 :
* 全局静态变量:
* 局部静态变量:
*----------------------------------------修改历史-------------------------------------
* 当前版本 : 修改人: 修改日期:
* 修改说明 :
******************************************************************************************/
void AM12864_16x16_Display(uint8 Col, uint8 Row, uint8 Str, uint8 Mode)
{
uint8 ucTemp;
// 当前工作行号
AM12864_SendData((0xB0 |Row), AM12864_Cmd, AM12864_Natural); // X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 0; ucTemp < 16; ucTemp++)
{
AM12864_SendData(Char_16x16[Str][ ucTemp], AM12864_Dat, Mode);
}
// 当前工作行号+ 1
AM12864_SendData((0xB0 |(Row + 1)), AM12864_Cmd, AM12864_Natural); // X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 16; ucTemp < 32; ucTemp++)
{
AM12864_SendData(Char_16x16[Str][ ucTemp], AM12864_Dat, Mode);
}
}
/******************************************************************************************
* 函数名称 :
* 功能描述 :
* 参数名称 :
* Col->显示的起始列号
Row->显示的起始行号
Str->显示输出字符
Mode->显示输出方式( 是否反显示)
* 返回值 :
* 作者 :qsw
* 创建日期 :
* 全局变量 :
* 全局静态变量:
* 局部静态变量:
*----------------------------------------修改历史-------------------------------------
* 当前版本 : 修改人: 修改日期:
* 修改说明 :
******************************************************************************************/
void AM12864_16x32_Display(uint8 Col, uint8 Row, uint8 Str, uint8 Mode)
{
uint8 ucTemp;
// 当前工作行号
AM12864_SendData((0xB0 |Row), AM12864_Cmd, AM12864_Natural); // X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 0; ucTemp < 16; ucTemp++)
{
AM12864_SendData(Char_16x32[Str & 0x0F][ ucTemp], AM12864_Dat, Mode);
}
// 当前工作行号+ 1
AM12864_SendData((0xB0 |(Row + 1)), AM12864_Cmd, AM12864_Natural);// X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 16; ucTemp < 32; ucTemp++)
{
AM12864_SendData(Char_16x32[Str & 0x0F][ ucTemp], AM12864_Dat, Mode);
}
// 当前工作行号+ 2
AM12864_SendData((0xB0 |(Row + 2)), AM12864_Cmd, AM12864_Natural);// X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 32; ucTemp < 48; ucTemp++)
{
AM12864_SendData(Char_16x32[Str & 0x0F][ ucTemp], AM12864_Dat, Mode);
}
// 当前工作行号+ 3
AM12864_SendData((0xB0 |(Row + 3)), AM12864_Cmd, AM12864_Natural);// X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
ucTemp = Col >> 4;
AM12864_SendData((0x10 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的高4位
ucTemp = Col & 0x0F;
AM12864_SendData((0x00 | ucTemp), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural); //设置屏幕起始行
// 发送显示数据到AM12864
for (ucTemp = 48; ucTemp < 64; ucTemp++)
{
AM12864_SendData(Char_16x32[Str & 0x0F][ ucTemp], AM12864_Dat, Mode);
}
}
/******************************************************************************************
* 函数名称 :
* 功能描述 :
* 参数名称 :
* Col->显示的起始列号
Row->显示的起始行号
Str->显示输出字符
Mode->显示输出方式( 是否反显示)
* 返回值 :
* 作者 :qsw
* 创建日期 :
* 全局变量 :
* 全局静态变量:
* 局部静态变量:
*----------------------------------------修改历史-------------------------------------
* 当前版本 : 修改人: 修改日期:
* 修改说明 :
******************************************************************************************/
void AM12864_Graphics_Display(const uint8 *ucGraphics, uint8 ucRow,uint8 ucCol, uint8 ucColSum, uint8 ucRowSum, uint8 ucMode)
{
uint8 AM12864_Loop1, AM12864_Loop2; // 函数用变量
AM12864_CS_SET(); // CS = High, 关片选
AM12864_SCK_SET(); // SCK = High
AM12864_CS_CLR(); // CS = Low, 开片选
for(AM12864_Loop1 = 0; AM12864_Loop1 < ucRowSum; AM12864_Loop1++)
{
AM12864_SendData((0xB0|AM12864_Loop1), AM12864_Cmd, AM12864_Natural); // X Page (0-7), AM12864_Cmd, 0xb8 to 0xbf
AM12864_SendData((0x10|(ucCol>> 4)), AM12864_Cmd, AM12864_Natural); //列的高4位
AM12864_SendData((0x00 |(ucCol& 0x0F)), AM12864_Cmd, AM12864_Natural); //列的低4位
AM12864_SendData(0x40, AM12864_Cmd, AM12864_Natural);
for (AM12864_Loop2 = 0; AM12864_Loop2 < ucColSum; AM12864_Loop2++) //发送一行数据显示
{
AM12864_SendData(*ucGraphics, AM12864_Dat, ucMode);
++ucGraphics; // 显示数据指针+ 1
}
}
AM12864_CS_SET(); // CS = High, 关片选
}
/******************************************************************************************
* 函数名称 :
* 功能描述 :
* 参数名称 :
* Col->显示的起始列号
Row->显示的起始行号
Str->显示输出字符
Mode->显示输出方式( 是否反显示)
* 返回值 :
* 作者 :qsw
* 创建日期 :
* 全局变量 :
* 全局静态变量:
* 局部静态变量:
*----------------------------------------修改历史-------------------------------------
* 当前版本 : 修改人: 修改日期:
* 修改说明 :
******************************************************************************************/
void AM12864_8x8_Text(uint8 ucCol, uint8 ucRow, uint8 *ucStr, uint8 ucStrLen, uint8 ucMode)
{
uin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -