EBO-77/Sources/PWM1.h
2024-12-23 11:04:44 +08:00

169 lines
7.0 KiB
C

/* ###################################################################
** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : PWM1.h
** Project : DMK-BC316-77-AUTO
** Processor : MC9S12ZVL32MLF
** Component : PWM
** Version : Component 02.240, Driver 01.16, CPU db: 3.00.000
** Compiler : CodeWarrior HCS12Z C Compiler
** Date/Time : 2018-03-24, 10:58, # CodeGen: 18
** Abstract :
** This component implements a pulse-width modulation generator
** that generates signal with variable duty and fixed cycle.
** Settings :
** Used output pin :
** ----------------------------------------------------
** Number (on package) | Name
** ----------------------------------------------------
** 39 | PP5_XIRQ_KWP5_PWM5
** ----------------------------------------------------
**
** Timer name : PWM5 [8-bit]
** Counter : PWMCNT5 [0x0491]
** Mode register : PWMCTL [0x0485]
** Run register : PWME [0x0480]
** Prescaler : PWMPRCLK [0x0483]
** Compare 1 register : PWMPER5 [0x0499]
** Compare 2 register : PWMDTY5 [0x04A1]
** Flip-flop 1 register : PWMPOL [0x0481]
**
** User handling procedure : not specified
**
** Output pin
**
** Port name : P
** Bit number (in port) : 5
** Bit mask of the port : 0x0020
** Port data register : PTP [0x02F0]
** Port control register : DDRP [0x02F2]
**
** Runtime setting period : none
** Runtime setting ratio : calculated
** Initialization:
** Aligned : Left
** Output level : low
** Timer : Enabled
** Event : Enabled
** High speed mode
** Prescaler : divide-by-1
** Clock : 53333 Hz
** Initial value of period pulse width (ratio 0%)
** Xtal ticks : 4781 0
** microseconds : 4781 0
** milliseconds : 5 0
** seconds (real) : 0.00478125 0.0
**
** Contents :
** SetRatio16 - byte PWM1_SetRatio16(word Ratio);
** SetDutyUS - byte PWM1_SetDutyUS(word Time);
** SetDutyMS - byte PWM1_SetDutyMS(word Time);
**
** Copyright : 1997 - 2014 Freescale Semiconductor, Inc.
** All Rights Reserved.
**
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
**
** o Redistributions of source code must retain the above copyright notice, this list
** of conditions and the following disclaimer.
**
** o Redistributions in binary form must reproduce the above copyright notice, this
** list of conditions and the following disclaimer in the documentation and/or
** other materials provided with the distribution.
**
** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
** contributors may be used to endorse or promote products derived from this
** software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** http: www.freescale.com
** mail: support@freescale.com
** ###################################################################*/
/*!
** @file PWM1.h
** @version 01.16
** @brief
** This component implements a pulse-width modulation generator
** that generates signal with variable duty and fixed cycle.
*/
/*!
** @addtogroup PWM1_module PWM1 module documentation
** @{
*/
#ifndef __PWM1
#define __PWM1
/* MODULE PWM1. */
#include "derivative.h"
#include "CPU.h"
#pragma CODE_SEG PWM1_CODE
#define PWM1_PERIOD_VALUE 0xFFUL /* Initial period value in ticks of the timer */
#define PWM1_PERIOD_VALUE_HIGH 0xFFUL /* Initial period value in ticks of the timer in high speed mode */
byte PWM1_SetRatio16(word Ratio);
/*
** ===================================================================
** Method : PWM1_SetRatio16 (component PWM)
** Description :
** This method sets a new duty-cycle ratio. Ratio is expressed
** as a 16-bit unsigned integer number. Value 0 - 65535 value
** is proportional to ratio 0 - 100%.
** Note: Calculated duty depends on the timer possibilities and
** on the selected period.
** The method is available only if method <SetPeriodMode> is
** not selected.
** Parameters :
** NAME - DESCRIPTION
** Ratio - Ratio to set. 0 - 65535 value is
** proportional to ratio 0 - 100%
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
void PWM1_Init(void);
/*
** ===================================================================
** Method : PWM1_Init (component PWM)
**
** Description :
** Initializes the associated peripheral(s) and the component'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.
** ===================================================================
*/
#pragma CODE_SEG DEFAULT
/* END PWM1. */
#endif /* ifndef __PWM1 */
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.3 [05.09]
** for the Freescale HCS12Z series of microcontrollers.
**
** ###################################################################
*/