/*************************************************************
                      旋转LED平面字体测试程序
单片机 STC12C5A32S2 或者其他51
字模软件用  PC2002
逐列取模方式

电机旋转方向 逆时针
/***********************************************************
说明：
	  硬件介绍:用单片机的36个IO口独立驱动LED灯
可以避免用选通显示上下不对称的问题,所以为制作好的效果提供了硬件基础.采用
无线供电方式以及性能较好的RF370电机,在5V供电下 显示的效果非常好.电机速度也够快 
够安静.

	看程序前请看下原理图，根据原理图来理解比较容易!
    程序用判断红外起点的方法开始显示 每转一圈，列数往后移动一列
显示完指定的字数后循环	此种弊端是没用中断，一圈的开始后必须要显示完
指定的列数才能退出，如果电机速度太快会造成头吃尾的后果，后面会介绍避免
头吃尾的方法，让整一圈都能显示字 盲点很小。

学习知识：
     只为简单的理解显示的原理，利用人眼视觉暂存，用电机旋转做列扫描，
每送一列数据延时 再送下一列数据，原理比较简单，跟点阵显示差不多。
平面显示字效果比较差，由于一圈中半径的问题，这里没有去想过多算法
解决此问题。

*************************************************************/
#include "NEW_8051.H"
#define uchar unsigned char
#define uint unsigned int    //宏定义

sbit KEY=P3^2;  //红外检测起点
//pc2002 设置 阳码 逐列 顺向取模  左右翻转    见设置图片
unsigned char code love[] = {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",0*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",1*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",2*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",3*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF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FF,0xFF,0xFF,/*" ",4*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",5*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",5*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",5*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",4*/

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,/*" ",5*/
};
/*****n（us）延时子程序*****/
void DelayUs(uint N)
{
    uint x ;
    for(x=0;x<=N;x++);
}

/*****主函数*****/
void main(void)
{
    uint i=0,j=0 ; 
	P1=0XFF;
	P2=0XFF;
	P0=0XFF;
 
//    led1=0 ;
    //主程序中只检测按键
    while(1)
    {
        if(KEY==0) //红外接收管 判断起始位
        {
            j++;            
            if(j>768) //根据显示的字数定义改数值768/16=48个字 显示完48个字后 重新开始
            {
                j=0 ;
            }            
             for(i=j;i<128+j;i++) //每转一圈  前进一列  这里定义一圈中同时显示128/16=8个字，
             {                    //在这个程序中如果此参数设置过大会造成头吃尾的后果，如果过少盲点又会太大           
              					  //所以比较麻烦 要根据电机速度来调整此参数                              
                P1=love[i*2];  //字幕数据低位送显示
                P0=love[i*2+1];	 //字幕数据高位送显示  //这里行和列 都是IO口独立驱动的LED
                DelayUs(210);	//延时让LED亮起来 每列延时的时间
                P1=0XFF;
                P0=0XFF;
                
            }
        }
    }
}
/*****END*****/