📄 tec.h
字号:
/********************************************************************
* File: Tec.h *
* Description: This file contains C-language type definitions for *
* the C28x based TEC system. *
* Author: David M. Alter *
* History: *
* 10/30/02 - original (D. Alter) *
********************************************************************/
#ifndef TEC_H
#define TEC_H
/*** Build options ***/
#define FILTER 1 // 1=use low-pass filter, 0=no filter
#define ADC_channel 0 // ADC channel used to read thermistor
// A0 to A7 = ch. 0-7, B0 to B7 = ch. 8-15
/*** Constant Definitions ***/
#define Q 32768 // I1Q15 fraction scaling value
#define NLP 5 // low-pass filter tap length
#define PWM_period 1023 // 1023 = 146kHz asym PWM @ 150MHz HSCLK
#define sample_period 5999 // 5999 = 195.3Hz, in sync with PWM clock with /128
#define ACTRA_pos_mask 0x0001 // ACTRA mask for positive u
#define ACTRA_neg_mask 0x0004 // ACTRA mask for negative u
#define VREF 2.0 // Reference voltage for PID loop
/*** Typedefs ***/
typedef struct {
float32 r; // r(k), reference value
float32 u; // u(k), total control signal
float32 e1; // e(k-1), previous error signal
float32 yf; // yf(k), filtered plant output
float32 ui1; // ui(k-1), previous I-mode control signal
float32 u_max; // total control limit
float32 ui_max; // I-mode control limit
float32 Kp; // P-control gain
float32 Ki; // I-control gain
float32 Kd; // D-control gain
int16 y; // y(k), plant output, I1Q15
int16 y1; // y(k-1), previous plant output, I1Q15
int16 y2; // y(k-2), previous plant output, I1Q15
int16 y3; // y(k-3), previous plant output, I1Q15
int16 y4; // y(k-4), previous plant output, I1Q15
} PID;
/*** Global Variable extern declarations ***/
extern PID TEC1; // the TEC system
extern int16 aLP[NLP]; // low-pass filter coefficients
#endif
/*** end of file *****************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -