系统:RTX-51Tint
pwm 爱心灯
002.rar
(40.35 KB, 下载次数: 10)
# include <reg52.h>//头文件
# include "rtx51tny.h"
# include "intrins.h"
//============ 公用的全局变量==================
# include "DATA.h" //1层 数据层
# include "SHUAXIN.h" //2层 刷新层
//测试函数
void CheShi ()
{
XianChun02[0 ]=0X0001; // 00000000
XianChun02[1 ]=0X0001; // 00000001
XianChun02[2 ]=0X0001; // 00000011
XianChun02[3 ]=0X0001; // 00000111
XianChun02[4 ]=0X0001; // 00011000
XianChun02[5 ]=0X0001; // 00111100
XianChun02[6 ]=0X0001; // 01111110
XianChun02[7 ]=0X0001; // 11111111
XianChun02[15]=0X0001; // 00000000
XianChun02[14]=0X0001; // 00000001
XianChun02[13]=0X0001; // 00000011
XianChun02[12]=0X0001; // 00000111
XianChun02[11]=0X0001; // 00011000
XianChun02[10]=0X0001; // 00111100
XianChun02[9 ]=0X0001; // 01111110
XianChun02[8 ]=0X0001; // 11111111
}
void QieHuan () _task_ 2
{
char i;
while(1)
{
for(i=0;i<50;i++)
{
SX_P=XianChun01;os_switch_task();
if(i%2==0) SX_P=XianChun02;os_switch_task();
}
}
}
void main_() _task_ 0
{
P0=P1=0X00;
P2=P3=0XFF;
//CheShi ();//写入测试值
os_create_task(1);
os_create_task(2);
os_delete_task(0);
while(1)
{
}
}
|