刚调试通过的LED循环走字屏程序 转
还从中发现一个问题,这个程序用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);
#defineuchar unsigned char
#defineuintunsigned int
void Keyscan (void); //修改参数按键扫描子程序
voidSendping(); //发送半屏子程序
#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[]={
{//电横排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},
{//气横排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},
{//自横排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},
{//动横排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},
{//化横排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},
{//方横排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},
{//案横排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},
{//及横排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},
{//电横排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},
{//子横排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},
{//线横排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},
{//路横排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},
{//设横排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},
{//计横排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},
{//开横排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},
{//发横排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
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},
{//只横排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},
{//要横排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},
{//您横排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},
{//有横排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},
{//控横排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},
{//制横排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},
{//思横排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},
{//路横排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},
{//,横排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},
{//我横排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},
{//们横排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},
{//就横排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},
{//会横排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},
{//以横排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},
{//经横排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},
{//济横排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},
{//、横排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},
{//合横排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},
{//理横排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},
{//、横排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},
{//可横排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},
{//靠横排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},
{//的横排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},
{//方横排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},
{//案横排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},
{//助横排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},
{//您横排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},
{//实横排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},
{//现横排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},
{//。横排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},
{//迁横排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},
{//安横排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},
{//机横排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},
{//电横排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},
{//欢横排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},
{//迎横排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},
{//您横排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},
{//的横排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},
{//光横排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},
{//临横排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},
{//!横排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横排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:横排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 横排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 横排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 横排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 横排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 横排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 横排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 横排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 横排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 横排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 横排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 横排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 横排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两个变量修改
huancun2=hanzi;
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; //行头未填溢出。
}
elsem=word-8; //行头填溢出了。(韩)
for(n=m;n<word;n++)
{senddata(hanzi);
senddata(hanzi);
}
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]