c语言在线翻译

main()
{
wela=0;
dula=0;
delay_1ms(10);
lcd_init();
zcd();
c_cd();
init_dds();
freq=100;
write_freq(freq);
EX0=1;
EA=1;
write_cmd(0x01);
write(1)
{
if(count>3)
count=0;
if(count==3)
{
count=0;
address=dat[0]|(dat[1]<<4);
temp=dat;//[2]|(dat[3]<<4);
if (temp|0x7f==0x80)
light=1;
else
light=0;
temp=temp&0x7f;
a1=temp/100;
a2=temp/10;
a3=temp%10;
write_cmd(0x01);
lcd_pos(2,5);
write_dat(0x30+a1);
lcd_pos(2,4);
write_dat(0x30+a2);
lcd_pos(2,5);
write_dat(0x30+a3);
}
}

/包涵头文件stdio.h
void main//返回空值的main函数
{
float a,b,c,x;//定义浮点类型a,b,c,x
x=0;//给x赋初值0

printf("a=");//在屏幕上输出 a=
scanf("%f",&a);//从键盘上获取一个浮点数赋给a
printf("b=");//在屏幕上输出 a=
scanf("%f",&b);//从键盘上获取一个浮点数赋给b
printf("c=");//在屏幕上输出 a=
scanf("%f",&f);//从键盘上获取一个浮点数赋给f
/*这句是不是有问题?应该是scanf("%f",&c);吧?*/

x=a/(b-c);//将a/(b-c)的值赋给x

if((b-c)!=0)//假如(b-c)不等于0
print("%.2f=a/(b-c)\n",x);//在屏幕上输出(x的值,保留两位小数)=a/(b-c)(一个回车符)
else//否则
{
printf("\nError!\n");//在屏幕上输出(一个回车符)Error!(一个回车符)
}
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-11-30
#include <reg52.h>
#包括<< reg52。”
#define uint unsigned int
# unsigned int定义单元
#define uchar unsigned char
#定义unsigned char函数
sbit RED_A = P2^0;
公司red_a = P2 ^ 0;
sbit YELLOW_A = P2^1;
公司yellow_a = P2 ^ 1;
sbit GREEN_A = P2^2;
公司green_a = P2 ^ 2;
sbit RED_B = P2^3;
公司red_b = P2 ^ 3;
sbit YELLOW_B = P2^4;
公司yellow_b = P2 ^ 4;
sbit GREEN_B = P2^5;
公司green_b = P2 ^ 5;
uchar Count = 0,Flash_Count = 0,Operation_Type = 1;
函数数= 0,flash_count = 0,operation_type = 1;
void T0_INT() interrupt 1
无效t0_int()中断1
{
{
TH0=(65536-50000)/256;
TH0 =(65536-50000)/ 256;
TL0=(65536-50000)%256;
TL0 =(65536-50000)% 256;
switch(Operation_Type)
开关(operation_type)
{
{
case 1:
案例1:
RED_A=1;YELLOW_A=1;GREEN_A=0;
red_a = 1;yellow_a = 1;green_a = 0;
RED_B=0;YELLOW_B=1;GREEN_B=1;
red_b = 0;yellow_b = 1;green_b = 1;
if(++Count != 100) return;
如果(+ +计数!= 100)返回;
Count=0;
计数= 0;
Operation_Type = 2;
operation_type = 2;
break;
打破;
case 2:
案例2:
if(++Count != 8) return;
如果(+ +计数!= 8)返回;
Count=0;
计数= 0;
YELLOW_A=!YELLOW_A;
yellow_a =!yellow_a;
GREEN_A=1;
green_a = 1;
if(++Flash_Count != 10) return;
如果(+ + flash_count!= 10)返回;
Flash_Count=0;
flash_count = 0;
Operation_Type = 3;
operation_type = 3;
break;
打破;
case 3:
案例3:
RED_A=0;YELLOW_A=1;GREEN_A=1;
red_a = 0;yellow_a = 1;green_a = 1;
RED_B=1;YELLOW_B=1;GREEN_B=0;
red_b = 1;yellow_b = 1;green_b = 0;
if(++Count != 100) return;
如果(+ +计数!= 100)返回;
Count=0;
计数= 0;
Operation_Type = 4;
operation_type = 4;
break;
打破;
case 4:
案例4:
if(++Count != 8) return;
如果(+ +计数!= 8)返回;
Count=0;
计数= 0;
YELLOW_B=!YELLOW_B;
yellow_b =!yellow_b;
GREEN_B=1;
green_b = 1;
if(++Flash_Count !=10)
如果(+ + flash_count!= 10)
return;
返回;
Flash_Count=0;
flash_count = 0;
Operation_Type = 1;
operation_type = 1;
break;
打破;
}
}
}
}
void main()
无效main()
{
{
TMOD = 0x01;
TMOD = 0x01;
TH0=(65536-50000)/256;
TH0 =(65536-50000)/ 256;
TL0=(65536-50000)%256;
TL0 =(65536-50000)% 256;
IE = 0x82;
IE = 0x82;
TR0 = 1;
tr0 = 1;
while(1);
而(1);
}
}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网