英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流

 找回密码
 立即注册
搜索
电子烟方案单片机单片机开发深圳单片机开发
单片机方案国产单片机8位单片机电子烟方案开发
查看: 5198|回复: 4
打印 上一主题 下一主题

刚调试通过的LED循环走字屏程序 转

[复制链接]
跳转到指定楼层
1#
发表于 2012-8-21 18:58:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
还从中发现一个问题,这个程序用PICC9。65和谐版,就不能编译通过,而用PICC9。5却可以编译通过。 3、PICC9。65报错是因为定义了大数组(可能超2K了,涉及程序空间跨页问题了),就无法编译通过了,而用PICC9。5却没有这个问题,看来PICC9。65和谐版还有一些不尽如人意的地方啦。
4、所以忍痛割爱卸掉了9。65 又装上了PICC9。5,是网友木鱼( QQ: 362862933)帮助发现这一问题,在此表示感谢!!
程序如下:各位可以不防一试(C编译器)
// A B C D 对应RB0; RB1 ;RB2; RB3//
//------------------------------//
//用到了单片机9个端口 RB0-RB7,和RA0//
//晶振频率使用20MHz。
//单片机型号为16F877A
#include "pic.h"
__CONFIG(HS&WDTEN&PWRTEN&BOREN&LVPDIS&DEBUGDIS&UNPROTECT&WP3);
#define  uchar unsigned char
#define  uint  unsigned int
void Keyscan (void); //修改参数按键扫描子程序
void  Sendping(); //发送半屏子程序
#define clk RB5
#define rclk RB4  //锁存用的
#define red RB6
#define green RB7   //试验证明,RB7可能接的是红色。
uchar wei; //左移一位记录
uchar word; //显示字记录
uchar hang; //行扫描
uchar sec50; //左移时间
const uchar speed=100; //速度值.
bit l;
#define gen RA0 //行扫描使能端,低电平有效,试验证明,此脚一直为低电平不用控制也可。
uchar const hanzi[][32]={
{//电[16*16]横排0
0x01,0x00,0x01,0x00,
0x01,0x00,0x3F,0xF8,
0x21,0x08,0x21,0x08,
0x3F,0xF8,0x21,0x08,
0x21,0x08,0x21,0x08,
0x3F,0xF8,0x21,0x08,
0x01,0x02,0x01,0x02,
0x00,0xFE,0x00,0x00},
{//气[16*16]横排1
0x08,0x00,0x08,0x00,
0x1F,0xFE,0x10,0x00,
0x20,0x00,0x4F,0xF8,
0x00,0x00,0x1F,0xF0,
0x00,0x10,0x00,0x10,
0x00,0x10,0x00,0x10,
0x00,0x0A,0x00,0x0A,
0x00,0x06,0x00,0x02},
{//自[16*16]横排2
0x01,0x00,0x01,0x80,
0x02,0x00,0x1F,0xF8,
0x10,0x08,0x10,0x08,
0x1F,0xF8,0x10,0x08,
0x10,0x08,0x10,0x08,
0x1F,0xF8,0x10,0x08,
0x10,0x08,0x10,0x08,
0x1F,0xF8,0x10,0x08},
{//动[16*16]横排3
0x00,0x20,0x00,0x20,
0x7E,0x20,0x00,0x20,
0x00,0xFC,0xFF,0x24,
0x10,0x24,0x10,0x24,
0x24,0x24,0x22,0x24,
0x4F,0x44,0xFA,0x44,
0x40,0x84,0x01,0x14,
0x02,0x08,0x00,0x00},
{//化[16*16]横排4
0x08,0x80,0x0C,0x80,
0x08,0x88,0x10,0x8C,
0x10,0x98,0x30,0xB0,
0x50,0xE0,0x90,0xC0,
0x11,0x80,0x12,0x80,
0x14,0x80,0x10,0x84,
0x10,0x84,0x10,0x84,
0x10,0x7C,0x00,0x00},
{//方[16*16]横排5
0x02,0x00,0x01,0x00,
0x00,0x80,0xFF,0xFE,
0x02,0x00,0x02,0x00,
0x03,0xF0,0x02,0x10,
0x04,0x10,0x04,0x10,
0x08,0x10,0x08,0x10,
0x10,0x10,0x20,0x90,
0xC0,0x60,0x00,0x00},
{//案[16*16]横排6
0x02,0x00,0x01,0x00,
0x3F,0xFC,0x22,0x08,
0x04,0x40,0x7F,0xFC,
0x0C,0x80,0x03,0x80,
0x1E,0x60,0x01,0x20,
0x7F,0xFE,0x03,0x40,
0x0D,0x30,0x71,0x0E,
0x01,0x04,0x01,0x00},
{//及[16*16]横排7
0x00,0x00,0x3F,0xE0,
0x04,0x20,0x04,0x20,
0x04,0x40,0x04,0x40,
0x04,0xF8,0x0A,0x50,
0x0A,0x10,0x09,0x20,
0x11,0x20,0x10,0xC0,
0x21,0x20,0x42,0x18,
0x8C,0x0E,0x30,0x04},
{//电[16*16]横排8
0x01,0x00,0x01,0x00,
0x01,0x00,0x3F,0xF8,
0x21,0x08,0x21,0x08,
0x3F,0xF8,0x21,0x08,
0x21,0x08,0x21,0x08,
0x3F,0xF8,0x21,0x08,
0x01,0x02,0x01,0x02,
0x00,0xFE,0x00,0x00},
{//子[16*16]横排9
0x00,0x00,0x3F,0xF0,
0x00,0x20,0x00,0x40,
0x00,0x80,0x01,0x00,
0x01,0x00,0x01,0x04,
0xFF,0xFE,0x01,0x00,
0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,
0x05,0x00,0x02,0x00},
{//线[16*16]横排10
0x10,0x40,0x18,0x50,
0x10,0x4C,0x20,0x48,
0x23,0xFC,0x48,0x40,
0xF8,0x40,0x13,0xFE,
0x20,0x40,0x7C,0x48,
0x00,0x30,0x00,0x22,
0x1C,0xD2,0xE3,0x0A,
0x00,0x06,0x00,0x02},

{//路[16*16]横排11
0x00,0x80,0x78,0x80,
0x48,0xFC,0x49,0x88,
0x4A,0x48,0x7C,0x50,
0x50,0x20,0x10,0x58,
0x5D,0x86,0x53,0xFC,
0x51,0x08,0x51,0x08,
0x5D,0x08,0xE1,0xF8,
0x01,0x08,0x00,0x00},
{//设[16*16]横排12
0x40,0x00,0x21,0xF0,
0x31,0x10,0x21,0x10,
0x01,0x10,0x01,0x10,
0xE2,0x0E,0x25,0xF8,
0x21,0x08,0x21,0x08,
0x20,0x90,0x20,0x90,
0x28,0x60,0x30,0x90,
0x23,0x0E,0x0C,0x04},
{//计[16*16]横排13
0x40,0x20,0x20,0x20,
0x30,0x20,0x20,0x20,
0x00,0x20,0xF3,0xFE,
0x10,0x20,0x10,0x20,
0x10,0x20,0x10,0x20,
0x10,0x20,0x12,0x20,
0x14,0x20,0x18,0x20,
0x10,0x20,0x00,0x20},
{//开[16*16]横排14
0x00,0x00,0x7F,0xFE,
0x04,0x20,0x04,0x20,
0x04,0x20,0x04,0x20,
0xFF,0xFE,0x04,0x20,
0x04,0x20,0x04,0x20,
0x08,0x20,0x08,0x20,
0x10,0x20,0x20,0x20,
0x40,0x20,0x00,0x00},
{//发[16*16]横排15
0x02,0x00,0x22,0x40,
0x22,0x30,0x22,0x10,
0x7F,0xFE,0x24,0x00,
0x04,0x00,0x07,0xE0,
0x0C,0x20,0x0A,0x20,
0x0A,0x20,0x11,0x40,
0x20,0x80,0x41,0x60,
0x86,0x1C,0x18,0x08},
{//,[16*16]横排16
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x30,0x00,
0x30,0x00,0x10,0x00,
0x20,0x00,0x00,0x00},
{//只[16*16]横排17
0x00,0x00,0x1F,0xF8,
0x10,0x08,0x10,0x08,
0x10,0x08,0x10,0x08,
0x10,0x08,0x1F,0xF8,
0x10,0x08,0x04,0x20,
0x06,0x10,0x0C,0x08,
0x18,0x0C,0x30,0x06,
0x40,0x04,0x00,0x00},

{//要[16*16]横排18
0x00,0x00,0xFF,0xFE,
0x04,0x40,0x3F,0xF8,
0x24,0x48,0x24,0x48,
0x3F,0xF8,0x24,0x08,
0x04,0x00,0xFF,0xFE,
0x08,0x10,0x0E,0x20,
0x01,0xC0,0x06,0x30,
0x18,0x0C,0x60,0x08},
{//您[16*16]横排19
0x08,0x00,0x09,0x00,
0x11,0xFE,0x12,0x04,
0x34,0x40,0x32,0x50,
0x52,0x48,0x94,0x44,
0x11,0x44,0x10,0x80,
0x00,0x00,0x29,0x04,
0x28,0x92,0x68,0x12,
0x07,0xF0,0x00,0x00},
{//有[16*16]横排20
0x01,0x00,0x01,0x00,
0x7F,0xFE,0x02,0x00,
0x04,0x00,0x0F,0xF0,
0x18,0x10,0x28,0x10,
0x4F,0xF0,0x88,0x10,
0x08,0x10,0x0F,0xF0,
0x08,0x10,0x08,0x90,
0x08,0x70,0x08,0x20},
{//控[16*16]横排21
0x10,0x00,0x10,0x20,
0x10,0x10,0xFD,0xFE,
0x11,0x04,0x10,0x50,
0x14,0x8C,0x19,0x04,
0x30,0x00,0xD1,0xFC,
0x10,0x20,0x10,0x20,
0x10,0x20,0x10,0x20,
0x53,0xFE,0x20,0x00},
{//制[16*16]横排22
0x24,0x04,0x34,0x04,
0x24,0x24,0x3F,0xA4,
0x44,0x24,0x04,0x24,
0x7F,0xA4,0x04,0x24,
0x3F,0xA4,0x24,0xA4,
0x24,0xA4,0x24,0xA4,
0x24,0x84,0x27,0x84,
0x05,0x14,0x04,0x08},
{//思[16*16]横排23
0x00,0x00,0x1F,0xF8,
0x11,0x08,0x11,0x08,
0x1F,0xF8,0x11,0x08,
0x11,0x08,0x1F,0xF8,
0x00,0x00,0x01,0x00,
0x08,0x88,0x48,0x84,
0x48,0x16,0xC8,0x12,
0x07,0xF0,0x00,0x00},
{//路[16*16]横排24
0x00,0x80,0x78,0x80,
0x48,0xFC,0x49,0x88,
0x4A,0x48,0x7C,0x50,
0x50,0x20,0x10,0x58,
0x5D,0x86,0x53,0xFC,
0x51,0x08,0x51,0x08,
0x5D,0x08,0xE1,0xF8,
0x01,0x08,0x00,0x00},
{//,[16*16]横排25
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x30,0x00,
0x30,0x00,0x10,0x00,
0x20,0x00,0x00,0x00},
{//我[16*16]横排26
0x06,0x40,0x38,0x50,
0x08,0x48,0x08,0x48,
0x08,0x40,0xFF,0xFE,
0x08,0x40,0x08,0x48,
0x0E,0x28,0x38,0x30,
0xC8,0x20,0x08,0x50,
0x09,0x92,0x08,0x0A,
0x28,0x06,0x10,0x02},
{//们[16*16]横排27
0x0A,0x00,0x09,0x00,
0x11,0xBC,0x11,0x04,
0x34,0x04,0x24,0x04,
0x64,0x04,0xA4,0x04,
0x24,0x04,0x24,0x04,
0x24,0x04,0x24,0x04,
0x24,0x04,0x24,0x14,
0x24,0x08,0x00,0x00},
{//就[16*16]横排28
0x10,0x20,0x08,0x28,
0xFF,0x24,0x00,0x24,
0x00,0x20,0x7F,0xFE,
0x42,0x50,0x42,0x50,
0x7E,0x50,0x08,0x50,
0x2C,0x50,0x2A,0x90,
0x4A,0x92,0x89,0x12,
0x2A,0x0E,0x10,0x00},

{//会[16*16]横排29
0x01,0x00,0x01,0x00,
0x02,0x80,0x04,0x40,
0x08,0x20,0x10,0x18,
0x6F,0xEE,0x80,0x04,
0x00,0x00,0x3F,0xF8,
0x02,0x00,0x04,0x20,
0x08,0x10,0x11,0xF8,
0x3F,0x18,0x10,0x10},
{//以[16*16]横排30
0x00,0x10,0x24,0x10,
0x22,0x10,0x23,0x10,
0x22,0x10,0x20,0x10,
0x20,0x10,0x21,0x10,
0x22,0x10,0x2C,0x30,
0x38,0x30,0x70,0x68,
0x20,0xC4,0x01,0x07,
0x06,0x02,0x00,0x00},
{//经[16*16]横排31
0x10,0x00,0x11,0xFC,
0x20,0x08,0x20,0x10,
0x48,0x30,0xF0,0xC8,
0x13,0x06,0x20,0x02,
0x41,0xFC,0xF8,0x20,
0x00,0x20,0x00,0x20,
0x18,0x20,0xE3,0xFE,
0x00,0x00,0x00,0x00},
{//济[16*16]横排32
0x40,0x80,0x20,0x40,
0x27,0xFE,0x01,0x10,
0x88,0xA0,0x48,0x40,
0x51,0xB0,0x16,0x0E,
0x11,0x10,0x21,0x10,
0xE1,0x10,0x21,0x10,
0x22,0x10,0x22,0x10,
0x24,0x10,0x28,0x10},
{//、[16*16]横排33
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x60,0x00,
0x30,0x00,0x10,0x00,
0x00,0x00,0x00,0x00},
{//合[16*16]横排34
0x01,0x00,0x02,0x80,
0x04,0x40,0x08,0x20,
0x10,0x18,0x20,0x2E,
0xDF,0xF4,0x00,0x00,
0x00,0x00,0x1F,0xF0,
0x10,0x10,0x10,0x10,
0x10,0x10,0x1F,0xF0,
0x10,0x10,0x00,0x00},
{//理[16*16]横排35
0x00,0x00,0x03,0xFC,
0xFA,0x44,0x22,0x44,
0x23,0xFC,0x22,0x44,
0xFA,0x44,0x23,0xFC,
0x22,0x44,0x20,0x40,
0x23,0xFC,0x38,0x40,
0xC0,0x40,0x00,0x40,
0x0F,0xFE,0x00,0x00},
{//、[16*16]横排36
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x60,0x00,
0x30,0x00,0x10,0x00,
0x00,0x00,0x00,0x00},
{//可[16*16]横排37
0x00,0x00,0x7F,0xFE,
0x00,0x08,0x00,0x08,
0x1F,0x88,0x10,0x88,
0x10,0x88,0x10,0x88,
0x10,0x88,0x1F,0x88,
0x10,0x88,0x00,0x08,
0x00,0x48,0x00,0x28,
0x00,0x10,0x00,0x00},
{//靠[16*16]横排38
0x01,0x00,0x11,0x00,
0x1F,0xF8,0x21,0x00,
0x7F,0xFE,0x10,0x10,
0x10,0x10,0x1F,0xF0,
0x04,0x40,0x7C,0x7E,
0x04,0x40,0x3C,0x7C,
0x04,0x40,0xFC,0x7E,
0x04,0x40,0x04,0x40},
{//的[16*16]横排39
0x10,0x80,0x10,0x80,
0x20,0x80,0x7C,0xFC,
0x45,0x04,0x45,0x04,
0x46,0x04,0x7C,0x84,
0x44,0x44,0x44,0x64,
0x44,0x24,0x44,0x04,
0x7C,0x04,0x44,0x28,
0x40,0x10,0x00,0x00},
{//方[16*16]横排40
0x02,0x00,0x01,0x00,
0x00,0x80,0xFF,0xFE,
0x02,0x00,0x02,0x00,
0x03,0xF0,0x02,0x10,
0x04,0x10,0x04,0x10,
0x08,0x10,0x08,0x10,
0x10,0x10,0x20,0x90,
0xC0,0x60,0x00,0x00},
{//案[16*16]横排41
0x02,0x00,0x01,0x00,
0x3F,0xFC,0x22,0x08,
0x04,0x40,0x7F,0xFC,
0x0C,0x80,0x03,0x80,
0x1E,0x60,0x01,0x20,
0x7F,0xFE,0x03,0x40,
0x0D,0x30,0x71,0x0E,
0x01,0x04,0x01,0x00},
{//助[16*16]横排42
0x00,0x20,0x3E,0x20,
0x22,0x20,0x22,0x20,
0x22,0xFC,0x3E,0x24,
0x22,0x24,0x22,0x24,
0x3E,0x24,0x22,0x24,
0x22,0x44,0x27,0x44,
0xF8,0x84,0x01,0x14,
0x02,0x08,0x00,0x00},
{//您[16*16]横排43
0x08,0x00,0x09,0x00,
0x11,0xFE,0x12,0x04,
0x34,0x40,0x32,0x50,
0x52,0x48,0x94,0x44,
0x11,0x44,0x10,0x80,
0x00,0x00,0x29,0x04,
0x28,0x92,0x68,0x12,
0x07,0xF0,0x00,0x00},
{//实[16*16]横排44
0x01,0x00,0x00,0x80,
0x3F,0xFE,0x28,0x04,
0x46,0x88,0x04,0x80,
0x08,0x80,0x06,0x80,
0x04,0x80,0x7F,0xFE,
0x00,0x80,0x01,0x40,
0x02,0x20,0x04,0x10,
0x18,0x18,0x60,0x10},
{//现[16*16]横排45
0x00,0x00,0xFF,0xF8,
0x12,0x08,0x12,0x48,
0x12,0x48,0x12,0x48,
0x7E,0x48,0x12,0x48,
0x12,0x48,0x12,0xA8,
0x1C,0xA0,0xE1,0x22,
0x01,0x22,0x02,0x22,
0x04,0x1E,0x08,0x00},
{//。[16*16]横排46
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x30,0x00,0x48,0x00,
0x48,0x00,0x30,0x00,
0x00,0x00,0x00,0x00},
{//迁[16*16]横排47
0x00,0x00,0x40,0x3C,
0x37,0xC0,0x20,0x40,
0x00,0x40,0x00,0x40,
0xEF,0xFE,0x20,0x40,
0x20,0x40,0x20,0x40,
0x20,0x40,0x20,0x40,
0x20,0x40,0x50,0x00,
0x8F,0xFE,0x00,0x00},
{//安[16*16]横排48
0x02,0x00,0x01,0x00,
0x3F,0xFE,0x20,0x04,
0x44,0x08,0x06,0x00,
0x04,0x00,0xFF,0xFE,
0x08,0x20,0x08,0x20,
0x08,0x40,0x06,0x80,
0x01,0x00,0x06,0xC0,
0x18,0x38,0xE0,0x10},
{//机[16*16]横排49
0x10,0x00,0x10,0xF8,
0x10,0x88,0xFE,0x88,
0x10,0x88,0x10,0x88,
0x38,0x88,0x34,0x88,
0x54,0x88,0x50,0x88,
0x91,0x08,0x11,0x0A,
0x12,0x0A,0x12,0x0A,
0x14,0x06,0x10,0x00},
{//电[16*16]横排50
0x01,0x00,0x01,0x00,
0x01,0x00,0x3F,0xF8,
0x21,0x08,0x21,0x08,
0x3F,0xF8,0x21,0x08,
0x21,0x08,0x21,0x08,
0x3F,0xF8,0x21,0x08,
0x01,0x02,0x01,0x02,
0x00,0xFE,0x00,0x00},
{//欢[16*16]横排50
0x00,0x80,0x00,0x80,
0xFC,0x80,0x05,0xFE,
0x85,0x04,0x4A,0x48,
0x28,0x40,0x10,0x40,
0x18,0x40,0x18,0x60,
0x24,0xA0,0x24,0x90,
0x41,0x18,0x86,0x0E,
0x38,0x04,0x00,0x00},
{//迎[16*16]横排52
0x40,0x00,0x21,0x80,
0x36,0x7C,0x24,0x44,
0x04,0x44,0x04,0x44,
0xE4,0x44,0x24,0x44,
0x25,0x44,0x26,0x54,
0x24,0x48,0x20,0x40,
0x20,0x40,0x50,0x00,
0x8F,0xFE,0x00,0x00},
{//您[16*16]横排53
0x08,0x00,0x09,0x00,
0x11,0xFE,0x12,0x04,
0x34,0x40,0x32,0x50,
0x52,0x48,0x94,0x44,
0x11,0x44,0x10,0x80,
0x00,0x00,0x29,0x04,
0x28,0x92,0x68,0x12,
0x07,0xF0,0x00,0x00},

{//的[16*16]横排54
0x10,0x80,0x10,0x80,
0x20,0x80,0x7C,0xFC,
0x45,0x04,0x45,0x04,
0x46,0x04,0x7C,0x84,
0x44,0x44,0x44,0x64,
0x44,0x24,0x44,0x04,
0x7C,0x04,0x44,0x28,
0x40,0x10,0x00,0x00},
{//光[16*16]横排55
0x01,0x00,0x21,0x10,
0x19,0x18,0x0D,0x10,
0x09,0x20,0x01,0x04,
0x7F,0xFE,0x04,0x40,
0x04,0x40,0x04,0x40,
0x04,0x40,0x08,0x42,
0x08,0x42,0x10,0x42,
0x20,0x3E,0x40,0x00},
{//临[16*16]横排56
0x01,0x00,0x09,0x80,
0x09,0x00,0x49,0xFE,
0x4A,0x20,0x4A,0x10,
0x4C,0x10,0x49,0x04,
0x49,0xFE,0x49,0x24,
0x49,0x24,0x49,0x24,
0x49,0x24,0x09,0xFC,
0x09,0x04,0x00,0x00},
{//![16*16]横排57
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,
0x10,0x00,0x10,0x00,
0x10,0x00,0x10,0x00,
0x10,0x00,0x10,0x00,
0x10,0x00,0x10,0x00,
0x10,0x00,0x00,0x00,
0x10,0x00,0x00,0x00},

{//TE[16*16]横排58
0x00,0x00,0xFF,0x7F,
0x10,0x40,0x10,0x40,
0x10,0x40,0x10,0x40,
0x10,0x40,0x10,0x7E,
0x10,0x40,0x10,0x40,
0x10,0x40,0x10,0x40,
0x10,0x40,0x10,0x40,
0x10,0x7F,0x00,0x00},
{//L:[16*16]横排59
0x00,0x00,0xE0,0x00,
0x40,0x00,0x40,0xC0,
0x40,0xC0,0x40,0x00,
0x40,0x00,0x40,0x00,
0x40,0x00,0x40,0xC0,
0x40,0xC0,0x40,0x00,
0x42,0x00,0xFE,0x00,
0x00,0x00,0x00,0x00},
{//15 [16*16]横排60
0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x7E,
0x70,0x40,0x10,0x40,
0x10,0x40,0x10,0x58,
0x10,0x64,0x10,0x02,
0x10,0x02,0x10,0x42,
0x10,0x44,0x7C,0x38,
0x00,0x00,0x00,0x00},

{//93 [16*16]横排61
0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x3C,
0x24,0x42,0x42,0x42,
0x42,0x04,0x42,0x18,
0x26,0x04,0x1A,0x02,
0x02,0x02,0x02,0x42,
0x24,0x44,0x38,0x38,
0x00,0x00,0x00,0x00},
{//25 [16*16]横排62
0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x7E,
0x42,0x40,0x42,0x40,
0x42,0x40,0x04,0x58,
0x04,0x64,0x08,0x02,
0x10,0x02,0x20,0x42,
0x42,0x44,0x7E,0x38,
0x00,0x00,0x00,0x00},

{//99 [16*16]横排63
0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x18,
0x24,0x24,0x42,0x42,
0x42,0x42,0x42,0x42,
0x26,0x26,0x1A,0x1A,
0x02,0x02,0x02,0x02,
0x24,0x24,0x38,0x38,
0x00,0x00,0x00,0x00},
{//86 [16*16]横排64
0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x1C,
0x42,0x24,0x42,0x40,
0x42,0x40,0x24,0x58,
0x18,0x64,0x24,0x42,
0x42,0x42,0x42,0x42,
0x42,0x24,0x3C,0x18,
0x00,0x00,0x00,0x00},

{//3 [16*16]横排65
0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x00,
0x42,0x00,0x42,0x00,
0x04,0x00,0x18,0x00,
0x04,0x00,0x02,0x00,
0x02,0x00,0x42,0x00,
0x44,0x00,0x38,0x00,
0x00,0x00,0x00,0x00},

{//QQ [16*16]横排66
0x00,0x00,0x00,0x00,
0x00,0x00,0x38,0x38,
0x44,0x44,0x82,0x82,
0x82,0x82,0x82,0x82,
0x82,0x82,0x82,0x82,
0xB2,0xB2,0xCA,0xCA,
0x4C,0x4C,0x38,0x38,
0x06,0x06,0x00,0x00},

{//:5 [16*16]横排67
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x7E,
0x00,0x40,0x00,0x40,
0x18,0x40,0x18,0x58,
0x00,0x64,0x00,0x02,
0x00,0x02,0x00,0x42,
0x18,0x44,0x18,0x38,
0x00,0x00,0x00,0x00},

{//04 [16*16]横排68
0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x04,
0x24,0x0C,0x42,0x14,
0x42,0x24,0x42,0x24,
0x42,0x44,0x42,0x44,
0x42,0x7E,0x42,0x04,
0x24,0x04,0x18,0x1E,
0x00,0x00,0x00,0x00},

{//82 [16*16]横排69
0x00,0x00,0x00,0x00,
0x00,0x00,0x3C,0x3C,
0x42,0x42,0x42,0x42,
0x42,0x42,0x24,0x04,
0x18,0x04,0x24,0x08,
0x42,0x10,0x42,0x20,
0x42,0x42,0x3C,0x7E,
0x00,0x00,0x00,0x00},
{//12 [16*16]横排70
0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x3C,
0x70,0x42,0x10,0x42,
0x10,0x42,0x10,0x04,
0x10,0x04,0x10,0x08,
0x10,0x10,0x10,0x20,
0x10,0x42,0x7C,0x7E,
0x00,0x00,0x00,0x00},
{//12 [16*16]横排71
0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x3C,
0x70,0x42,0x10,0x42,
0x10,0x42,0x10,0x04,
0x10,0x04,0x10,0x08,
0x10,0x10,0x10,0x20,
0x10,0x42,0x7C,0x7E,
0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //72
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //73
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //74
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //75
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //76
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //77
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //78
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //79
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //80
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //81
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

};

void senddata(uchar datat)  //发送1个字节的串行数据子程序.
{ uchar k;
CLRWDT();
for(k=0;k<8;k++)
{
//red=!(datat&0x80);
CLRWDT();
green=!(datat&0x80); //数据为零时显示,为1时不显示.
clk=1; //时钟上升沿锁存数据.  
datat<<=1;
clk=0;
}
}
void sendwei(void)  //在中断服务程序中调用了此程序,发送位数据子程序.
{
uchar i,j; //
uchar huancun1,huancun2; //缓存局部变量.
CLRWDT();
l=0;
huancun1=hanzi[word][hang*2]; //在中断程序中对word和hang两个变量修改
huancun2=hanzi[word][hang*2+1];
j=wei;   //为一个0-15的数,在中断服务程序中,对此数的值修改
if(j>=7)
{CLRWDT();
senddata(huancun1);
j=j-7;
l=1;
}
for(i=0;i<j;i++)
{CLRWDT();
if(l==1)
  {
  //red=!(huancun2&0x80);
  green=!(huancun2&0x80);
  clk=1;
  huancun2<<=1;
  clk=0;
  }
  else
  {
  //red=!(huancun1&0x80);
  green=!(huancun1&0x80);
  clk=1;
  huancun1<<=1;
  clk=0;
  }
}
}
void sendhang(void) //在中断服务程序中调用了此程序.
{//gen=1;             //行扫描子程序,扫前先关闭显示
CLRWDT();
PORTB&=0xf0;
PORTB|=hang;
}
void clearpingandinit(void) ///清屏且初始化子程序
{uchar j,k;
CLRWDT();
ADCON1=6;//模拟量端口关闭,全设为输出端口
TRISB=0; //RB口全设为输出口
PORTB=0;  //
TRISA=0xfe; //RA0设为输出口
PORTA=0;
gen=1; //显示关闭
PORTB=0x00;
hang=0x00;
word=0x00;
wei=0x00;
sec50=0x00;
for(k=0;k<16;k++) //8改为16了
{
for(j=0;j<8;j++)
  {red=1;green=1;
clk=1;
CLRWDT();
//_nop_();
clk=0;}
  }
rclk=1;  //上升沿锁存数据.
//_nop_();
rclk=0;
  }
void clearsuocun(void) //清锁存子程序,清除64位的数据(相当于8个595的数据).
{uchar i,j;            //而我的屏8个字,用到16个595,i的值改为了16
clk=0;
rclk=0;
for(i=0;i<16;i++)  //i的值由8改为了16(韩)
{for(j=0;j<8;j++)
   {green=1; //red=1;
    CLRWDT();
   clk=1;
//_nop_();
   clk=0;
   }
}
rclk=1;
//_nop_();
rclk=0;
}
void main(void)
{CLRWDT();
clearpingandinit();
//  TR0=1;
//  TR1=1;
    INTCON=0;//所有中断全部关闭.
    OPTION=0xd3;//定时器分频为1:16,T0选用内部时钟源,B11010011
    TMR0=0;
    T0IF=0;
    T0IE=1; //开启T0中断允许.
    GIE=1;  //开启全局中断允许.

  while(1)
  {
  //GIE=0;
  //clearsuocun();
  //GIE=1;
  CLRWDT();
  }
}
void interrupt ISR(void) //每13.1ms中断16次,每中断一次只扫描一行,所以此值还要/16
{
uchar n,m;
if((T0IE==1)&&(T0IF==1))
  {T0IF=0;
   
   //gen=1;  //关闭显示
   if(word<=7)  //此段用于开始时填空字符用。
     {for(n=8-word;n>0;n--)
      {senddata(0x00); senddata(0x00);}
      m=0x00; //行头未填溢出。
     }
   else  m=word-8;     //行头填溢出了。(韩)
   for(n=m;n<word;n++)
    {senddata(hanzi[n][hang*2]);
     senddata(hanzi[n][hang*2+1]);
    }
   sendwei();
   sendhang();
   gen=1;
   rclk=1;
   gen=0;  //打开显示
   hang++;    //在定时器T0中断中更新行扫描。
   if(hang>15)  {hang=0;}
   rclk=0;
if(++sec50==speed)
  {sec50=0x00;
   wei++;
   if(wei==16) //1个字的每行有16位.
     {wei=0x00;
      word++;
      if(word==80)  //共计显示80个字.
      {word=0x00;}
     }
   }
  }
}

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

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|公司首页|Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流 ( 粤ICP备09008620号 )

GMT+8, 2024-11-24 05:09 , Processed in 0.054341 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表