[問題] 做數獨機研製..
想請教一下各位大大...
我是用Keil uVision2及Simlab 8051在做數獨機的
步驟是想這樣
1. 在64X128繪圖型LCD上繪出9X9格的方格圖(每格8X8點)
2. 顯示開機畫面於右側
3. 建1~9等九個數字和游標的5X6字型資料
4. 算出9X9格的每格左上角座標(X與Y),並建表
但在第三步的時候就已經有點卡卡了...
是否可指點我一下..(最近要做專題出來....對這方面還是很新手...)
目前做到這樣,貼圖 http://ppt.cc/,i0D
下為程式....
#include <AT89X51.H>
#define E P1_2
#define RW P1_1
#define DI P1_0
#define CS1 P1_3
#define CS2 P1_4
void command(unsigned char);
void wait_LCD(void);
void point(bit, bit, unsigned char, unsigned char, unsigned char);
void WR_data(unsigned char);
main()
{
int i;
CS1=1; CS2=1;
for(i=0;i<1000;i++);
command(0x3f);
point(1,0,0,0,1);
point(1,0,7,0,0x80);
point(0,1,0,63,1);
point(0,1,7,63,0x80);
while(1);
}
void command(unsigned char c)
{
P0=c;
E=1; RW=0; DI=0; E=0; RW=1;
wait_LCD();
}
void wait_LCD(void)
{
bit busy;
P0=0xFF; //P0設定為輸入埠
do {
DI=0; RW=1; E=1; busy=P0&0x80; E=0;
}
while(busy==1);
}
void point(bit s1, bit s2, unsigned char x, unsigned char y,unsigned char d1)
{
CS1=s1;
CS2=s2;
command(0xb8+x);
command(0x40+y);
WR_data(d1);
}
void WR_data(unsigned char d2)
{
P0=d2;
E=1; RW=0; DI=1; E=0; RW=1;
wait_LCD();
}
#include <AT89X51.H>
#define E P1_2
#define RW P1_1
#define DI P1_0
#define CS1 P1_3
#define CS2 P1_4
void command(unsigned char);
void wait_LCD(void);
void WR_data(unsigned char);
unsigned char code a[]={0x00,0x04,0x74,0xDE,0x74,0x84,0x74,0x5E,
0x74,0x84,0x60,0x1E,0xD2,0x10,0x50,0x38,
0x00,0x08,0x06,0xFF,0x55,0x55,0x7F,0x55,
0x55,0x80,0x60,0x18,0x07,0x18,0x60,0x80};
main()
{
int i;
CS1=1; CS2=0;
for(i=0;i<1000;i++);
command(0x3f); 顯示幕on (p.28)
command(0xb8+0); 設定頁數X+頁面( Page 0)
command(0x40+0); 設定頁數Y+y行(直的)
for(i=0;i<16;i++)
WR_data(a[i]);
command(0xb8+1); 設定頁數X+頁面( Page 1)
command(0x40+0); 設定頁數Y+y行(直的)
for(i=16;i<32;i++)
WR_data(a[i]);
while(1);
}
void command(unsigned char c)
{
P0=c;
E=1; RW=0; DI=0; E=0; RW=1;
wait_LCD();
}
void wait_LCD(void)
{
bit busy;
P0=0xFF; //P0設定為輸入埠
do {
DI=0; RW=1; E=1; busy=P0&0x80; E=0;
}
while(busy==1);
}
void WR_data(unsigned char d2)
{
P0=d2;
E=1; RW=0; DI=1; E=0; RW=1;
wait_LCD();
}
想請問接下來如何做才好......
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.253.112.173
推
09/13 19:19, , 1F
09/13 19:19, 1F
→
09/13 23:33, , 2F
09/13 23:33, 2F
推
09/23 08:44, , 3F
09/23 08:44, 3F
→
09/23 08:45, , 4F
09/23 08:45, 4F
ASM 近期熱門文章
PTT數位生活區 即時熱門文章