📄 pfm.c
字号:
#include "my.h"//包含头文件
extern struct {
unsigned char T1_ON ;
unsigned char T2_ON ;
unsigned char T3_ON ;//高电平时间数
unsigned char fadein_num ;
unsigned char fadeout_num ;
}body;
sbit PWM1 = P2^4;
sbit PWM2 = P2^5;
sbit PWM3 = P2^6;
unsigned char t;
extern bit on;
extern uchar irtime;
void Timer1_isr(void) interrupt 3 using 1
{
//static unsigned char count,t;
// static unsigned char bank2 irtime;
//static unsigned char bank2 i;
TH1=0xff; /* Init value */
TL1=0x38;
irtime++;
if(!PWM1)PWM1=1;
if(!PWM2)PWM2=1;
if(!PWM3)PWM3=1;
if(t==(T-body.T1_ON)&&body.T1_ON)//
PWM1=0;
if(t==(T-body.T2_ON)&&body.T2_ON)
PWM2=0;
if(t==(T-body.T3_ON)&&body.T3_ON)
PWM3=0;
t++;
}
void ISR(void) interrupt 0 using 1
{
t=0xf8;
TH1=0xff; /* Init value */
TL1=0x38;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -