#include <reg52.h>
#include "1602led.h"
#include "boardinit.h"
#include "74hc595.h"
#include "delay.h"
#define uint unsigned int
#define ucher unsigned char
unsigned char code ZZ[8]={0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08};//28BYJ-48正时钟旋转相序表
unsigned char code FZ[8]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09};//28BYJ-48逆时钟旋转相序表
void BGdelay(unsigned int n)//步进延时
{
unsigned int i;
for(n;n>0;n--)
for(i=96;i>0;i--); //待商榷
}
void main()//入口函数
{
unsigned int i;
delay(500);
while(1)
{
for(i=0;i<8;i++) //旋转45度
{
P1=FZ[i]; //ZZ为正转,FZ为反转
BGdelay(1); //调速
}
}
}
|