我们从2011年坚守至今,只想做存粹的技术论坛。  由于网站在外面,点击附件后要很长世间才弹出下载,请耐心等待,勿重复点击不要用Edge和IE浏览器下载,否则提示不安全下载不了

 找回密码
 立即注册
搜索
查看: 911|回复: 2

LED点阵屏静态显示16*64汉字

[复制链接]

该用户从未签到

3

主题

0

回帖

0

积分

一级逆天

积分
0

终身成就奖

QQ
发表于 2016-5-16 06:44:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区

您需要 登录 才可以下载或查看,没有账号?立即注册

×
#include "msp430x14x.h"
#define LT0     P3OUT&=~BIT0
#define LT1     P3OUT|=BIT0
#define SK0     P3OUT&=~BIT1
#define SK1     P3OUT|=BIT1
#define EN0     P3OUT&=~BIT2
#define EN1     P3OUT|=BIT2
#define R0      P3OUT&=~BIT3
#define R1      P3OUT|=BIT3
#define LS      P1OUT

const char Table[]={
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0xF0,0xCF,0xE7,0xE7,0xCF,0xF3,0x9F,0xF3,0x9F,
0xF3,0x9F,0xF3,0x9F,0xF3,0x9F,0xE7,0xCF,0xCF,0xE7,0x3F,0xF8,0xFF,0xFF,0xFF,0xFF,/*"0",0*/
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x07,0xFE,0x7F,0xFE,0x7F,0xFE,0x7F,0xFE,
0x7F,0xFE,0x7F,0xFE,0x7F,0xFE,0x7F,0xFE,0x7F,0xFE,0x07,0xE0,0xFF,0xFF,0xFF,0xFF,/*"1",1*/
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0xF0,0xE7,0xC7,0xFB,0xCF,0xF3,0xCF,0xFF,0xE7,
0xFF,0xFB,0xFF,0xFC,0x3F,0xFF,0xCF,0xDF,0xF7,0xCF,0x03,0xE0,0xFF,0xFF,0xFF,0xFF,/*"2",2*/
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0xF8,0xF3,0xE3,0xF3,0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CF,0xF9,0xCF,
0xF3,0xC3,0x07,0xCC,0xFF,0xE7,0xFF,0xE7,0xF3,0xF1,0x07,0xFC,0xFF,0xFF,0xFF,0xFF,/*"9",9*/
};

void delay(unsigned int n)   //延时函数
{ unsigned int k;
   for(k=0;k<n;k++);
}

void IO_Init(void)
{
//IO初始化---------------------------------------
   P1DIR |=0xFF;                       
   P3DIR |=0xFF;
}

void SendDate(unsigned char Data)
{
unsigned char i;
for(i = 0; i < 8; i++)
{
  if(Data&0x01) R1;   //串行输出Data数据
        else   R0;
  SK0;
  Data=Data>>1;
  //_NOP();
  SK1;
  }
}

void led_show1(int i,int j,int k,int l)//静态显示16X16汉字
{
unsigned int num;
for(num=0;num<16;num++)
{
  SendDate(Table[num*2+0+32*i]);
  SendDate(Table[num*2+1+32*i]);

  SendDate(Table[num*2+0+32*j]);
  SendDate(Table[num*2+1+32*j]);
   
  SendDate(Table[num*2+0+32*k]);
  SendDate(Table[num*2+1+32*k]);

  SendDate(Table[num*2+0+32*l]);
  SendDate(Table[num*2+1+32*l]);
  EN1;    //关显示屏片选
  delay(500);  
  //_NOP();//消影
  LT1;   
  LT0;    //输出锁存
  LS=num;    //16行地址
  //_NOP();//消影
  EN0;     //开显示屏片选
}
}



void main( void )
{
  char z;
  WDTCTL = WDTPW + WDTHOLD;
  IO_Init();
   /*------选择系统主时钟为8MHz-------*/
    BCSCTL1 &= ~XT2OFF;                 //打开XT2高频晶体振荡器
    do
    {
        IFG1 &= ~OFIFG;                 //清除晶振失败标志
        for (z = 0xFF; z > 0; z--);     //等待8MHz晶体起振
    }
    while ((IFG1 & OFIFG));             //晶振失效标志仍然存在?
    BCSCTL2 |= SELM_2 + SELS;           //MCLK和SMCLK选择高频晶振
  
    while(1)
{
unsigned int i,j,k,l;
i=5;j=6;k=7;l=9;
   led_show1(i,j,k,l);
}

}
回复

使用道具 举报

该用户从未签到

20

主题

2875

回帖

3960

积分

二级逆天

积分
3960

社区居民忠实会员社区劳模最爱沙发终身成就奖优秀斑竹奖

QQ
发表于 2016-5-16 08:36:57 | 显示全部楼层
回复

使用道具 举报

该用户从未签到

52

主题

1611

回帖

564

积分

二级逆天

积分
564

终身成就奖社区居民忠实会员社区明星最爱沙发优秀斑竹奖宣传大使奖特殊贡献奖

QQ
发表于 2016-5-16 08:37:25 | 显示全部楼层
q
回复

使用道具 举报

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

本版积分规则

公告:服务器刚移机,
大家请不要下载东西。
会下载失败


Copyright ©2011-2024 NTpcb.com All Right Reserved.  Powered by Discuz! (NTpcb)

本站信息均由会员发表,不代表NTpcb立场,如侵犯了您的权利请发帖投诉

( 闽ICP备2024076463号-1 ) 论坛技术支持QQ群171867948 ,论坛问题,充值问题请联系QQ1308068381

平平安安
TOP
快速回复 返回顶部 返回列表