864234488交通灯c语言程序.doc

上传人:laozhun 文档编号:2384253 上传时间:2023-02-17 格式:DOC 页数:2 大小:13KB
返回 下载 相关 举报
864234488交通灯c语言程序.doc_第1页
第1页 / 共2页
864234488交通灯c语言程序.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《864234488交通灯c语言程序.doc》由会员分享,可在线阅读,更多相关《864234488交通灯c语言程序.doc(2页珍藏版)》请在三一办公上搜索。

1、#include #define uchar unsigned char#define uint unsigned intsbit RED_A = P00;sbit YELLOW_A = P01;sbit GREEN_A = P02;sbit RED_B = P03;sbit YELLOW_B = P04;sbit GREEN_B = P05;uchar Flash_Count = 0, Operation_Type=1;void DelayMS(uint x) uchar i; while (x-) for (i=0;i120;i+);void Traffic_Light() switch

2、(Operation_Type) case 1: RED_A=1;YELLOW_A=1;GREEN_A=0; RED_B=0;YELLOW_B=1;GREEN_B=1; DelayMS(2000); Operation_Type=2; break; case 2: DelayMS(300); YELLOW_A=!YELLOW_A;GREEN_A=1; if(+Flash_Count!=10) return; Flash_Count=0; Operation_Type=3; break; case 3: RED_A=0;YELLOW_A=1;GREEN_A=1; RED_B=1;YELLOW_B=1;GREEN_B=0; DelayMS(2000); Operation_Type=4; break; case 4: DelayMS(300); YELLOW_B=!YELLOW_B;GREEN_B=1; if(+Flash_Count!=10) return; Flash_Count=0; Operation_Type=1; break; void main() while(1) Traffic_Light();

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号