while ( !key_puse );
// next pree key
while( !shache );
while(1){
while (key_pusekey_clear );
delay ( 8ms );
if ( !key_clear ){ round_num = 0; display(); }
if ( !key_puse)break;
}
while( !key_puse );
delay(8ms);
while( !key_puse );
}
}
}
}
void ext_int0(void) interrupt 0{/* 主电机 齿轮 中断 */
uint tmp;
EA = 0;
if( !pri_dj ){
round_num ++;
if (round_num % Chilun_Num == 0 ){
one_round_flg = 1;
tmp = round_num/ Chilun_Num ;
set_display_num();
P0 = 0xf0;
P0 = P0 | LEDBuf[0] ;
led_1000= 0;
P0 |= 0xf0;
P0 = 0xf0;
P0 = P0 | LEDBuf[1] ;
led_100= 0;
P0 |= 0xf0;
P0 = 0xf0;
P0 = P0 | LEDBuf[2] ;
led_10= 0;
P0 |= 0xf0;
P0 = 0xf0;
P0 = P0 | LEDBuf[3] ;
led_1= 0;
P0 |= 0xf0;
P0 = 0xf0;
}
if ( round_num = set_round_num) Dj_stop();
}
EA = 0x81;
}
void display(){
uchar i;
uint tmp = 0;
tmp = round_num/ Chilun_Num ;
set_display_num();
for(i = 0; iLEDLen ; i ++){
P0 = 0xf0;
P0 = P0 | LEDBuf[i] ;
if(i==0) led_1000= 0;//P0^4
if(i==1) led_100= 0;//P0^5
if(i==2) led_10= 0;//P0^6
if(i==3) led_1= 0;//P0^7
P0 |= 0xf0;
}
P0 = 0xf0;
}
void read_num(){
/* 读播码盘 到 set_round_num,set_pwm_width*/
uchar tmp;
P2 =0xFF;
P2 =0xEF;// 1110 1111
delay ( 1ms);
tmp =~(P2| 0xF0);
P2 =0xDF;// 1101 1111
delay ( 1ms);
tmp = (~(P2 | 0xF0 )) * 10+ tmp;
set_round_num = tmp;
P2 =0xBF;// 1011 1111
delay ( 1ms);
tmp = (~(P2 | 0xF0));
P2 =0x7F;// 0111 1111
delay ( 1ms);
tmp = (~(P2 | 0xF0)) * 10 + tmp;
set_round_num = set_round_num+ tmp * 100;
set_round_num = set_round_num* Chilun_Num;
P2 =0xFF;
P1 =0xbF;// 0111 1111
delay ( 1ms );
tmp =~(P2| 0xF0) ;
P1=0xFF;
P2=0xFF;
P1 =0x7F;// 1011 1111
delay ( 1ms );
tmp = (~(P2 | 0xF0)) * 10 + tmp ;
set_pwm_width = tmp ;
P1= 0xFF;
P2= 0xFF;
}
voidfx_run(){
#define f_Delay_time 180
while ( bujin_fx_stop ) {/* 反向 回车 直到 传感器 动作*/
P1 =0xf3;//0011
delay ( f_Delay_time );
P1 =0xf6;//0110
delay ( f_Delay_time );
P1 =0xfc;//1100
delay ( f_Delay_time );
P1 =0xf9;//1001
delay ( f_Delay_time );
}
【c语言puse函数 c语言purchar】P1 = 0xff;
}
C语言如何写文件如何将文件名用参数代替?#includestdio.h
#includestdlib.h
#includestring.h
int main()
{
char username[]="abc";//应该是字符串
//char *filename = "c:\\data\\a.xml";//参数文件保存路径,根据需要修改
char filename[100];//定义字符数组,数组可修改不同字符串 。
FILE *file;//指向文件的指针
memset(filename,'\0',100);//初始化数组
printf("input your filename.\n");
gets(filename);
while(*filename!=NULL)//当连续输入2个回车,代表不再输入 。
{
//用于打开文件
if ((file = fopen(filename, "w+" )) == NULL)
{
//lr_output_message("Unable to create %s", filename);
printf("unable to open.\n ");
exit(0);
}
fwrite(username,sizeof(username),1,file);
fclose(file);//关闭文件
printf("input your filename.\n");
memset(filename,'\0',100);
gets(filename);
}
printf("finish.\n");
return 0;
}
参考下
如果系统能生成20110228111111.xml,把它变成字符串存到某个数组中,假如b[100]
可以用for(i=0;i100;i++)
{ ...
strcpy(filename,b);//将b拷贝到filename中
...处理文件写入
推荐阅读
- 系统u盘打不开怎么办,系统u盘不能启动
- u盘文件要怎么倒入,怎么将u盘上的文件传到电脑
- erp系统怎么自学教程图片,自学erp系统软件操作
- 钉钉直播怎么进手机端看,手机钉钉直播怎么看视频
- mysql怎么实现循环 mysql 循环语句
- 火山直播封禁什么意思,火山直播被管理员禁言了怎么办
- mongodb取第一条数据,mongodb查询某个字段数据
- css无序列表怎么居中,css无序列表样式
- 手机模拟java写代码 手机怎么编程java代码