这段c语言程序是什么意思?

#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit PMW1=P1^0;
sbit PMW2=P1^1;
void fhz() interrupt 1 using 1
{
TH0=0xff;
TL0=0xf4;
PMW1=~PMW1;
PMW2=~PMW2;
}

主要是产生两个PWM信号,(在这里是占空比为50%的方波,周期自己看看Timer0配置,这里代码没有给出,分别从P1的第一和第二脚位输出。
==================================================

#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit PMW1=P1^0; //PWM1 输出脚位
sbit PMW2=P1^1; //PWM2 输出脚位
void fhz() interrupt 1 using 1 //
{
TH0=0xff; //重置TIMER0的TH0
TL0=0xf4; //重置TIMER0的TL0,这就是TIMER0溢出的数值,周期是根据这两值算出来的,当然还
//有TIMER0的输入时间,也是下一次中断的时间
PMW1=~PMW1; //每次中断来临,翻转信号,并输出到P1^0
PMW2=~PMW2; //每次中断来临,翻转信号 ,并输出到P1^1
}

===========================================

解读完毕,有问题继续问
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-04-24
这是单片机的中断程序。
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit PMW1=P1^0; // 定义P1.0口
sbit PMW2=P1^1; //定义P2.0口
void fhz() interrupt 1 using 1 //下面请参看单片机中断。。
{
TH0=0xff;
TL0=0xf4;
PMW1=~PMW1;
PMW2=~PMW2;
}

相似回答