欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
這個程序最后哪里有錯啊?第一次弄不懂
[打印本頁]
作者:
銳姐吃薯包籺
時間:
2019-9-27 20:30
標題:
這個程序最后哪里有錯啊?第一次弄不懂
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
sbit RED_A=P0^0;
sbit YELLOW_A=P0^1;
sbit GREEN_A=P0^2;
sbit RED_B=P0^3;
sbit YELLOW_B=P0^4;
sbit GREEN_B=P0^5;
uchar Flash_Count=0;
uchar num=0;
Operation_Type=1;
void DelayMS(uint x);
void Traffic_light()
{
switch(Operation_Type)
{
case 1:
RED_A=1;YELLOW_A=1;GREEN_A=0;
RED_B=0;YELLOW_B=1;GREEN_B=1;
Operation_Type=2;
for(num=9;num>2;--num)
{
P1=tab[num];
DelayMS(1000);
}
break;
case 2:
for(Flash_Count=1;Flash_Count<=10;Flash_Count++)
{
P1=tab[num];
DelayMS(200);
YELLOW_A=~YELLOW_A;
if(Flash_Count%5==0)num--;
}
Operation_Type=3;
break;
case 3:
RED_A=0;YELLOW_A=1;GREEN_A=1;
RED_B=1;YELLOW_B=1;GREEN_B=0;
for(num=7;num>0;num--)
{
P1=tab[num];
DelayMS(1000);
}
Operation_Type=4;
break;
case 4:
num=2;
for(Flash_Count=1;Flash_Count<=10;Flash_Count++)
{
P1=tab[num];
DelayMS(200);
YELLOW_B=~YELLOW_B;
if(Flash_Count%5==0)num--;
}
Operation_Type=1;
break;
}
}
void main()
{
while(1)
{
Traffic_lignt ();
}
}
作者:
沒有你
時間:
2019-9-27 22:23
Operation_Type這個變量沒有定義?
作者:
累不死的狗
時間:
2019-9-27 23:25
第一個問題是你 Traffic_lignt ();抄錯了,第二個問題是void DelayMS(uint x);這個沒寫子函數
作者:
累不死的狗
時間:
2019-9-27 23:26
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
sbit RED_A=P0^0;
sbit YELLOW_A=P0^1;
sbit GREEN_A=P0^2;
sbit RED_B=P0^3;
sbit YELLOW_B=P0^4;
sbit GREEN_B=P0^5;
uchar Flash_Count=0;
uchar num=0;
Operation_Type=1;
void DelayMS(uint x);
void Traffic_light()
{
switch(Operation_Type)
{
case 1:
RED_A=1;YELLOW_A=1;GREEN_A=0;
RED_B=0;YELLOW_B=1;GREEN_B=1;
Operation_Type=2;
for(num=9;num>2;--num)
{
P1=tab[num];
DelayMS(1000);
}
break;
case 2:
for(Flash_Count=1;Flash_Count<=10;Flash_Count++)
{
P1=tab[num];
DelayMS(200);
YELLOW_A=~YELLOW_A;
if(Flash_Count%5==0)num--;
}
Operation_Type=3;
break;
case 3:
RED_A=0;YELLOW_A=1;GREEN_A=1;
RED_B=1;YELLOW_B=1;GREEN_B=0;
for(num=7;num>0;num--)
{
P1=tab[num];
DelayMS(1000);
}
Operation_Type=4;
break;
case 4:
num=2;
for(Flash_Count=1;Flash_Count<=10;Flash_Count++)
{
P1=tab[num];
DelayMS(200);
YELLOW_B=~YELLOW_B;
if(Flash_Count%5==0)num--;
}
Operation_Type=1;
break;
}
}
void main()
{
while(1)
{
Traffic_light ();
}
}
void DelayMS(uint x)
{
for(x=0;x<1000;x++)
{
}
}
作者:
cuihaodianzi
時間:
2019-9-27 23:28
Operation_Type 沒有定義
有效行 第 13 行 Operation_Type=1;
改為 unsigned char Operation_Type=1;
或 uchar Operation_Type=1;
作者:
csmyldl
時間:
2019-9-28 02:13
要說明什么錯誤現象呀
作者:
wulin
時間:
2019-9-28 05:19
錯誤1.主函數調用的子函數Traffic_lignt ();與實際子函數Traffic_light()不同名
錯誤2.延時函數只聲明了函數名,沒有函數體
void DelayMS(uint x)
{
uint i,j;
for(i=0;i<x;i++)
for(j=0;j<125;j++);
}
作者:
angmall
時間:
2019-9-28 07:04
給你改了,對比一下就知道哪里錯了。
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
sbit RED_A=P0^0;
sbit YELLOW_A=P0^1;
sbit GREEN_A=P0^2;
sbit RED_B=P0^3;
sbit YELLOW_B=P0^4;
sbit GREEN_B=P0^5;
uchar Flash_Count=0;
uchar num=0;
uchar Operation_Type=1;
void DelayMS(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void Traffic_light()
{
switch(Operation_Type)
{
case 1:
RED_A=1;YELLOW_A=1;GREEN_A=0;
RED_B=0;YELLOW_B=1;GREEN_B=1;
Operation_Type=2;
for(num=9;num>2;--num)
{
P1=tab[num];
DelayMS(1000);
}
break;
case 2:
for(Flash_Count=1;Flash_Count<=10;Flash_Count++)
{
P1=tab[num];
DelayMS(200);
YELLOW_A=~YELLOW_A;
if(Flash_Count%5==0)num--;
}
Operation_Type=3;
break;
case 3:
RED_A=0;YELLOW_A=1;GREEN_A=1;
RED_B=1;YELLOW_B=1;GREEN_B=0;
for(num=7;num>0;num--)
{
P1=tab[num];
DelayMS(1000);
}
Operation_Type=4;
break;
case 4:
num=2;
for(Flash_Count=1;Flash_Count<=10;Flash_Count++)
{
P1=tab[num];
DelayMS(200);
YELLOW_B=~YELLOW_B;
if(Flash_Count%5==0)num--;
}
Operation_Type=1;
break;
}
}
void main()
{
while(1)
{
Traffic_light(); //Traffic_lignt ();
}
}
復制代碼
作者:
佛云
時間:
2019-9-28 08:25
帶倒計時的交通信號燈程序
不過沒明白你說的錯是什么
作者:
shanlxw
時間:
2019-9-28 10:49
時序不清晰
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1