导航:首页 > 操作系统 > 单片机游戏机演示

单片机游戏机演示

发布时间: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,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x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,0xFF,
0xFF,0xFF,0xFF,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++;
}
}
}

}}

阅读全文

与单片机游戏机演示相关的资料

热点内容
excel怎么引用统一文件夹 浏览:249
怎么把微信抖音加密 浏览:302
android滑动进度条 浏览:834
javagmt转换 浏览:826
linux查看snmp 浏览:24
ug80车床编程 浏览:516
怎么加速python计算素数 浏览:241
腰椎第五节压缩性骨折 浏览:91
程序员开会的句子 浏览:993
用哪个app写编程 浏览:645
android通讯录增删改查 浏览:731
车贷解压过户可以同时进行吗 浏览:921
java面向对象编程题目 浏览:884
二次元压缩包 浏览:701
stc仿真器编程器 浏览:157
服务器销售怎么做好 浏览:89
什么是com编程 浏览:850
算法工程师最新资讯 浏览:613
邮政银行卡怎么在app签约绑定 浏览:51
压缩卷一直转 浏览:978