⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmx_pwm_chan_c.c

📁 cypress cy3721做的外部无线结点。感知温度后将温度值反给中心结点。
💻 C
字号:
//*****************************************************************************
//*****************************************************************************
//  FILENAME:  cmx_pwm_chan.c
//  @Version@
//  `@PSOC_VERSION`
//
//  DESCRIPTION:  C file for the PWM channel.
//-----------------------------------------------------------------------------
//      Copyright (c) Cypress MicroSystems 2001-2005. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************

#include "cmx_pwm_chan.h"

//-----------------------------------------------------------------------------
//  FUNCTION NAME: PWMSetDutyCycle(BYTE bID, BYTE bDutyCycle)
//
//  DESCRIPTION:  
//    Sets the duty cycle for the given channel.
//
//-----------------------------------------------------------------------------
//
//  ARGUMENTS: 
//    bID        => Pointer to ParameterBlock for this instance.
//    bDutyCycle =>
//
//  RETURNS: None
//
//  SIDE EFFECTS: 
//
//  THEORY of OPERATION or PROCEDURE: 
//
//
//-----------------------------------------------------------------------------
void PWMSetDutyCycle(BYTE bID, BYTE bDutyCycle)
{
	BYTE Period;
	BYTE CompareValue;
	if (bDutyCycle > 100)
	{
		bDutyCycle = 100;
	}
	Period = PWMGetPeriod(bID);
	CompareValue = ((int)(Period + 1) * (int)bDutyCycle)/100;
    PWMSetPulseWidth(bID, CompareValue);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -