|
#include <reg51.h>
void send1(unsigned char c) {
SBUF = c;
while (T1 == 0);
T1 = 0;
}
void send2(char* s) {
while (*s!='\0') {
send1(*s);
s++;
}
}
void delay() {
unsigned int i, j;
for (i = 0; i < 1000; i++) {
for (j = 0; j < 100; j++);
}
}
void main() {
unsigned char a = 'A';
unsigned char index;
TMOD = 0x20;
TH1 = TL1 = 0xFD;
PCON = 0;
SCON = 0x50;
TR1 = 1;
send2("Welcome to www.cn\r\n");
send2("--------------------------\r\n");
while (1) {
index = 0;
while (index < 26) {
send1(a);
send1(' ');
a++;
if ((index + 1) % 10 == 0) {
send2("\r\n");
delay();
}
index++;
}
send2("--------------------------\r\n");
delay();
}
}
用keil编译没问题,但是放到proteus中运行不出来
|
|