📄 common.h
字号:
/*******************************************************************************
*
* File Name: common.h
*
* Description: Header file of the common definitions
*
* Modules Included: 1.STRUCTURE OF DATA
* 2.DEFINITION
*******************************************************************************/
#include <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908GZ60.h> /* include peripheral declarations */
#ifndef _COMMON_H
#define _COMMON_H
/////////////////////////
/***** STRUCTURE *****/
/////////////////////////
typedef unsigned char UINT8;
typedef unsigned int UINT16;
typedef unsigned long int UINT32;
typedef signed char SINT8;
typedef signed int SINT16;
typedef signed long int SINT32;
//typedef float F32;
//typedef double F64;
//structure of vfd g1-g3(00h-05h)
typedef union {
UINT8 Byte;
struct {
UINT8 P0 :1;
UINT8 P1 :1;
UINT8 P2 :1;
UINT8 P3 :1;
UINT8 P4 :1;
UINT8 P5 :1;
UINT8 P6 :1;
UINT8 P7 :1;
} Bits;
struct {
UINT8 Pnum :7;
UINT8 P7 :1;
} MergedBits;
}VFD_G1_G3;
//structure of vfd g4low(06h)
typedef union {
UINT8 Byte;
struct {
UINT8 P0 :1;
UINT8 P1 :1;
UINT8 P2 :1;
UINT8 P3 :1;
UINT8 P4 :1;
UINT8 P5 :1;
UINT8 P6 :1;
UINT8 P7 :1;
} Bits;
struct {
UINT8 AUTO :1;
UINT8 Pnum :6;
UINT8 FROST :1;
} MergedBits;
}VFD_G4_LOW;
//structure of vfd g4hi(07h)
typedef union {
UINT8 Byte;
struct {
UINT8 COOL :1;
UINT8 f1 :1;
UINT8 f2 :1;
UINT8 f3 :1;
UINT8 f4 :1;
UINT8 MAN :1;
UINT8 LPFAN :1;
UINT8 L1 :1;
} Bits;
}VFD_G4_HI;
//structure of key
typedef struct{
union{
UINT8 col12;
struct{
UINT8 s1 :1;
UINT8 s4 :1;
UINT8 s7 :1;
UINT8 s10 :1;
UINT8 s2 :1;
UINT8 s5 :1;
UINT8 s8 :1;
UINT8 s11 :1;
}Bits;
}byte1;
union{
UINT8 col34;
struct{
UINT8 s3 :1;
UINT8 s6 :1;
UINT8 s9 :1;
UINT8 s12 :1;
UINT8 none :4;
}Bits;
}byte2;
union{
UINT8 col56;
}byte3;
}VFDKEY;
//key press down&up flag
typedef union{
int keys;
struct{
UINT8 s1 :1;
UINT8 s4 :1;
UINT8 s7 :1;
UINT8 s10 :1;
UINT8 s2 :1;
UINT8 s5 :1;
UINT8 s8 :1;
UINT8 s11 :1;
UINT8 s3 :1;
UINT8 s6 :1;
UINT8 s9 :1;
UINT8 s12 :1;
UINT8 adc :4;
}key;
}KEYFLAG;
typedef struct ad_temperature_convert {
UINT8 ad;
SINT8 temperature;
};
//////////////////////////
/***** Definition *****/
//////////////////////////
//MOTOR_Prosition_AD Channel Select
#define MIX_Prosition 0x07 //PTB7
#define CYCLE_Prosition 0x06 //PTB6
#define MODE_Prosition 0x05 //PTB5
#define CENTER_Prosition 0x03 //PTB3
//SENSOR Select
#define TEMP_InCar 0x0A //PTA2
#define TEMP_OutCar 0x11 //PTG1
#define TEMP_Water 0x12 //PTG2
#define SunLight 0x0B //PTA3
//LED_Flag Select
#define MOTOR_MIX PTG_PTG4
#define MOTOR_CYCLE PTG_PTG5
#define MOTOR_MODE PTG_PTG6
#define MOTOR_CENTER PTG_PTG7
//MOTOR_Fault
#define FAULT_MIX PTG_PTG0
#define FAULT_CYCLE PTC_PTC5
#define FAULT_MODE PTC_PTC6
#define FAULT_CENTER PTG_PTG3
//MOTOR Select
#define MOTOR_MIX_EN PTC_PTC2
#define MOTOR_CYCLE_EN PTC_PTC3
#define MOTOR_MODE_EN PTC_PTC4
#define MOTOR_CENTER_EN PTB_PTB2
//Init_Prosition
#define MIX_Init 0x38
#define CYCLE_Init 0x78
#define MODE_Init 0xB8
#define CENTER_Init 0xD0
//VFD Connect
//#define SS PTD_PTD0
#define MISO PTD_PTD1 //Data in pin
#define MOSI PTD_PTD2 //Data out pin
#define SPSCK PTD_PTD3 //Communication clock pin
#define CS16512 PTF_PTF3 //CS to HT16512 pin
#define COMPRESSOR PTF_PTF2
#define S1 0x28 //MOTOR LIMIT PROSITION
#define S2 0x3C
#define S3 0x50
#define S4 0x64
#define S5 0x78
#define S6 0x8C
#define S7 0xA0
#define S8 0xB4
#define S9 0xC8
#define S10 0xDC //MOTOR LIMIT PROSITION
#define NONE 0x00
#define HIGH 0x01
#define LOW 0x02
#define MIDDEL 0x03
#define ON 0x01
#define OFF 0x00
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -