03/09/2011
By dch1 in Just Notes No Comments
今天复习跑马灯程序,感觉熟练多了,呵呵,基本上没有按照题目编,因为其实细节就是那些延迟的参数,那个很容易修改的。
#include <reg52.h> #include <intrins.h> #define uint unsigned int #define uchar unsigned char void delay1s(void); uchar status; void main() { status=0; while (1) { delay1s(); status=status+1; P0=~status; } } void delay1s(void) { uchar a,b,c; for(c=46;c>0;c–) for(b=152;b>0;b–) for(a=70;a>0;a–); _nop_(); //if Keil,require use intrins.h }
#include <reg52.h> #include <intrins.h> #define uint unsigned int #define uchar unsigned char
void delay1s(void);
uchar status;
void main() { status=0; while (1) { delay1s(); status=status+1; P0=~status; } }
void delay1s(void) { uchar a,b,c; for(c=46;c>0;c–) for(b=152;b>0;b–) for(a=70;a>0;a–); _nop_(); //if Keil,require use intrins.h }
#include <reg52.h> #include <intrins.h> #define uint unsigned int #define uchar unsigned char void delay1s(void); uchar status; void main() { while (1) { P0=0xFE; delay1s(); for(status=1; status<8; status++) { P0=_crol_(P0,1); delay1s(); } //P0=0x7F; for(status=7; status>1; status–) { P0=_cror_(P0,1); delay1s(); } } } void delay1s(void) { uchar a,b,c; for(c=46;c>0;c–) for(b=152;b>0;b–) for(a=70;a>0;a–); _nop_(); //if Keil,require use intrins.h }
void main() { while (1) { P0=0xFE; delay1s(); for(status=1; status<8; status++) { P0=_crol_(P0,1); delay1s(); } //P0=0x7F; for(status=7; status>1; status–) { P0=_cror_(P0,1); delay1s(); } } }
Example 3: 8个发光管间隔200ms由上至下,再由下至上,再重复一次,然后全部熄灭再以300ms间隔全部闪烁5次。重复此过程。
#include <reg52.h> #include <intrins.h> #define uint unsigned int #define uchar unsigned char void delay1s(void); uchar status,s1; void main() { while (1) { P0=0xFE; delay1s(); for(status=1; status<8; status++) { P0=_crol_(P0,1); delay1s(); } //P0=0x7F; for(status=7; status>0; status–) { P0=_cror_(P0,1); delay1s(); } for(status=0; status<5; status++) { P0=0x00; delay1s(); P0=~P0; delay1s(); } } } void delay1s(void) { uchar a,b,c; for(c=46;c>0;c–) for(b=152;b>0;b–) for(a=70;a>0;a–); _nop_(); //if Keil,require use intrins.h }
void delay1s(void); uchar status,s1;
void main() { while (1) { P0=0xFE; delay1s(); for(status=1; status<8; status++) { P0=_crol_(P0,1); delay1s(); } //P0=0x7F; for(status=7; status>0; status–) { P0=_cror_(P0,1); delay1s(); } for(status=0; status<5; status++) { P0=0x00; delay1s(); P0=~P0; delay1s(); } } }
26/08/2011
21st of the August is the Open Day for Deakin University. Taken several photos on that day~~ Lovely Day!
03/09/2011
C51 Revision
By dch1 in Just Notes No Comments
今天复习跑马灯程序,感觉熟练多了,呵呵,基本上没有按照题目编,因为其实细节就是那些延迟的参数,那个很容易修改的。
Example 3: 8个发光管间隔200ms由上至下,再由下至上,再重复一次,然后全部熄灭再以300ms间隔全部闪烁5次。重复此过程。