请先登录 | 注册 |
WWW.MM0759.COM |
■标题:006-单片机 循环移位函数 _corl_ 引用文件 intrins.h 可应用于流水灯 |
■作者:IPSC [2025/6/13 19:57:02]![]() 需要引用文件 #include<intrins.h> 这个说明文件的位置: ![]() 类似用法: _crol_ 左移x位char _cror_ 右移x位char _irol_ 左移x位int或long _iror_ 右移x位int或long abs(x) 转绝值 math.h ceil(x) 四舍五入 math.h .... --------以下是一个流水灯效果01010101移位 #include<reg52.h> #include<intrins.h> //sbit P0_1=P0^0; #define uint unsigned int #define uchar unsigned char uchar temp0; void delay1(uint z);//声明时可以不写z,多个逗号分隔 void main() { while(1)//大循环 { temp0=0xaa; P0=temp0; delay1(200); temp0=_crol_(temp0,1); P0=temp0; delay1(200); } } void delay1(uint z) { uint x,y; for(x=z;x>0;x--) for(y=70;y>0;y--);//两个FOR镶嵌 } ------------------------------ 【回复/版区/上篇/下篇/发贴/仅文字/HTML】 |
【倒序/最近21条回复】(暂无) |
(查看完整版网页) |
短讯|首页|登录|算法|电脑版 . DK MiniBBS Plus v2.0 mm0759.com 31 毫秒 . |