26/08/2011
By dch1 in Just Notes No Comments
21st of the August is the Open Day for Deakin University. Taken several photos on that day~~ Lovely Day!
09/08/2011
By dch1 in Life No Comments
这两天在自学C51编程,跟着教程做了几个最简单的HELLO WORLD程序,也就是跑马灯程序,还是比较有成就感的。
基本上是自己想出来的,个别指令有答案提示。
上图片太麻烦了,搞了半天AVI-GIF,画质还非常差,就先只上一个代码吧
题目要求:
间隔300ms第一次一个管亮流动一次, 第二次两个管亮流动,依次到8个管亮, 然后重复整个过程。
代码:
#include <reg52.h> #include <intrins.h> static char High=1; static char Low=0; void delay1s(); #define uchar unsigned char int a; uchar i,j; sbit FM=P2^7; void main() { while (1) { for (i=0;i<8;i++) { a=0xff; for (j=0;j<=i;j++) { a=a<<1; } for (j=0;j<8-i;j++) { P0=a; a=_crol_(a,1); delay1s(); } } } } void delay1s(void) { unsigned char a,b,c; for(c=95;c>0;c–) for(b=26;b>0;b–) for(a=185;a>0;a–); }
#include <reg52.h> #include <intrins.h> static char High=1; static char Low=0; void delay1s(); #define uchar unsigned char int a; uchar i,j; sbit FM=P2^7; void main() { while (1) { for (i=0;i<8;i++) { a=0xff; for (j=0;j<=i;j++) { a=a<<1; } for (j=0;j<8-i;j++) { P0=a; a=_crol_(a,1); delay1s(); } } } }
void delay1s(void) { unsigned char a,b,c; for(c=95;c>0;c–) for(b=26;b>0;b–) for(a=185;a>0;a–); }
26/08/2011
Open Day for Deakin University at Waurn Ponds Campus
By dch1 in Just Notes No Comments
21st of the August is the Open Day for Deakin University. Taken several photos on that day~~ Lovely Day!