5825|16

7228

帖子

192

TA的资源

五彩晶圆(高级)

楼主
 

【课后练习】LaunchPad课后练习六之LCD12864显示图片 [复制链接]

 

1. 原理图

 

2.  取模过程

当然你也可以不保存单色位图,把图片导入word,选择黑白,如下:

 

打开制作好的图片:

 

 

取模方式

 

 

3. 实验现象

 

课后练习六之LCD12864显示图片.pdf (769.96 KB, 下载次数: 514)

 

 

 

 

 

最新回复

其实可以使用网页版ps,调整一下阈值,可以获得更好的取模效果  详情 回复 发表于 2014-11-2 15:13
 
点赞 关注(1)

回复
举报

7228

帖子

192

TA的资源

五彩晶圆(高级)

沙发
 

  1. /***********************************************
    **** LAUNCH PAD 学习之LCD ***
    **** MCU: MSP430 ***
    **** 作者: 常见泽 ***
    **** ***
    **** ***
    **** 2012.05.30.11:16 ***
    **** 实验现象:LCD显示EE LOG ***
    **** ***
    ****P1.0~P1.7 数据口 P2.0 P2.1 P2.2 en rs Psb***
    ***********************************************/
    #include <msp430g2452.h>
    #define uchar unsigned char
    #define uint unsigned int

    unsigned char table[]="EE-LaunchPad";
    unsigned char num;
    void delay_1ms(void)
    {
    unsigned int i;
    for (i=0;i<1140;i++);
    }

    const unsigned char ucpic[]=
    {
    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,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,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,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,
    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,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,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,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,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x0F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x1F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x3F,0xFF,0xC3,0xFC,0x00,0x30,0x00,0x06,0x00,0xE0,0x06,0x66,0x19,0x8C,0x31,
    0x00,0x3F,0xFF,0xC3,0xFC,0x00,0x30,0x00,0x06,0x00,0xE0,0x06,0x66,0x19,0x8C,0x31,
    0x00,0x3F,0xFE,0x01,0xFE,0x02,0x39,0x00,0x06,0x00,0xC0,0x0C,0x62,0x19,0x8C,0x31,
    0x00,0x3F,0xF8,0x00,0xFE,0x07,0x31,0x80,0xFC,0x00,0xC0,0x0C,0x62,0x19,0x8C,0x31,
    0x00,0x3F,0xF0,0x00,0xFE,0x06,0x31,0x80,0x78,0x00,0xC0,0x0C,0x66,0x1D,0xDC,0x31,
    0x00,0x3F,0xE0,0x01,0xFE,0x06,0x31,0x80,0x30,0x00,0xC0,0x0C,0x00,0x19,0xCC,0x30,
    0x00,0x3F,0xC0,0x03,0xFE,0x07,0x39,0x80,0x38,0x00,0xC0,0x1F,0x00,0x18,0x8C,0x00,
    0x00,0x3F,0xC0,0x03,0xFE,0x07,0x39,0x80,0x38,0x00,0xC0,0x1F,0x00,0x18,0x8C,0x00,
    0x00,0x3F,0xC0,0x3F,0xFE,0x06,0x31,0x80,0x38,0x00,0xC0,0x3D,0x18,0x19,0x8C,0x0C,
    0x00,0x3F,0x80,0x7F,0xFE,0x06,0x31,0x80,0x38,0x00,0xE0,0x3D,0x18,0x19,0x8C,0x1C,
    0x00,0x3F,0x80,0xFF,0xFE,0x06,0x31,0x80,0x18,0x00,0xE0,0x3D,0x18,0x19,0x8C,0x3C,
    0x00,0x3F,0x81,0xF3,0xFE,0x07,0x31,0x80,0x38,0x00,0xE0,0x3F,0x18,0x19,0xD8,0x0C,
    0x00,0x3F,0x81,0xF3,0xFE,0x07,0x31,0x80,0x38,0x00,0xE0,0x3F,0x18,0x19,0xD8,0x0C,
    0x00,0x3F,0x03,0xC1,0xFE,0x00,0x30,0x00,0x30,0x00,0xE0,0x3F,0x18,0x18,0x00,0x0C,
    0x00,0x3F,0x03,0xC0,0xFE,0x00,0x30,0x01,0xF0,0x00,0xE0,0x35,0x18,0x1C,0x00,0x0C,
    0x00,0x3F,0x03,0x80,0xFE,0x00,0x3C,0x80,0x00,0x00,0xE0,0x0C,0x18,0x0C,0x00,0x18,
    0x00,0x3F,0x03,0x80,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x3F,0x03,0x80,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x3F,0x03,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x3F,0x01,0xC1,0xFE,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0x00,0x3F,0x81,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x3F,0x80,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x3F,0x80,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x3F,0x80,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x00,0x00,0x00,0x00,
    0x00,0x3F,0xC0,0x0F,0xFE,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
    0x00,0x3F,0xE0,0x01,0xFE,0x01,0x01,0x80,0x00,0x60,0x10,0xD0,0x00,0x00,0x00,0x00,
    0x00,0x3F,0xF0,0x01,0xFE,0x04,0x44,0x4C,0x89,0xB1,0x93,0x70,0x00,0x00,0x00,0x00,
    0x00,0x3F,0xF8,0x00,0xFE,0x0C,0x4C,0x4D,0xD3,0x1B,0x12,0x30,0x78,0xE3,0xF8,0x3C,
    0x00,0x3F,0xF8,0x00,0xFE,0x0C,0x4C,0x4D,0xD3,0x1B,0x12,0x30,0x78,0xE3,0xF8,0x3C,
    0x00,0x3F,0xFC,0x01,0xFE,0x0F,0xCF,0xC5,0xF2,0x12,0x24,0x30,0x81,0x16,0x48,0x60,
    0x00,0x3F,0xFF,0x01,0xFE,0x08,0x08,0x06,0x62,0x12,0x24,0x20,0x82,0x14,0x88,0x40,
    0x00,0x3F,0xFF,0xFF,0xFE,0x08,0x08,0x06,0x63,0x26,0x26,0x60,0x83,0x24,0x88,0x40,
    0x00,0x0F,0xFF,0xFF,0xFE,0x07,0x07,0x04,0x41,0xC4,0x63,0xE4,0x71,0xC0,0x92,0x39,
    0x00,0x0F,0xFF,0xFF,0xFE,0x07,0x07,0x04,0x41,0xC4,0x63,0xE4,0x71,0xC0,0x92,0x39,
    0x00,0x07,0xFF,0xFF,0xFC,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,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,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,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,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,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    }; //图像数据

    /*****************************************
    *
    * N ms延时函数
    *
    ****************************************/
    void delay_nms(unsigned int n)
    {
    unsigned int i=0;
    for (i=0;i<n;i++)
    delay_1ms();
    }


    void write_com(unsigned int com)
    {
    //lcdrs = 0;
    P2OUT&= 0xfd;
    P1OUT = com;
    delay_nms(5);
    //lcden = 1;
    P2OUT|= 0x01;
    delay_nms(5);
    P2OUT&= 0xfe;
    }

    void write_dat(unsigned int dat)
    {
    //lcdrs = 1;
    P2OUT |= 0x02;
    P1OUT = dat;
    delay_nms(5);
    //lcden=1;
    P2OUT|= 0x01;
    delay_nms(5);
    // lcden=0;
    P2OUT&= 0xfe;

    }
    void disp_12864(uchar addr,const uchar *pt,uchar num)
    {
    uchar i;
    write_com(addr);
    for(i=0;i<(num*2);i++)
    write_dat(*(pt++));
    }
    void init()
    {
    //PSB=1;//并口模式
    P2OUT |= BIT2;
    delay_nms(15);
    //EN=0;
    P2OUT&= 0xfe;
    delay_nms(5);
    write_com(0x30);
    delay_nms(1);
    write_com(0x08);//清屏
    delay_nms(1);
    write_com(0x0c);//开显示,关光标
    delay_nms(1);
    write_com(0x01);
    delay_nms(1);
    write_com(0x06);//第一行显示位置
    delay_nms(1);
    }

    void lcd12864_image(const unsigned char *p)
    {
    int x,y;
    write_com(0x34); //扩展指令集动作,绘图显示OFF
    for (y=0;y<32;y++) //送上半屏显示数据
    {
    write_com(0x80|y); //送显示Y坐标0x80-0x9f
    write_com(0x80); //送显示X坐标0x80
    for (x=0;x<16;x++)
    {
    write_dat(*p);
    p++;
    }
    }

    for (y=0;y<32;y++) //送下半屏显示数据
    {
    write_com(0x80|y); //送显示Y坐标0x80-0x9f
    write_com(0x88); //送显示X坐标0x88
    for (x=0;x<16;x++)
    {
    write_dat(*p);
    p++;
    }
    }
    write_com(0x36); //扩展指令集动作,绘图显示ON
    }

    void main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    P1DIR |= 0xff; // P1.2 output
    P2DIR |= 0xff;
    init();

    write_com(0x01); //清除显示(清零DDRAM)

    lcd12864_image(ucpic); //送图像显示数据
    delay_nms(5000);
    while(1);
    }

