📄 const.h
字号:
/*
* Project: 3-PHASE AC DRIVE
*
* Microcontroller: Motorola MC68HC908MR24
*
* Module: CONST.H
* Revision/Date: 2.0 / February 2000
* Description: File contains global constants
*
* Compiler: Hiware08 Compiler
*
* Author: Radim VISINKA
* Company: MOTOROLA SPS
* Motorola Czech Systems Laboratories
* Roznov pod Radhostem, Czech Republic
*
* ===================================================================
*
* Copyright (c): MOTOROLA Inc.,1998, All rights reserved.
*
* ====================================================================
* THIS SOFTWARE IS PROVIDED BY MOTOROLA RSAL "AS IS" AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILI9Y AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA RSAL OR
* ITS 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.
* ====================================================================
*/
/* DEFINITION_START */
/* Constant Definitions */
#define PWM_MODULUS 0x00fa /* set MC PWM modulus to 16 kHz */
#define F_TIMERA_2 0xe100 /* 1/2 of timer frequency: 1/2 * (7.3728E6 / 64) */
/* Software Timer Constants */
#define READ_CONST 0x0073 /* read_constant timeout: 1msec=0x0073 */
/* 5msec = 0x0240 */
#define PI_CONST 0x0480 /* PI_constant timeout: 10msec=0x0480 */
/* const = time*7372800/64 */
/* PI Controller Constants */
#define I_CONST 0x30 /* Integrational constant */
#define P_CONST 0x70 /* Proportional constant */
#define MAX_SLIP 0x0a00 /* max slip is 10 Hz */
#define IN_1_LIMIT 0x6f00 /* Limitation of I part of PI controller */
/* Acceleration Ramp Constants */
#define ACC 11 /* acceleration constant => 20 Hz/sec */
#define DEC 11 /* deceleration constant => 20 Hz/sec */
/* acceleration (Hz) * 256 * 64
ACC = ---------------------------- * 256 = 11
7.3728 * 10^6
*/
/* acceleration = PWM_reload / ramp_reload * accel */
/* deceleration = PWM_reload / ramp_reload * decel */
/* result is in 8.8 format */
/* V/Hz Ramp Constants */
#define VOLTS_BOOST 10 /* min. voltage for boost = 10% from 255 */
#define VOLTS_MIN 9 /* min ampl. = 9% from 255 */
#define FREQ_BOOST 0x0f00 /* boost frequency = 15Hz*/
#define FREQ_BASE 0x3700 /* frequency base point 55Hz=0x3700, 50Hz=0x3200 25Hz=0x1900 */
/* I/O Constants and Definitions */
#define MCS_LED 0x10 /* Green LED on PTC4 */
#define YELLOW_LED 0x20 /* Yellow LED on PTC5 */
#define FAULT_LED 0x40 /* Red LED on PTC6 */
/* Fault Routine Constants and Definitions */
#define FLT_REC_LED_FLASH 0xff /* flash constant of fault LED */
#define OV_FLT_REC_TIME 0x1388 /* 5000 * speed routine enter */
#define OC_FLT_REC_TIME 0x2710 /* 10000 * speed routine enter */
#define DCB_VOLT_LIMIT 0xf2 /* overvoltage limit */
/* 400V = 3.235Vsens = 165 = 0xa5 */
#define DEC_LOW_DCB_V 0xca /* low limit of DCB during deceleration */
/* 340V=2.75Vsensed=140=0x8c */
#define DEC_HIGH_DCB_V 0xe4 /* high limit of DCB during deceleration */
/* 380V=3.07Vsensed=157=0x9d */
/* Vsensed = 0.0127 * Vdcb - 0.3607 ??????????*/
/* Control Loop Definition >>Speed_control<< */
#define OPEN_LOOP 0x01
/* Fault Register Definition >>Fault_flags<< */
#define OVER_VOLTAGE 0x01
#define OVER_CURRENT 0x02
#define OV_DEC_FLAG 0x80
/* MCS Status Register Definition >>Mcs_status<< */
#define GF_FLAG 0x01
#define GFR_FLAG 0x02
#define MCS_STAND_BY 0x04
#define MCS_STOP 0x08
#define MCS_RUN 0x10
#define START_STOP_FLG 0x20
#define MCS_ACCEL 0x40
/* authorize interrupts*/
#define cli() asm cli
#define sei() asm sei
/* DEFINITION_END */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -