资 源 简 介
/*=================================================================
4扫16*16下入上出C语言程序, 低位起笔,数据反相。
预定义
**************************************************************/
#include
#include //可使用其中定义的宏来访问绝对地址?
bit ture=1; // 使能正反相位选择
bit false=0; // 使能反相
sbit SCK=P3^6; // EQU 0B6H ; 移位
sbit RCK=P3^5; //EQU 0B5H ; 并行锁存
//sbit P1_3=P1^3; //外RAM扩展读写控制,不能重复申明
sbit EN1=P1^7; //BIT
sbit FB=0xD8; // FB作为标志
sfr BUS_SPEED=0xA1; //访问片外RAM速度设置寄存器
sfr P4SW=0xBB; //P4SW寄存器设置P4.4,P4.5,P4.6的功能
sfr P4=0xC0; // P4 EQU 0C0H
sbit NC=P4^4;
sbit CS=P4^6; //片选
sfr WDT_CONTR=0xC1; // 0C1H ;看门狗寄存器
sfr AUXR=0x8E; // EQU 08EH ;附件功能控制寄存器
sfr16 DPTR=0x82;
sfr CLK_DIV=0x97 ; //时钟分频寄存器
const unsigned int code All_zk =256 ; // 0E11H ;原数据总字节
const unsigned int code am_zk =128 ; // 0E13H ;单幕数据量
const unsigned char code asp = 255; // asp数据相位字,如果是正相字,那么asp=0
bit basp=1; // asp数据相位字标记,如果是正相字,那么basp=0
const unsigned char code font[]= // 晶科电子LED数码(反相字)
{0xBD,0x81,0xEF,0xFF,0xBD,0x81,0xF7,0xFF,0xEF,0xEB,0x80,0x9F,0xEF,0x8F,0xEF,0xEF,0x7F,0x7B,0x7B,0x7F,0xBF,0xEF,0xEF,0xFF,0x7F,0x00,0xFF,0xFF,0xFF,0x80,0xFE,0xFF,
0x81,0xBD,0x0F,0x0F,0x81,0xBD,0xF0,0xF0,0xEF,0xED,0xE7,0xE1,0xEF,0xE1,0xEE,0xEE,0x7F,0x7B,0x7B,0x7F,0xBF,0xEF,0xEF,0xFF,0x7F,0x7F,0x7F,0x03,0xFF,0xFF,0xFF,0xF0,
0xBD,0x81,0xEF,0xEF,0xBD,0x81,0xF7,0xF7,0xEF,0x2E,0xC7,0xEF,0xEF,0xEE,0xED,0xED,0xFF,0x03,0x03,0x7F,0x80,0xE0,0xE0,0xFF,0x5F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFB,
0xFF,0xBD,0xFF,0x0F,0xFF,0xBD,0xFF,0xF0,0xEF,0xEF,0xAB,0xEF,0xEF,0xEF,0xED,0xED,0xFF,0x7B,0x7B,0x03,0xFF,0xEF,0xEF,0xE0,0xBF,0x7F,0x7F,0xFF,0xFF,0xFF,0xDF,0xFD,
0xBD,0xFD,0xFD,0xFF,0xBD,0xED,0xBD,0xFF,0xDD,0xBD,0xDD,0xFF,0xFF,0xFF,0xFF,0xFF,0xCF,0xEF,0x00,0xEF,0xEB,0xEB,0x81,0xFB,0xC3,0xDA,0xF7,0xFF,0xDF,0xDF,0xEE,0xFF,
0x80,0xFD,0xFD,0xFF,0xC0,0xED,0xED,0xFF,0xE0,0xBD,0xBD,0xFF,0xFF,0xFF,0xFF,0xFF,0xB3,0x00,0xC7,0x6D,0x8D,0xEB,0xDD,0xF3,0xDB,0xDB,0xFB,0x40,0xDF,0xDF,0xEE,0xE0,
0xFF,0xFD,0xFD,0xFF,0xFF,0xFD,0xED,0xFF,0xFF,0xBD,0xBD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xB7,0x2B,0xAB,0xDE,0xF7,0xDD,0xFB,0xFB,0x5B,0xC3,0xF7,0xEB,0xD0,0xEE,0xEF,
0xFF,0xFD,0xFD,0xF8,0xFF,0xBD,0xE1,0xC0,0xFF,0xBD,0xBD,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xD3,0xED,0xC7,0xFF,0xF7,0xDC,0xFB,0xFF,0xDB,0xD9,0xF7,0xF7,0xDF,0xC0,0xEE};
const unsigned char data xzL_data =0x08; //0603H;一幕一行字节数
const unsigned int data aL_data =0x20; //单幕单号线(单组线)数据量
const unsigned char data mov =0x03A ; //移动速度
const unsigned int data t_T =0x040A ; //0E0AH ; 05FAH; ;停留时间
const unsigned char data mu_num=0x02 ; //0602H ;幕数
unsigned int m; //m幕长变量<=am_zk
unsigned char data_z; //数据寄存器
unsigned int xd; //数据指针寄存器
/***********************************************************************
数据转移子函数
===============================================================*/
char MOVD()
{
unsigned char f,nm; //nm幕数控制
unsigned char code *dptr;
unsigned char xdata *xdptr = 0;
f = asp ;
for (m=0; m>=1;
}while(--b);
} //控制单组数据量
++P4,RCK=1,RCK=0;
}while(--o); //4组线数据传完?
}
/*====================================================================================
主程序及运行程序
=====================================*/
main()
{
unsigned int a,e; //16行循环变量
unsigned char b; //
unsigned char bdata bb,bbb; //可位操作变量
unsigned char L,nm,v;
P1_3=0; //允许写入RAM,由P1.3通过三极管控制RAM的29(WE)脚.
CLK_DIV=0; //时钟分频寄存器0为1T速度。
P4SW=0x50; //将P4.4,P4.6设置为I/O口,P4.5为ALE
AUXR=0x17; //关闭片内扩展RAM,允许外扩RAM等
NC = basp ; //不用,设为0
CS=0 ; //开通外扩RAM(的片选CS)
P1 = 0;
MOVD(); //调子函数
recom();
EN1=ture;
P1_3=1 ; //*关闭RAM的写允许WE.程序运行时总是关闭WE,否则会使数据出错。
do{
xd=0, nm=mu_num ; //nm控制幕数,v控制移动速度 , v=mov
do{ //
for(L=0; L<16; ++L) //16代表移动一幕
{
for(v=0; v