|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 chdzlxh 于 2018-7-6 11:48 编辑 . ^# s( Q7 p9 C) i% t& N; f' Y
5 X- n, q& ^! O* [0 A: z9 X
#include <reg52.h>
* ~& Q/ h5 D5 |8 {- c* W' X#include <intrins.h>* J Z; K# e3 g% v
#define uint unsigned int ' z# s" R( | B+ E2 o
#define uchar unsigned char
6 x* I3 z! R" |; `void delayms(uint);
; r2 T/ W' R; W, I9 w' Y' `" s4 Uuchar aa;. x4 s1 u; I! ^/ R) t6 \2 ]# |6 V4 V
void main()
# @& r3 L. x/ Y# j V w1 n* }{# ]; x1 W" q& q& L3 ^* `; M
aa=0x01;2 ]5 ?1 Z @8 `* A7 G
. ^; U) @8 B/ s5 S- ^# U- `
while(1) 6 F6 F5 `1 y! K# @% S
{, t. i' q, [6 W0 L
& \4 M7 b5 m1 y; l' V P0=aa;
+ ^, C( u+ [2 p p( o delayms(500); : G% T: y+ ?" }
aa=_crol_(aa,1); 2 E: [- S/ x, X7 `( w" G
8 ?* P0 I9 @" X$ z$ \9 z, _9 i }
+ @# V; h, q# Z2 s: p5 r w}9 g$ F/ a5 c6 ~' Q8 n# s5 ?
void delayms(uint xms) 8 e1 B+ b4 I0 n& _+ N9 V" `( c9 v
{
2 `6 G/ M* d9 A# N/ F uint i,j;
) I. A; M+ i6 K" F for(i=xms;i>0;i--) + e; Z* L+ }( _( v# i4 u
for(j=110;j>0;j--);
6 I. U: W8 `+ F2 T' u+ T4 O % f) ^) s! D: o, @, w: b4 ^
}: \4 k. `5 C2 S% u; g
8 y# D+ B7 C% y5 M |
|