收藏 分销(赏)

可编程速度调制跑马灯.doc

上传人:仙人****88 文档编号:12004718 上传时间:2025-08-26 格式:DOC 页数:2 大小:27.50KB 下载积分:10 金币
下载 相关 举报
可编程速度调制跑马灯.doc_第1页
第1页 / 共2页
可编程速度调制跑马灯.doc_第2页
第2页 / 共2页
本文档共2页,全文阅读请下载到手机保存,查看更方便
资源描述
#include"reg52.h" #define uchar unsigned char #define uint unsigned int uchar code table1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; uchar code table2[]={1,10,5,10,1}; //速度选挡 uchar temp,speed,aa,i; void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void init() { TMOD=0x01; //时钟1模式,自动清除更新标志 TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=1; } void main() { init(); while(1) { if(aa==speed) { aa=0; P0=table1[temp]; temp++; if(temp==8) { temp=0; speed=table2[i]; i++; if(i==5) i=0; } } } } void timer0() interrupt 1 //时钟1,16位 { TH0=(65536-50000)/256; TL0=(65536-50000)%256; aa++; }
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服