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,0x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xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
{0xFF,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,0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1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x00,
0x00,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,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分我勢在必得,有問題在找我吧我必定回答。