📄 pwm.h
字号:
byte pair1 : 1; /* PWM pair 1 */
byte pair2 : 1; /* PWM pair 2 */
} TChannelPairs; /* 3 channel pairs represented by bit in structure. */
#endif
byte PWM_Enable(void);
/*
** ===================================================================
** Method : PWM_Enable (bean PWMMC)
**
** Description :
** Enable the bean - it starts the signal generation. Events
** can be disabled/enabled by DisableEvent/EnableEvent.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte PWM_Disable(void);
/*
** ===================================================================
** Method : PWM_Disable (bean PWMMC)
**
** Description :
** Disable the bean - it stops signal generation and events
** calling. When the timer is disabled, it is possible to
** call method "SetOutput" to control the output value on
** corresponding pin.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte PWM_EnableEvent(void);
/*
** ===================================================================
** Method : PWM_EnableEvent (bean PWMMC)
**
** Description :
** Enable the events. Method is available only if interrupt
** service/event is enabled.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte PWM_DisableEvent(void);
/*
** ===================================================================
** Method : PWM_DisableEvent (bean PWMMC)
**
** Description :
** Disable the events. Method is available only if interrupt
** service/event is enabled.
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
void PWM_SetHigh(void);
/*
** ===================================================================
** Method : PWM_SetHigh (bean PWMMC)
**
** Description :
** The method reconfigures the bean and its selected peripheral(s)
** when the CPU is switched to the High speed mode. The method is
** called automatically as s part of the CPU SetHighSpeed method.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void PWM_InterruptOnReload(void);
/*
** ===================================================================
** Method : PWM_InterruptOnReload (bean PWMMC)
**
** Description :
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void PWM_Init(void);
/*
** ===================================================================
** Method : PWM_Init (bean PWMMC)
**
** Description :
** Initializes the associated peripheral(s) and the bean's
** internal variables. The method is called automatically as a
** part of the application initialization code.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
byte PWM_SetPeriod(word period);
/*
** ===================================================================
** Method : PWM_SetPeriod (bean PWMMC)
**
** Description :
** Setting PWM modulo register. The value is loaded after
** calling Load() method.
** Parameters :
** NAME - DESCRIPTION
** period - Value for setting PWM period
** register in range 15 bit (12-bit on HC08 family).
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_RANGE - Parameter period is out of
** range
** ===================================================================
*/
byte PWM_SetDuty(byte channel,int duty);
/*
** ===================================================================
** Method : PWM_SetDuty (bean PWMMC)
**
** Description :
** Setting duty(value) register of selected channel. The
** value is loaded after calling Load() method.
** Parameters :
** NAME - DESCRIPTION
** channel - channel 0-5
** duty - Duty value for selected channel.
** Writing a number less than or equal to 0
** causes the PWM to be off for the entire
** PWM period. Writing a number greater
** than or equal to the 15 bit (12-bit on
** HC08MR32 CPU) modulus causes the PWM to
** be on for the entire PWM period.
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_NOTAVAIL - Channel is disabled
** ERR_RANGE - Parameter channel is out of
** range
** ===================================================================
*/
#define PWM_Load() setRegBit(PWM_PMCTL,LDOK)
/*
** ===================================================================
** Method : PWM_Load (bean PWMMC)
**
** Description :
** Apply last setting of the methods SetDuty, SetDutyPercent,
** SetPeriod and SetPrescaler.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
byte PWM_SetDutyPercent(byte channel,byte duty);
/*
** ===================================================================
** Method : PWM_SetDutyPercent (bean PWMMC)
**
** Description :
** Setting duty(value) in percent of selected channel. The
** value is loaded after calling Load() method.
** Parameters :
** NAME - DESCRIPTION
** channel - channel 0-5
** duty - Duty value in pecents for selected
** channel.
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_NOTAVAIL - Channel is disabled
** ERR_RANGE - Parameter channel is out of
** range
** ===================================================================
*/
#define PWM_OutputPadEnable() setRegBit(PWM_PMOUT,PAD_EN)
/*
** ===================================================================
** Method : PWM_OutputPadEnable (bean PWMMC)
**
** Description :
** Method enables output pads.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
#define PWM_OutputPadDisable() clrRegBit(PWM_PMOUT,PAD_EN)
/*
** ===================================================================
** Method : PWM_OutputPadDisable (bean PWMMC)
**
** Description :
** Method disables output pads.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
/* END PWM. */
#endif /* ifndef __PWM */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.98 [03.79]
** for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -