12864液晶反白

[复制链接]
8420|7
 楼主| nan_banqiu 发表于 2011-3-11 09:02 | 显示全部楼层 |阅读模式
ST7920控制器的12864,怎样实现单个汉字反白显示呢?请指教
ayb_ice 发表于 2011-3-11 09:17 | 显示全部楼层
看手册
china_fog 发表于 2011-3-11 10:01 | 显示全部楼层
单个汉字反白那要吧这个汉字模取反了。如果整个反白,那只要屏的属性设置设置就可以了
 楼主| nan_banqiu 发表于 2011-3-11 16:00 | 显示全部楼层
手册功能不适合啊  我用的字库
 楼主| nan_banqiu 发表于 2011-3-11 16:01 | 显示全部楼层
现在实现了汉字的反白  但是单个字符还没搞定
 楼主| nan_banqiu 发表于 2011-3-11 16:44 | 显示全部楼层
本帖最后由 nan_banqiu 于 2011-3-11 16:47 编辑

已解决 感觉写的挺麻烦只是实现了功能 不知哪位高手有好办法
/******************************************************************
***参数:发白起始横坐标(0 - 15),起始纵坐标(0 - 3),反白字符长度(1 - 16)
***返回值:无
***功能:实现反白显示
******************************************************************/   
void Set_Reverse(unsigned char x, y, width)               
{
        char i,j,flag= 0;
        unsigned char real_x,real_width;
        Clear_Gdram();
        if(y>1)
        {
                flag=0x08;
                y=y-2;
        }
        Write_Led_Data(0,0x34);        //关显示,打开基本指令

        if(x % 2 == 0 && width % 2 == 0)        //开始地址为偶数,字符长度为偶数
        {
                real_x = x / 2;
                real_width = width / 2;

                for(i=0;i<16;i++)
                {
                        Write_Led_Data(0,0x80+(y<<4)+i);
                        Write_Led_Data(0,0x80+flag+real_x);                //写地址

                        for(j=0;j<real_width;j++)
                        {
                                Write_Led_Data(1,0xff);
                                Write_Led_Data(1,0xff);                                //写数据
                        }
                }
        }

        if(x % 2 == 0 && width %2 != 0)                        //开始地址为偶数,地址长度为奇数
        {
                real_x = x / 2;
                real_width = width / 2;

                for(i=0;i<16;i++)
                {
                        Write_Led_Data(0,0x80+(y<<4)+i);         
                        Write_Led_Data(0,0x80+flag+real_x);           // 写地址

                        for(j=0;j<real_width;j++)
                        {
                                Write_Led_Data(1,0xff);
                                Write_Led_Data(1,0xff);                        //写数据
                        }
                        Write_Led_Data(1,0xff);
                        Write_Led_Data(1,0x00);                                //写数据
                }
        }

        if(x % 2 != 0 && width % 2 == 0)                //开始地址为奇数,字符长度为偶数
        {
                real_x = x / 2;
                real_width = width / 2 - 1;

                for(i=0;i<16;i++)
                {
                        Write_Led_Data(0,0x80+(y<<4)+i);
                        Write_Led_Data(0,0x80+flag+real_x);                //写地址

                        Write_Led_Data(1,0x00);
                        Write_Led_Data(1,0xff);
                        for(j=0;j<real_width;j++)
                        {
                                Write_Led_Data(1,0xff);
                                Write_Led_Data(1,0xff);                                //写数据
                        }
                        Write_Led_Data(1,0xff);
                        Write_Led_Data(1,0x00);                                         //写数据
                }
        }

        if(x % 2 != 0 && width % 2 != 0)                                //开始地址为奇数,字符长度为奇数
        {
                real_x = x / 2;
                real_width = width / 2;

                for(i=0;i<16;i++)
                {
                        Write_Led_Data(0,0x80+(y<<4)+i);
                        Write_Led_Data(0,0x80+flag+real_x);                        //写地址

                        Write_Led_Data(1,0x00);
                        Write_Led_Data(1,0xff);                                                 //写数据

                        for(j=0;j<real_width;j++)
                        {
                                Write_Led_Data(1,0xff);
                                Write_Led_Data(1,0xff);                                          //写数据
                        }
                }
        }

        Write_Led_Data(0,0x36);       //写完数据,开图形显示
        Write_Led_Data(0,0x30);       //从扩展指令到基本指令
}
 楼主| nan_banqiu 发表于 2011-3-11 16:46 | 显示全部楼层
感觉ST7920控制器的液晶使用不大方便,敬请高手推荐一款好用的!!谢谢!!!
xouou_53320 发表于 2013-3-21 21:06 | 显示全部楼层
反白有5中方法
1.行反白,一般不用
2.自定义字库反白
3.小图片反白
4.打点反白,
5.全1的图片覆盖文字即可使文字反白
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

161

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部