㈠ 我打算用單片機和一塊12864屏幕做一個簡單的游戲機 在屏幕顯示的方面要掌握哪些知識呢
12864液晶是單色的,一點佔一位數據,你按照所選12864的手冊寫點就ok了,我做了一個帶字型檔的圖像顯示程序,可以實現一幅圖片的上下左右移動,你可以參考試試。
#include<reg51.h>
#include <math.h>
#include "stdio.h"
void send_com(unsigned char cmd);
void send_data(unsigned char dat);
void print(unsigned char x,unsigned char y,char* str);
#define DATA P0 //P2接數據口
#define uint unsigned int
#define uchar unsigned char
sfr WATCH_DOG=0xc1;
sfr P4=0xc0;
sfr P4SW=0xbb;
sbit RS=P3^7;
sbit RW=P3^6;
sbit P21=P2^1;
sbit P20=P2^0;
sbit E=P4^5;
sbit SPISS=P4^0;
uchar gun[16];
uchar xdata pictotal[1024];
uchar code LCD_picture1[]=
{
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,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,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,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0xFF,0xFF,0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xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xFF
};
void delay(uint i)
{
char a;
while(i--)
{
for(a=0;a<10;a++);
}
}
void delay1(uint i)
{
while(i--);
}
//測忙碌子程序
//RS=0,RW=1,E=H,D0-D7=狀態字
void chek_busy(void)
{ unsigned char temp1;//狀態信息(判斷是否忙)
P2=0x13;
P20=0;
P21=1;
DATA=0xFF;
RS = 0;
delay1(10);
RW = 1;
delay1(10);
do{
E = 1;
P21=0;
delay1(10);
temp1 = DATA;
E = 0;
delay1(10);
} while(temp1&0x80);//??????
RS = 0;
delay1(10);
RW = 0;
P20=1;
delay1(10);
P2=0x13;
}
/*************讀數據************/
read_12864()
{
uchar shuju;
P20=0;
P21=1;
DATA=0xff;
RS=1;
delay1(10);
RW=1;
delay1(10);
E=1;
P21=0;
delay1(10);
shuju=DATA;
E=0;
delay1(10);
P2=0x13;
return(shuju);
}
//寫命令子程序
void send_com(unsigned char cmd)/*寫命令*/
{
chek_busy();
P2=0x13;
delay1(10);
P20=0;
RS = 0;
delay1(10);
RW = 0;
delay1(10);
P21=1;
E = 1;
delay1(10);
DATA = cmd;
E = 0;
P20=1;
delay1(10);
P2=0x13;
}
//寫數據子程序
void send_data(unsigned char dat)
{
chek_busy();
P2=0x13;
P20=0;
RS = 1;
delay1(10);
RW = 0;
delay1(10);
P21=1;
E = 1;
delay1(10);
DATA = dat;
E = 0;
P20=1;
delay1(10);
P2=0x13;
}
// 設置字元串顯示位置 xpos(0~7),ypos(1~4)
void set_xy(unsigned char xpos,unsigned char ypos)
{
switch(ypos)
{
case 1:
send_com(0x80|xpos);break;
case 2:
send_com(0x90|xpos);break;
case 3:
send_com(0x88|xpos);break;
case 4:
send_com(0x98|xpos);break;
default:break;
}
}
// 在指定位置顯示字元串
void print(unsigned char x,unsigned char y,char* str)
{
unsigned char lcd_temp;
set_xy(x,y);
lcd_temp=*str;
while(lcd_temp != 0x00)
{
send_data(lcd_temp);
lcd_temp=*(++str);
}
}
// 顯示圖片
void disppicture(uchar code *adder)
{
uint i,j;
for(i=0;i<32;i++)
{
send_com(0x80 + i);
send_com(0x80);
for(j=0;j<16;j++)
{
send_data(~*adder);
adder++;
}
}
for(i=0;i<32;i++)
{
send_com(0x80 + i);
send_com(0x88);
for(j=0;j<16;j++)
{
send_data(~*adder);
adder++;
}
}
}
// 反白函數
void con_disp(uchar data1,uchar data2,uchar x0,uchar y0,uchar xl,uchar yl)
//dara1 data2為0x00或0xff,x0為橫起始坐標(0~7),y0為縱起始坐標(0~63),x1為長度(1~8),y1為寬度(1~64)。
{
uchar i,j,k;
if(y0<32)
{
for(j=0;j<yl;j++)
{
for(i=0;i<xl;i++)
{
send_com(0x34);// 擴展功能
send_com(0x80+y0+j);// 寫Y坐標
send_com(0x80+x0+i);// 寫X坐標
send_com(0x30);// 普通功能
send_data(data1);
send_data(data2);
}
}
if((y0+yl)>32)
{
k=y0+yl-32;
yl=k;
y0=0;
for(j=0;j<yl;j++)
{
for(i=0;i<xl;i++)
{
send_com(0x34);// 擴展功能
send_com(0x80+y0+j);// 寫Y坐標
send_com(0x88+x0+i);// 寫X坐標
send_com(0x30);// 普通功能
send_data(data1);
send_data(data2);
}
}
}
}
else
{
for(j=0;j<yl;j++)
{
for(i=0;i<xl;i++)
{
send_com(0x34);// 擴展功能
send_com(0x80+y0-32+j);// 寫Y坐標
send_com(0x88+x0+i);// 寫X坐標
send_com(0x30);// 普通功能
send_data(data1);
send_data(data2);
}
}
}
send_com(0x36);// 開繪圖顯示
}
// 畫任意點
void dian( unsigned char X, unsigned char Y, unsigned char Color )
{
unsigned char Row , Tier , Tier_bit ;
unsigned char ReadOldH, ReadOldL ;
send_com( 0x34 ) ;
send_com( 0x36 ) ;
Tier = X >> 4 ;
Tier_bit = X & 0x0f ;
if( Y < 32 )
{
Row = Y ;
}
else
{
Row = Y - 32 ;
Tier += 8 ;
}
send_com( Row + 0x80 ) ;
send_com( Tier + 0x80 ) ;
read_12864() ;
ReadOldH = read_12864() ;
ReadOldL = read_12864() ;
send_com( Row + 0x80 ) ;
send_com( Tier + 0x80 ) ;
if( Tier_bit < 8 )
{
switch( Color)
{
case 0 : ReadOldH &=( ~( 0x01 << ( 7 - Tier_bit ))) ; break ;
case 1 : ReadOldH |= ( 0x01 << ( 7 - Tier_bit )) ; break ;
case 2 : ReadOldH ^= ( 0x01 << ( 7 - Tier_bit )) ; break ;
default : break ;
}
send_data( ReadOldH ) ;
send_data( ReadOldL ) ;
}
else
{
switch(Color)
{
case 0 : ReadOldL &= (~( 0x01 << ( 15 - Tier_bit ))) ; break ;
case 1 : ReadOldL |= ( 0x01 << ( 15 - Tier_bit )) ; break ;
case 2 : ReadOldL ^= ( 0x01 << ( 15 - Tier_bit )) ; break ;
default : break ;
}
send_data( ReadOldH ) ;
send_data( ReadOldL ) ;
}
send_com( 0x30 );
}
//畫水平線
void linex( unsigned char X0, unsigned char X1, unsigned char Y, unsigned char Color )
{ unsigned char Temp ;
if( X0 > X1 )
{
Temp = X1 ;
X1 = X0 ;
X0 = Temp ;
}
for( ; X0 <= X1 ; X0++ )
dian( X0, Y, Color ) ;
}
//畫垂直線
void liney( unsigned char X, unsigned char Y0, unsigned char Y1, unsigned char Color )
{
unsigned char Temp ;
if( Y0 > Y1 )
{
Temp = Y1 ;
Y1 = Y0 ;
Y0 = Temp ;
}
for(; Y0 <= Y1 ; Y0++)
dian( X, Y0, Color) ;
}
//畫任意兩點間線段
void line( unsigned char StartX, unsigned char StartY, unsigned char EndX, unsigned char EndY, unsigned char Color )
{
int t, distance;
int x = 0 , y = 0 , delta_x, delta_y ;
char incx, incy ;
delta_x = EndX - StartX ;
delta_y = EndY - StartY ;
if( delta_x > 0 )
{
incx = 1;
}
else if( delta_x == 0 )
{
liney( StartX, StartY, EndY, Color ) ;
return ;
}
else
{
incx = -1 ;
}
if( delta_y > 0 )
{
incy = 1 ;
}
else if(delta_y == 0 )
{
linex( StartX, EndX, StartY, Color ) ;
return ;
}
else
{
incy = -1 ;
}
delta_x = abs( delta_x );
delta_y = abs( delta_y );
if( delta_x > delta_y )
{
distance = delta_x ;
}
else
{
distance = delta_y ;
}
dian( StartX, StartY, Color ) ;
for( t = 0 ; t <= distance+1 ; t++ )
{
dian( StartX, StartY, Color ) ;
x += delta_x ;
y += delta_y ;
if( x > distance )
{
x -= distance ;
StartX += incx ;
}
if( y > distance )
{
y -= distance ;
StartY += incy ;
}
}
}
void readpic()
{
uchar i,j;
uint k;
k=0;
send_com( 0x34 );
send_com( 0x36 );
for(i=0;i<32;i++){
for(j=0;j<8;j++){
send_com( i + 0x80 ) ;
send_com( j + 0x80 ) ;
read_12864() ;
pictotal[k] = read_12864() ;
pictotal[k+1] = read_12864() ;
k+=2;
}
}
for(i=0;i<32;i++){
for(j=0;j<8;j++){
send_com( i + 0x80 ) ;
send_com( j + 0x88 ) ;
read_12864() ;
pictotal[k] = read_12864() ;
pictotal[k+1] = read_12864() ;
k+=2;
}
}
}
//LCD字型檔初始化函數
void lcd_str(void)
{
delay(4000);
send_com(0x30);
delay(1000);
send_com(0x0C);
delay(1000);
send_com(0x01);
delay(1000);
send_com(0x06);
}
//LCD圖片(擴展)初始化函數
void lcd_pic(void)
{
send_com(0x36);
delay(1000);
send_com(0x36);
delay(1000);
send_com(0x3E);
delay(1000);
send_com(0x01);
}
//——————清整個GDRAM空間—————————-
void clr_pic()
{
unsigned char x,y ;
for(y=0;y<64;y++)
for(x=0;x<16;x++)
{
send_com(0x34);
send_com(y+0x80);
send_com(x+0x80);
send_com(0x30);
send_data(0x00);
send_data(0x00);
}
}
void drawx(uchar y)
{
if(y<32){
send_com(0x80 + y);
send_com(0x80);
}
if(y>=32){
send_com(0x80 + y - 32);
send_com(0x88);
}
}
//左滾動一行
void rotl16()
{
uchar i,ch0,ch1,ch;
ch0=gun[0];
ch=(ch0&0x80)>>7;
for(i=0;i<15;i++){
gun[i]=gun[i]<<1;
gun[i]=gun[i]|((gun[i+1]&0x80)>>7);
}
gun[15]=(gun[15]<<1)|ch;
}
//右滾動一行
void rotr16()
{
uchar i,ch0,ch1,ch;
ch0=gun[15];
ch=(ch0&0x01)<<7;
for(i=15;i>0;i--){
gun[i]=gun[i]>>1;
gun[i]=gun[i]|((gun[i-1]&0x01)<<7);
}
gun[0]=(gun[0]>>1)|ch;
}
/**************主函數****************************/
void main()
{
uchar x,y,i,n;
uint k;
P4SW=0x70;
lcd_pic();
disppicture(LCD_picture1);
readpic();
lcd_pic();
while(1)
{
for(i=0;i<64;i++){ //下滾動
k=0;
for(x=i;x<64;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
send_data(gun[y]);
}
}
for(x=0;x<i;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
send_data(gun[y]);
}
}
}
lcd_pic();
for(i=63;i>0;i--){ //上滾動
k=0;
for(x=i;x<64;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
send_data(gun[y]);
}
}
for(x=0;x<i;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
send_data(gun[y]);
}
}
}
for(i=0;i<128;i++){ //左滾動
k=0;
for(x=0;x<64;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
}
rotl16();
k-=16;
for(y=0;y<16;y++)
{
pictotal[k]=gun[y];
send_data(gun[y]);
k++;
}
}
}
for(i=0;i<128;i++){ //右滾動
k=0;
for(x=0;x<64;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
}
rotr16();
k-=16;
for(y=0;y<16;y++)
{
pictotal[k]=gun[y];
send_data(gun[y]);
k++;
}
}
}
}}
㈡ 單片機也能玩游戲,你hold住了嗎
最多也就是俄羅斯方塊,貪吃蛇,沒有比遙控車飛機好玩。
㈢ 用51單片機做個貪吃蛇游戲。
單片機,晶振,液晶屏,按鍵,電阻,電容,電源及pcb板等,認為必要的話,還可准備一些發光二極體作指示燈。也可采購一套開發板套件,大部分開發板套件都有上述器件。
㈣ 單片機俄羅斯方塊游戲設計申請理由
本設計是通過AT89S52單片機來實現俄羅斯方塊游戲的設計,使用C語言進行編程,並通過Proteus來進行模擬。
然後通過Protues模擬實現通過外部按鍵來控制各種不同圖形的方塊來玩游戲,並且實現記錄分數和通過過關數來改變方塊下降的速度。最後將程序下載至AT89S52單片機並進行實際運行,實際運行表明,本設計可以實現基本的游戲功能.達到預期的目的。
㈤ 想用單片機做一個掌上游戲機,都需要什麼外圍晶元和設備,用c語言編程行嗎
既然是游戲機就需要顯示屏和按鍵,單片機如果不夠快的話要用專門的晶元處理顯示屏和按鍵,夠快就不需要額外晶元了。C語言可以啊,LINUX都是用C寫出來的,不用擔心。
㈥ 51單片機怎麼做做游戲機
要用51單片機做做游戲機,只能做些簡單的游戲機,例如,用8X8點陣模塊做個貪吃蛇,用12864點陣屏做個更好些的貪吃蛇,俄羅斯方塊等。像手機上玩的游戲就做不了的,速度不夠,手機用的顯示屏又不好驅動。