废话不多说,直接上图。
/* Main.c file generated by New Project wizard
*
* Created: 周六 11月 25 2017
* Processor: 80C52
* Compiler: Keil for 8051
* Author: Chenchong
*/
#include <reg51.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit LED=P1^0;
void DelayXms(uint x)
{
uchar i;
while(x--)
{
for(i=0;i<120;i++);
}
}
void main(void)
{
// Write your code here
P0=0xfe;//1111 1110
while (1)
{
P0=_crol_(P0,1);//1111 1101→1111 1011
DelayXms(150);
}
;
}