1. 我用74LS595做行驱动,74LS154做列驱动做了一个16×32的双色点阵,急需C语言程序,随便显示什么字。谢谢大
/*****************************************************
16*128 LED点阵屏 C 程序
******************************************************
声明:
本程序供大家学习之用,用勿用于商业用途。尊重版权。
编写:邓椿薪
时间:2006年1月20日 晚
邮箱:[email protected]
*******************************************************
//595连级输出数据,138行驱动。P0_1为移动速度高速/*点阵显示汉字程串口输出字符数据,
//P2口输出行扫描信号,P2_7输出595锁存信号。*/
#define uchar unsigned char
#define uint unsigned int
#include <REG51.H>
#include <CODESUB.H>
uchar yid,h,d=12; //YID为移动计数器,H为行段计数器。
uint zimuo,zimuo1; //字模计数器
uchar BUFF[18]; //缓存
void in_data(void); //调整数据
void rxd_data(void); //发送数据
void in_data1(char h);
void rxd_data1(void);
void sbuf_out1(void);
void sendsw(uchar k); //发送段代码
void sbuf_out(void); //16段扫描
void key(void);
sbit AN1=P3^4;
sbit AN2=P3^5;
sbit clk=P3^3;
unsigned code sw[16]={0x7f,0x6f,0x5f,0x4f,0x3f,0x2f,0x1f,0x0f,0xf7,
0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0}; /*16行段码*/
/********************************************/
void main(void)
{ uchar i;
zimuo1=sizeof(hanzi)-6*32;//(zishu+9)*32;
yid=0;
zimuo=0;
while(1)
{
while(yid<100) //数据移位。
{
for(i=0;i<D;I++) if(zimuo 后移一个字, zimuo="zimuo+32*5;//zimuo+32;" yid="0;" } 移动一步 yid++; sbuf_out1();key(); { 移动速度>zimuo1) //总数减7个字。
zimuo=0;
}
}
void sbuf_out1()
{
char i;
for(h=0;h<32;h++)
{
in_data1(h);
clk=1;
rxd_data1();
if(h>=16){i=h-16;}
else i=h;
sendsw(sw[i]);
}
}
/******************************************************/
void in_data1(char h)
{
char s,i;
if(h>=16)
{i=(h-16);
for(s=5;s>=0;s--) //h为向后先择字节计数器,zimuoo为向后先字计数器
{
// if(zimuo%32)
BUFF[2*s+1]=hanzi[zimuo+1+32*s+2*i]; //把第一个字模的第一个字节放入BUFF1中,第二个字模和第一个字节放入BUFF3中
BUFF[2*s]=hanzi[zimuo+0+32*s+2*i]; // 把第一个字模的第二个字节放入BUFF0中,第二个字模的第二个字节放入BUFF1中
}
}
else
{
i=h;
for(s=5;s>=0;s--) //h为向后先择字节计数器,zimuoo为向后先字计数器
{
// if(zimuo%32)
BUFF[2*s+1]=hanzi[zimuo+1+32*s+2*i]; //把第一个字模的第一个字节放入BUFF1中,第二个字模和第一个字节放入BUFF3中
BUFF[2*s]=hanzi[zimuo+0+32*s+2*i]; // 把第一个字模的第二个字节放入BUFF0中,第二个字模的第二个字节放入BUFF1中
}
}
}
/*******************************************************/
void rxd_data1(void) //串行发送数据
{
char s;
for(s=0;s<10;s++) //发送5字节数据
{
SBUF=255-BUFF[s];//把BUFF中的字节从大到小移位相或后发送输出。
while(!TI);TI=0; //等待发送中断
}
}
void sendsw(uchar k)
{
TI=0;
SBUF=k;
while(!TI);TI=0;
clk=0;
}
void key(void)
{
uchar a,b;
if(AN1==0)
{
for(a=0;a<10;a++)
{for(b=0;b<14;b++){}}
if(AN1==0)
{while(AN1==0)
{}
if(AN1)
{d++;
if(d>100)
d=100;
}
}
}
if(AN2==0)
{for(a=0;a<10;a++)
{for(b=0;b<14;b++){}}
if(AN2==0)
{while(AN2==0)
{}
if(AN2)
{d--;
if(d==0)
d=1;
}
}
}
}
不是我写的,但我想会对你有用。
2. 用74HC595驱动16×16点阵显示中文 C语言程序和仿真 谢谢!!!
这个图片会压小。看大图到这看
http://0e.images22.51img1.com/6000/kgd235143/.jpg
要仿真的话我发给你,当然实际电路要三极管驱动
#include<reg52.h>
#defineucharunsignedchar
uchari,j,k=15;
sbitxsi=P2^0;
sbitxrck=P2^1;
sbitxsck=P2^2;
sbitysi=P2^3;
sbityrck=P2^4;
sbitysck=P2^5;
sbitkg=P3^2;
ucharcodezbm[][32]={
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF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0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,},
};
voidys(uchara) //延时
{
ucharb;
for(;a>0;a--)
for(b=100;b>0;b--) ;
}
voidyfs() //Y轴发数
{
ysck=0;
yrck=0;
k++;
if(k==16)
{
k=0;
ysi=0;
}
else
ysi=1;
ysck=1;
P2=P2|0X14;
//相当于 xrck=1; yrck=1;
}
voidxfs(uchara) //X轴发数
{
ucharb,a1,a2;
a1=~zbm[6][a*2+1];
a2=~zbm[6][a*2];
xsck=0;
xrck=0;
for(b=0;b<8;b++)
{
a1=a1<<1;
xsi=CY;
xsck=1;
xsck=0;
}
for(b=0;b<8;b++)
{
a2=a2<<1;
xsi=CY;
xsck=1;
xsck=0;
}
}
voidfs(uchara) //X轴发数
{
ucharb;
xsck=0;
xrck=0;
for(b=0;b<8;b++)
{
a=a<<1;
xsi=CY;
xsck=1;
xsck=0;
}
}
voidgdhs(uchar*zz,ucharN,ucharTime)//流动显示N个汉字 滚动函数
{//参数三个:字符串字模首地址、字数、显示流动速度
ucharFontNum,i,j,row;//循环变量,字数计数、16次流动、16列扫描
for(FontNum=0;FontNum<N;FontNum++)
{
for(i=0;i<16;i++)//字到字流动16次左移才能完成
{
for(j=0;j<Time;j++)//显示延迟,决定流动速度
{
k=15;
for(row=0;row<16;row++)//显示16*16屏幕一次
{
yfs();//选通显示列 //行选线,P3低四位
fs(~*(zz+FontNum*32+(i+row)*2+1));//以移动偏移为基础获取新数据
fs(~*(zz+FontNum*32+(i+row)*2));//获取显示数据循环显示关键算法
ys(12);//适当延时
}
}
}
}
}
voidwbzd()interrupt0 //外部中断
{
j++;
if(j>1)
j=0;
ys(10);
while(!kg)
{
k=15;
for(i=0;i<16;i++)
{
yfs();
xfs(i);
ys(10);
}
}
if(j==0)
gdhs(zbm,8,2);
if(j==1)
gdhs(zbm1,10,1);
}
voidmain()
{
EA=1;//打开总中断
EX0=1;
IT0=1;
while(1)
{
if(j==0)
gdhs(zbm,8,5);
if(j==1)
gdhs(zbm1,10,3);
}
}
3. 基于51单片机88点阵编程。假设其直接由两组IO口P1 P2控制。横向滚动显示Bye,之后屏幕全黑
uchar disbuf[8] = {0};
void delay(uchar n){
uchar i;
for( ; n > 0; n--)
for(i = 0; i < 210; i++);
}
void display(){
static uchar com = 0;
P1 = 0x00;
P0 = disbuf[];
P1 = (1 << com);
com = (com + 1) % 8;
}
void SnowMove(){
uchar i;
for(i = 0; i < 8; i++){
disbuf[i] <<= 1;
if(rand() % 4 == 0)
disbuf[i] |= 1;
}
}
void CountMove(){
static uchar num = 0;
if(num++ > 100){
num = 0;
SnowMove();
}
}
void main()
{
while(1){
CountMove();
display();
delay(10);
}
}
4. ******悬赏,谁能给我编制一个最简单的12864液晶屏显示两个汉字的程序,多谢了******
刚才回答了“12864液晶屏不同型号有什么区别”你也看看吧,会有用的
你问题没问清楚12864从编程上分有两种一是有字库二是没字库
给你个通用的的你自己改吧,用的是51,我仿真过绝对能用,用点阵模块改个数组就可以变成自己的了。兄弟只用5分你赚大了,你编译的时候用有能显示注释的keil,否则注释混在里面会出错
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
#define LCDP P0
sbit E=P2^0;
sbit RW=P2^1;
sbit RS=P2^2;
sbit CS2=P2^3;
sbit CS1=P2^4;
sbit RESET=P2^5;
sbit busy=P0^7;
uchar start_line =0xc0;
//**********************************************************************************
uchar code zw[][32]={
/*-- 文字: ★ --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x40,0xC0,0xC0,0xC0,0xE0,0xFC,0xFF,0xFC,0xE0,0xC0,0xC0,0xC0,0x40,0x40,0x00,
0x00,0x00,0x40,0x39,0x3F,0x1F,0x1F,0x0F,0x1F,0x1F,0x3F,0x39,0x40,0x00,0x00,0x00,
/*-- 文字: 刘 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x08,0x28,0x49,0x8A,0x0C,0xC8,0x38,0x08,0x00,0xF8,0x00,0x00,0xFF,0x00,0x00,
0x40,0x20,0x10,0x08,0x04,0x03,0x06,0x38,0x10,0x00,0x07,0x20,0x40,0x3F,0x00,0x00,
/*-- 文字: 紫 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x20,0x3E,0x20,0x1F,0x94,0x54,0x24,0x80,0x9F,0x24,0x24,0x22,0x22,0x30,0x00,
0x00,0x40,0x24,0x1D,0x05,0x47,0x85,0x7D,0x04,0x04,0x14,0x26,0x4C,0x00,0x00,0x00,
/*-- 文字: 华 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x20,0x10,0x08,0xFC,0x03,0x02,0x10,0x10,0x7F,0x88,0x88,0x84,0x86,0xE4,0x00,0x00,
0x00,0x04,0x04,0x05,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,
/*-- 文字: ★ --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x40,0xC0,0xC0,0xC0,0xE0,0xFC,0xFF,0xFC,0xE0,0xC0,0xC0,0xC0,0x40,0x40,0x00,
0x00,0x00,0x40,0x39,0x3F,0x1F,0x1F,0x0F,0x1F,0x1F,0x3F,0x39,0x40,0x00,0x00,0x00,
/*-- 文字: 华 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x20,0x10,0x08,0xFC,0x03,0x02,0x10,0x10,0x7F,0x88,0x88,0x84,0x86,0xE4,0x00,0x00,
0x00,0x04,0x04,0x05,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,
/*-- 文字: 仔 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x80,0x40,0x30,0xFC,0x43,0x40,0x42,0x42,0x42,0xE2,0x52,0x4A,0x46,0x40,0x40,0x00,
0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: ★ --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x40,0xC0,0xC0,0xC0,0xE0,0xFC,0xFF,0xFC,0xE0,0xC0,0xC0,0xC0,0x40,0x40,0x00,
0x00,0x00,0x40,0x39,0x3F,0x1F,0x1F,0x0F,0x1F,0x1F,0x3F,0x39,0x40,0x00,0x00,0x00
};
//*************************************882222222222222&****************************
/*-- 文字: 测 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
uchar code ce[][32]={0x08,0x31,0x86,0x60,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0x00,0xFF,0x00,
0x04,0xFC,0x03,0x00,0x80,0x47,0x30,0x0F,0x10,0x67,0x00,0x07,0x40,0x80,0x7F,0x00,
/*-- 文字: 试 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x42,0xDC,0x08,0x00,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x1C,0x10,0x00,
0x00,0x00,0x7F,0x20,0x10,0x20,0x20,0x1F,0x10,0x10,0x01,0x06,0x18,0x20,0x78,0x00,
/*-- 文字: 成 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0xF8,0x48,0x48,0x48,0xC8,0x08,0xFF,0x08,0x09,0x0A,0xC8,0x88,0x08,0x00,
0x40,0x30,0x0F,0x00,0x08,0x50,0x4F,0x20,0x10,0x0B,0x0C,0x12,0x21,0x40,0xF0,0x00,
/*-- 文字: 功 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x04,0x04,0x04,0xFC,0x04,0x14,0x14,0x10,0x90,0x7F,0x10,0x10,0xF0,0x00,0x00,
0x04,0x0C,0x04,0x04,0x03,0x42,0x22,0x11,0x0C,0x23,0x20,0x60,0x20,0x1F,0x00,0x00,
/*-- 文字: 欢 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x14,0x24,0x44,0x84,0x64,0x1C,0x20,0x18,0x0F,0xE8,0x08,0x08,0x28,0x18,0x08,0x00,
0x20,0x10,0x4C,0x43,0x43,0x2C,0x20,0x10,0x0C,0x03,0x06,0x18,0x30,0x60,0x20,0x00,
/*-- 文字: 迎 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x41,0xCE,0x04,0x00,0xFC,0x04,0x02,0x02,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,
0x40,0x20,0x1F,0x20,0x40,0x47,0x42,0x41,0x40,0x5F,0x40,0x42,0x44,0x43,0x40,0x00,
/*-- 文字: 使 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x20,0xF0,0x1C,0x07,0xF2,0x94,0x94,0x94,0xFF,0x94,0x94,0x94,0xF4,0x04,0x00,
0x00,0x00,0x7F,0x00,0x40,0x41,0x22,0x14,0x0C,0x13,0x10,0x30,0x20,0x61,0x20,0x00,
/*-- 文字: 用 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x00,0xFE,0x22,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0xFE,0x00,0x00,
0x80,0x40,0x30,0x0F,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x42,0x82,0x7F,0x00,0x00};
/*-- 调入了一幅图像:F:\我的文档\刘紫华的资料\资料\字模软件\液晶字模提取软件\图例\qian.psd.bmp --*/
/*-- 宽度x高度=128x32 --*/
uchar code img[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFC,0xFC,0xFC,0xF8,0xF8,0x78,0x78,0x78,0x78,0x78,0xF8,0xF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0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x7F,0x1F,0x0F,0x0F,0x0F,0x07,0x07,0x0F,0x3F,0x4F,0x5F,0x67,0x47,0x3F,0x0F,0x07,
0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,0x1F,0x07,0x07,0x07,0x07,0x03,0x03,
0x03,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x03,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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 delay1ms(uint Xms)
{
uint i,j;
for(i=0;i<Xms;i++)
{for(j=0;j<120;j++);}
}
void check_BF()
{
RS=0; RW=1;
E=1;
LCDP=0xff;
while(!busy);
}
void write_cmd(uchar cmd)
{
check_BF();
E=1;
RS=0; RW=0;
LCDP=cmd;
E=1;
E=0;
}
void write_data(uchar dat)
{
check_BF();
E=1;
RS=1; RW=0;
LCDP=dat;
E=1;
E=0;
}
void lcdinit()
{
write_cmd(0x3f);
write_cmd(0xc0);
//write_cmd(0xb8);
//write_cmd(0x40);
}
*/
//************************************************
//测试段
//************************************************
void delay1ms(unsigned int Xms)
{
unsigned int i,j;
for(i=0;i<Xms;i++)
for(j=0;j<120;j++);
}
void check_BF()
{
E=1;
RS=0;RW=1;
P0=0xff;
while(!busy);
}
void write_cmd(unsigned char cmd)
{
check_BF();
E=1;
RS=0;RW=0;
P0=cmd;
E=1;
E=0;
}
void write_data(unsigned char dat)
{
check_BF();
E=1;
RS=1;RW=0;
P0=dat;
E=1;
E=0;
}
void lcdinit()
{
write_cmd(0xc0);
write_cmd(0x3f);
}
//************************************************
void display(uchar X,uchar Y, //uchar *P)
uchar (*P)[32])
{
uchar i,j;
CS2=0;CS1=1;
for(i=0;i<8;i++)
{if(i>=4)
{CS2=1;CS1=0;}
if(Y==0x80)
{Y=0x40;}
//write_cmd(0xC0);
write_cmd(X);
write_cmd(Y);
Y+=0x10;
for(j=0;j<16;j++)
{//write_data(P[i*32+j]);
write_data(*(*(P+i)+j));
}
}
CS2=0;CS1=1;Y=0x40;//X=0xb8;
for(i=0;i<8;i++)
{if(i>=4)
{CS2=1;CS1=0;}
if(Y==0x80)
{Y=0x40;}
//write_cmd(0xC0);
write_cmd(X+1);
write_cmd(Y);
Y+=0x10;
for(j=16;j<32;j++)
{//write_data(P[i*32+j]);
write_data(*(*(P+i)+j));
}
}
}
void display_img(uchar X, uchar Y,uchar code *P)
{
uchar i,j;
for(i=0;i<4;i++)
{CS2=0;CS1=1;
//write_cmd(0xc0);
write_cmd(X+i);
write_cmd(Y);
for(j=0;j<64;j++)
{write_data(P[i*128+j]);}
CS2=1;CS1=0;
//write_cmd(0xc0);
write_cmd(X+i);
write_cmd(Y);
for(j=64;j<128;j++)
{write_data(P[i*128+j]);}
}
}
void main()
{
RESET=0;
delay1ms(3);
RESET=1;
lcdinit();
while(1)
{
display(0xb8,0x40,zw);
write_cmd(0xC0);
delay1ms(2000);
display(0xba,0x40,ce);
delay1ms(2000);
display_img(0xbc,0x40,img);
delay1ms(5000);
}
}
5分我势在必得,有问题在找我吧我必定回答。