freescale

来自「Freescale 系列单片机常用模块与综合系统设计」· 代码 · 共 209 行

TXT
209
字号
/** ###################################################################
**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : PWM_5mS.H
**     Project   : line_following_car
**     Processor : MC9S08JM60CLHE
**     Component : PWM
**     Version   : Component 02.211, Driver 01.24, CPU db: 3.00.046
**     Compiler  : CodeWarrior HCS08 C Compiler
**     Date/Time : 2010-1-19, 19:33
**     Abstract  :
**         This bean implements a pulse-width modulation generator
**         that generates signal with variable duty and fixed cycle. 
**     Settings  :
**         Used output pin             : 
**             ----------------------------------------------------
**                Number (on package)  |    Name
**             ----------------------------------------------------
**                       15            |  PTE2_TPM1CH0
**             ----------------------------------------------------
**
**         Timer name                  : TPM1 [16-bit]
**         Counter                     : TPM1CNT   [$0021]
**         Mode register               : TPM1SC    [$0020]
**         Run register                : TPM1SC    [$0020]
**         Prescaler                   : TPM1SC    [$0020]
**         Compare register            : TPM1C0V   [$0026]
**         Flip-flop register          : TPM1C0SC  [$0025]
**
**         User handling procedure     : not specified
**
**         Port name                   : PTE
**         Bit number (in port)        : 2
**         Bit mask of the port        : $0004
**         Port data register          : PTED      [$0008]
**         Port control register       : PTEDD     [$0009]
**
**         Initialization:
**              Output level           : low
**              Timer                  : Enabled
**              Event                  : Enabled
**         High speed mode
**             Prescaler               : divide-by-4
**             Clock                   : 12000000 Hz
**           Initial value of            period     pulse width
**             Xtal ticks              : 60000      6000
**             microseconds            : 5000       500
**             milliseconds            : 5          0
**             seconds (real)          : 0.005      0.0005
**
**     Contents  :
**         Enable     - byte PWM_5mS_Enable(void);
**         Disable    - byte PWM_5mS_Disable(void);
**         SetRatio16 - byte PWM_5mS_SetRatio16(word Ratio);
**         SetDutyUS  - byte PWM_5mS_SetDutyUS(word Time);
**         SetDutyMS  - byte PWM_5mS_SetDutyMS(word Time);
**
**     Copyright : 1997 - 2009 Freescale Semiconductor, Inc. All Rights Reserved.
**     
**     http      : www.freescale.com
**     mail      : support@freescale.com
** ###################################################################*/

#ifndef __PWM_5mS
#define __PWM_5mS

/* MODULE PWM_5mS. */

/*Include shared modules, which are used for whole project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "PE_Timer.h"
#include "Cpu.h"

#define PWM_5mS_PERIOD_VALUE              0xEA5F /* Initial period value in ticks of the timer in high speed mode */
#define PWM_5mS_PERIOD_VALUE_HIGH         0xEA5F /* Period value in ticks of the timer in high speed mode */


byte PWM_5mS_Enable(void);
/*
** ===================================================================
**     Method      :  PWM_5mS_Enable (component PWM)
**
**     Description :
**         This method enables the component - it starts the signal
**         generation. Events may be generated (<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_5mS_Disable(void);
/*
** ===================================================================
**     Method      :  PWM_5mS_Disable (component PWM)
**
**     Description :
**         This method disables the component - it stops the signal
**         generation and events calling. When the timer is disabled,
**         it is possible to call <ClrValue> and <SetValue> methods.
**     Parameters  : None
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

byte PWM_5mS_SetRatio16(word Ratio);
/*
** ===================================================================
**     Method      :  PWM_5mS_SetRatio16 (component PWM)
**
**     Description :
**         This method sets a new duty-cycle ratio.
**     Parameters  :
**         NAME       - DESCRIPTION
**         Ratio      - Ratio is expressed as an 16-bit unsigned integer
**                      number. 0 - 0xFFFF value is proportional
**                      to ratio 0 - 100%
**         Note: Calculated duty depends on the timer possibilities
**               and on the selected period.
**     Returns     :
**         ---        - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

byte PWM_5mS_SetDutyUS(word Time);
/*
** ===================================================================
**     Method      :  PWM_5mS_SetDutyUS (component PWM)
**
**     Description :
**         This method sets the new duty value of the output signal.
**         The duty is expressed in microseconds as a 16-bit
**         unsigned integer number.
**     Parameters  :
**         NAME            - DESCRIPTION
**         Time            - Duty to set [in microseconds]
**                      (0 to 5000 us in high speed mode)
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_MATH - Overflow during evaluation
**                           ERR_RANGE - Parameter out of range
** ===================================================================
*/

byte PWM_5mS_SetDutyMS(word Time);
/*
** ===================================================================
**     Method      :  PWM_5mS_SetDutyMS (component PWM)
**
**     Description :
**         This method sets the new duty value of the output signal.
**         The duty is expressed in milliseconds as a 16-bit
**         unsigned integer number.
**     Parameters  :
**         NAME            - DESCRIPTION
**         Time            - Duty to set [in milliseconds]
**                      (0 to 5 ms in high speed mode)
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_MATH - Overflow during evaluation
**                           ERR_RANGE - Parameter out of range
** ===================================================================
*/

void PWM_5mS_Init(void);
/*
** ===================================================================
**     Method      :  PWM_5mS_Init (component PWM)
**
**     Description :
**         Initializes the associated peripheral(s) and the beans 
**         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.
** ===================================================================
*/


/* END PWM_5mS. */

#endif /* ifndef __PWM_5mS */
/*
** ###################################################################
**
**     This file was created by Processor Expert 3.07 [04.34]
**     for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/

⌨️ 快捷键说明

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