复制代码

点评

谢过。。  详情 回复 发表于 2013-8-3 15:42
unsigned char table[]=\\\"EE-LaunchPad\\\";数组这样定义会报错啊  详情 回复 发表于 2012-7-12 21:27
 
 

回复

52

帖子

0

TA的资源

一粒金砂(中级)

板凳
 
很敬业,加油!
 
 
 

回复

7228

帖子

192

TA的资源

五彩晶圆(高级)

4
 

回复 板凳 lxttian 的帖子

多谢支持啊 多谢
 
 
 

回复

232

帖子

0

TA的资源

一粒金砂(中级)

5
 
很好,顶一下
 
 
 

回复

7228

帖子

192

TA的资源

五彩晶圆(高级)

6
 

回复 5楼 yzl624358 的帖子

x谢谢支持 谢谢
 
 
 

回复

38

帖子

0

TA的资源

一粒金砂(中级)

7
 

回复 沙发 常见泽1 的帖子

unsigned char table[]=\"EE-LaunchPad\";数组这样定义会报错啊

点评

把斜杠去掉 这个代码输入的格式 有问题 我复制进去的是没有斜杠的 unsigned char table[]=\"EE-LaunchPad\"; 我输入的是这个 但是用代码格式输入会出现那个斜杠  详情 回复 发表于 2012-7-13 09:19
 
 
 

回复

7228

帖子

192

TA的资源

五彩晶圆(高级)

8
 

回复 7楼 tanfeng193 的帖子

把斜杠去掉 这个代码输入的格式 有问题 我复制进去的是没有斜杠的
unsigned char table[]="EE-LaunchPad"; 我输入的是这个 但是用代码格式输入会出现那个斜杠
 
 
 

回复

10

帖子

0

TA的资源

一粒金砂(中级)

9
 

学弟一直没看懂~

请问  程序中的
void disp_12864(uchar addr,const uchar *pt,uchar num)
{
uchar i;
write_com(addr);
for(i=0;i<(num*2);i++)
write_dat(*(pt++));
}

这个子程序是什么作用啊?
 
 
 

回复

22

帖子

0

TA的资源

一粒金砂(中级)

10
 
放这么大的一个数组,IAR编译器会说堆栈溢出怎么办?

点评

我的木有提示 溢出 你用的2231?  详情 回复 发表于 2012-7-30 15:37
 
 
 

回复

7228

帖子

192

TA的资源

五彩晶圆(高级)

11
 

回复 10楼 暴风雪282 的帖子

我的木有提示 溢出 你用的2231?
 
 
 

回复

22

帖子

0

TA的资源

一粒金砂(中级)

12
 
不好意思啊,看不到我的消息回复...我用的是2553啊,还是放不下,说是要压缩.
 
 
 

回复

20

帖子

0

TA的资源

一粒金砂(初级)

13
 
好崇拜你啊
 
 
 

回复

76

帖子

0

TA的资源

一粒金砂(中级)

14
 
来个串口的啊
 
 
 

回复

7

帖子

1

TA的资源

一粒金砂(初级)

15
 

回复 沙发常见泽1 的帖子

谢过。。
 
 
 

回复

135

帖子

0

TA的资源

一粒金砂(中级)

16
 
厉害,板凳板凳
 
 
 

回复

977

帖子

4

TA的资源

纯净的硅(中级)

17
 
其实可以使用网页版ps,调整一下阈值,可以获得更好的取模效果
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/7 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表