📄 pwm_sync.h
字号:
/* MODULE PWM_sync. */
#ifndef __BWUserType_TChannels
#define __BWUserType_TChannels
typedef struct {
byte channel0 : 1; /* Channel 0 bit */
byte channel1 : 1; /* Channel 1 bit */
byte channel2 : 1; /* Channel 2 bit */
byte channel3 : 1; /* Channel 3 bit */
byte channel4 : 1; /* channel 4 bit */
byte channel5 : 1; /* channel 5 bit */
} TChannels; /* Structure contains bit informations for 6 channels, one bit for each channel. */
#endif
#ifndef __BWUserType_TChannelPairs
#define __BWUserType_TChannelPairs
typedef struct {
byte pair0 : 1; /* PWM pair 0 */
byte pair1 : 1; /* PWM pair 1 */
byte pair2 : 1; /* PWM pair 2 */
} TChannelPairs; /* 3 channel pairs represented by bit in structure. */
#endif
byte PWM_sync_Enable(void);
/*
** ===================================================================
** Method : PWM_sync_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_sync_Disable(void);
/*
** ===================================================================
** Method : PWM_sync_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
** ===================================================================
*/
void PWM_sync_SetHigh(void);
/*
** ===================================================================
** Method : PWM_sync_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 methods
** called automatically as s part of the CPU SetHighSpeed method.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void PWM_sync_InterruptOnReload(void);
/*
** ===================================================================
** Method : PWM_sync_InterruptOnReload (bean PWMMC)
**
** Description :
** The method services the interrupt of the selected peripheral(s)
** and eventually invokes the bean's event(s).
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void PWM_sync_InterruptOnFault(void);
/*
** ===================================================================
** Method : PWM_sync_InterruptOnFault (bean PWMMC)
**
** Description :
** The method services the interrupt of the selected peripheral(s)
** and eventually invokes the bean's event(s).
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void PWM_sync_Init(void);
/*
** ===================================================================
** Method : PWM_sync_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_sync_SetDuty(byte channel,int duty);
/*
** ===================================================================
** Method : PWM_sync_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_sync_Load() setRegBit(PWMB_PMCTL,LDOK)
/*
** ===================================================================
** Method : PWM_sync_Load (bean PWMMC)
**
** Description :
** Apply last setting of the methods SetDuty, SetDutyPercent,
** SetPeriod and SetPrescaler.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
#define PWM_sync_OutputPadEnable() setRegBit(PWMB_PMOUT,PAD_EN)
/*
** ===================================================================
** Method : PWM_sync_OutputPadEnable (bean PWMMC)
**
** Description :
** Method enables output pads.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
#define PWM_sync_OutputPadDisable() clrRegBit(PWMB_PMOUT,PAD_EN)
/*
** ===================================================================
** Method : PWM_sync_OutputPadDisable (bean PWMMC)
**
** Description :
** Method disables output pads.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
byte PWM_sync_SetRatio16(byte channel,word ratio);
/*
** ===================================================================
** Method : PWM_sync_SetRatio16 (bean PWMMC)
**
** Description :
** This method sets a new duty-cycle ratio for selected
** channel.
** Parameters :
** NAME - DESCRIPTION
** channel - channel 0 - 5
** ratio - Ratio is expressed as an 16-bit
** unsigned integer number. 0 - 65535 value
** is proportional to ratio 0 - 100%.
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_NOTAVAIL - Channel is disabled
** ERR_RANGE - Parameter channel is out of
** range
** ===================================================================
*/
byte PWM_sync_SetRatio15(byte channel,int ratio);
/*
** ===================================================================
** Method : PWM_sync_SetRatio15 (bean PWMMC)
**
** Description :
** This method sets a new duty-cycle ratio for selected
** channel.
** Parameters :
** NAME - DESCRIPTION
** channel - channel 0 - 5
** ratio - Ratio is expressed as an 16-bit
** signed integer number. 0 - 32767 value
** is proportional to ratio 0 - 100%.
** Value under 0 corresponds to 0% ratio.
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_NOTAVAIL - Channel is disabled
** ERR_RANGE - Parameter channel is out of
** range
** ===================================================================
*/
/* END PWM_sync. */
#endif /* ifndef __PWM_sync */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.97 [03.74]
** for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -