導航:首頁 > 操作系統 > 單片機游戲機演示

單片機游戲機演示

發布時間:2023-07-26 12:18:52

❶ 主題:單片機 小霸王游戲機和JAVA虛擬機本質一樣嗎小霸王游戲卡里的內容可以是JAVA程序嗎謝謝

不一樣 單片機 小霸王游戲機 是硬體 JAVA虛擬機是軟體
小霸王游戲卡不能是JAVA程序 因為游戲卡相當於軟盤一樣的東西

❷ 51單片機怎麼做做游戲機

要用51單片機做做游戲機,只能做些簡單的游戲機,例如,用8X8點陣模塊做個貪吃蛇,用12864點陣屏做個更好些的貪吃蛇,俄羅斯方塊等。像手機上玩的游戲就做不了的,速度不夠,手機用的顯示屏又不好驅動。

❸ 想用單片機做一個掌上游戲機,都需要什麼外圍晶元和設備,用c語言編程行嗎

既然是游戲機就需要顯示屏和按鍵,單片機如果不夠快的話要用專門的晶元處理顯示屏和按鍵,夠快就不需要額外晶元了。C語言可以啊,LINUX都是用C寫出來的,不用擔心。

❹ 基於單片機的猜數游戲機設計

本來想給你寫完的,結果有點事情把我的時間佔用了,只好把這個寫了一大半的程序給你,你自己加文件排名的那一部分。
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int proct_random();
void store_number(int X);

#define length 4

int guess[length];
int x[length];

void main(void)
{
int i,j,correct,half_correct,RANDOM,GUESS,time;
time=0;
RANDOM=proct_random();
printf("%d\n",RANDOM);
printf("Please input your guessed four-digit number:\n");
while(1)
{
correct=0;
half_correct=0;

scanf("%d",&GUESS);
time++;
store_number(GUESS);

for(i=0;i<4;i++)
{
if(guess[i]==x[i])
{
correct++;
}
for(j=0;j<4;j++)
{
if(i!=j)
{
if(guess[i]==x[j])
{
half_correct++;
}
}
}
}

printf("%d %d %d\n",correct,half_correct,time);
if(correct==4)
{
printf("congratulations\n");
break;
}
}
}

int proct_random(void)
{
int i,random;

srand((unsigned)time(NULL));
for(i=0;i<4;i++)
{
x[i]=rand()%10;
}
random=x[0]*1000+x[1]*100+x[2]*10+x[3];
return random;
}

void store_number(int X)
{

guess[0]=X/1000;
guess[1]=X/100-guess[0]*10;
guess[2]=X/10-guess[1]*10-guess[0]*100;
guess[3]=X%10;
}

❺ 我打算用單片機和一塊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,0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F,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++;
}
}
}

}}

閱讀全文

與單片機游戲機演示相關的資料

熱點內容
android滑動進度條 瀏覽:834
javagmt轉換 瀏覽:826
linux查看snmp 瀏覽:24
ug80車床編程 瀏覽:516
怎麼加速python計算素數 瀏覽:241
腰椎第五節壓縮性骨折 瀏覽:91
程序員開會的句子 瀏覽:993
用哪個app寫編程 瀏覽:645
android通訊錄增刪改查 瀏覽:731
車貸解壓過戶可以同時進行嗎 瀏覽:920
java面向對象編程題目 瀏覽:884
二次元壓縮包 瀏覽:700
stc模擬器編程器 瀏覽:155
伺服器銷售怎麼做好 瀏覽:88
什麼是com編程 瀏覽:849
演算法工程師最新資訊 瀏覽:612
郵政銀行卡怎麼在app簽約綁定 瀏覽:50
壓縮卷一直轉 瀏覽:978
初一編程小程序怎麼做 瀏覽:828
bt軟體文件夾名稱 瀏覽:159