#define _MAIN_C_
#include "main.h"
/*******************************************************
全局变量定义
*******************************************************/
signed int TEMP1HH = 0; //显示中间值
signed int TEMP1LL = 0; //显示中间值
signed int TEMP2HH = 0; //显示中间值
signed int TEMP2LL = 0; //显示中间值
signed int TEMP3HH = 0; //显示中间值
signed int TEMP3LL = 0; //显示中间值
bit busy1 = 0; //串口1忙标志位
bit busy2 = 0; //串口2忙标志位
BYTE ch = 2; //ADC通道号
BYTE temp1h = 0; //温度1高8位
BYTE temp1l = 0; //温度1低8位
BYTE temp2h = 0; //温度2高8位
BYTE temp2l = 0; //温度2低8位
BYTE temp3h = 0; //温度3高8位
BYTE temp3l = 0; //温度3低8位
signed int temp1 = 0; //温度1寄存器
signed int temp2 = 0; //温度2寄存器
signed int temp3 = 0; //温度2寄存器
signed int temp1done = 0; //温度1换算后值
signed int temp2done = 0; //温度2换算后值
signed int temp3done = 0; //温度2换算后值
bit LED = 0; //LED亮灭标志位
idata BYTE string[5]={0,0,0,0,0}; //显示缓存。string[0]HH位,string[1]H位,string[2]L位, string[3]LL位,string[4]LED位
BYTE disp_place = 0; //数码管位移点亮计数器
WORD times_key_up = 0; //向上键防抖滤波值
WORD times_key_dn = 0; //向下键防抖滤波值
WORD times_key_enter = 0; //确定键防抖滤波值
WORD times_sound = 0; //蜂鸣器时间
FAN1_PWM = 1; //风扇1电压PWM控制 (不能为0,占空比为1%)
FAN2_PWM = 1; //风扇2电压PWM控制
FAN3_PWM = 1; //风扇3电压PWM控制
BYTE Menu = 1; //菜单选择键
bit DispDelayFlog = 1; //显示菜单延时标志位
WORD DispDelayTimes = 0; //显示延时计数器
BYTE control_mode = 1; //控制方式寄存器
BYTE LED_DELAY = 0; //闪烁延时
BYTE Heating_unit_number = 3; //加热单元选择寄存器
BYTE Sensor_selection = 1; //传感器选择
int Heat1Low_Temp = 80; //加热单元1开启温度
int Heat1Low_Temp_Mid = 0; //加热单元1开启温度中间值
int Heat1High_Temp = 150; //加热单元1关闭温度
int Heat1High_Temp_Mid = 0; //加热单元1开启温度中间值
int Heat2Low_Temp = 80; //加热单元2开启温度
int Heat2Low_Temp_Mid = 0; //加热单元2开启温度中间值
int Heat2High_Temp = 150; //加热单元2关闭温度
int Heat2High_Temp_Mid = 0; //加热单元2开启温度中间值
int Heat3Low_Temp = 80; //加热单元3开启温度
int Heat3Low_Temp_Mid = 0; //加热单元3开启温度中间值
int Heat3High_Temp = 150; //加热单元3关闭温度
int Heat3High_Temp_Mid = 0; //加热单元3开启温度中间值
BYTE Heat1_Power = 1; //加热单元1功率档位寄存器
BYTE Heat2_Power = 1; //加热单元2功率档位寄存器
BYTE Heat3_Power = 1; //加热单元3功率档位寄存器
bit EepromSaveFlog = 0; //EEPROM存储标志位
WORD slow_temp1_count = 0; //温度1通道软件滤波
signed int temp1done_Disp = 0; //滤波后温度1接收值
signed int temp12done_Disp = 0; //滤波后温度1接收值负值
WORD slow_temp2_count = 0; //温度2通道软件滤波
signed int temp2done_Disp = 0; //滤波后温度2接收值
signed int temp22done_Disp = 0; //滤波后温度2接收值负值
WORD slow_temp3_count = 0; //温度3通道软件滤波
signed int temp3done_Disp = 0; //滤波后温度3接收值
signed int temp32done_Disp = 0; //滤波后温度3接收值负值
bit Disp1_First_Right; //大于1000显示标志位
bit Disp1_First_Oppose; //小于0显示标志位
bit Disp2_First_Right; //大于1000显示标志位
bit Disp2_First_Oppose; //小于0显示标志位
bit Disp3_First_Right; //大于1000显示标志位
bit Disp3_First_Oppose; //小于0显示标志位
BYTE Disp_Temp_Chose = 1; //显示选择标志位
bit TEMP1_DELAY_TIME = 0; //温度1显示延时标志位
bit TEMP2_DELAY_TIME = 0; //温度2显示延时标志位
bit TEMP3_DELAY_TIME = 0; //温度3显示延时标志位
WORD Disp_Temp1_Chose_count = 0; //温度1显示延时计数器
WORD Disp_Temp2_Chose_count = 0; //温度2显示延时计数器
WORD Disp_Temp3_Chose_count = 0; //温度3显示延时计数器
BYTE Power_300 = 0; //300W功率PWM值
BYTE Power_350 = 0; //350W功率PWM值
BYTE Power_400 = 0; //400W功率PWM值
WORD Heat1ProgramCount = 0; //加热1程序段滤波计数器
WORD Heat2ProgramCount = 0; //加热2程序段滤波计数器
WORD Heat3ProgramCount = 0; //加热3程序段滤波计数器
WORD Heat1StayCount = 0; //加热1过度区域滤波计数器
WORD Heat2StayCount = 0; //加热2过度区域滤波计数器
WORD Heat3StayCount = 0; //加热3过度区域滤波计数器
WORD Change1Count = 0; //加热1停止去滤波计数器
WORD Change2Count = 0; //加热2停止去滤波计数器
WORD Change3Count = 0; //加热3停止去滤波计数器
bit Heat1Flog = 0; //加热1标志位
bit Heat2Flog = 0; //加热2标志位
bit Heat3Flog = 0; //加热3标志位
bit FAN1_STOP_DELAY = 0; //风扇1延时停止标志位
bit FAN2_STOP_DELAY = 0; //风扇2延时停止标志位
bit FAN3_STOP_DELAY = 0; //风扇3延时停止标志位
WORD fan1_delay_s = 0; //风扇1停止延时计数器S
WORD fan1_delay_ms = 0; //风扇1停止延时计数器MS
WORD fan2_delay_s = 0; //风扇2停止延时计数器S
WORD fan2_delay_ms = 0; //风扇2停止延时计数器MS
WORD fan3_delay_s = 0; //风扇3停止延时计数器S
WORD fan3_delay_ms = 0; //风扇3停止延时计数器MS
bit start_delay_flog = 0; //开机延时标志位
bit start_delay_flog2 = 0; //开机延时标志位
WORD start_delay = 0; //开机延时计数器
bit Error = 0; //总错误标志位
bit Error_Temp1 = 0; //温度1错误标志位
bit Error_Temp2= 0; //温度2错误标志位
bit Error_Temp3 = 0; //温度3错误标志位
bit Error_fan1 = 0; //风扇1错误标志位
bit Error_fan2 = 0; //风扇2错误标志位
bit Error_fan3 = 0; //风扇3错误标志位
bit Error_ptc1 = 0; //PTC1错误标志位
bit Error_ptc2 = 0; //PTC2错误标志位
bit Error_ptc3 = 0; //PTC3错误标志位
WORD spk_alrm_count = 0; //蜂鸣器鸣响延时寄存器
WORD error_disp_count = 0; //错误显示闪烁计数器
bit Error_Disp = 0; //错误显示闪烁反转标志位
WORD temp1_alrm_count = 0; //温度传感器1检测计数器
WORD temp2_alrm_count = 0; //温度传感器2检测计数器
WORD temp3_alrm_count = 0; //温度传感器3检测计数器
WORD temp1_check_count = 0; //温度传感器1检测计数器
WORD temp2_check_count = 0; //温度传感器2检测计数器
WORD temp3_check_count = 0; //温度传感器3检测计数器
WORD Fan1_Receive_Count = 0; //风扇1接收次数寄存器
bit Fan1_Receive_Value = 0; //风扇1接收电平寄存器
WORD Fan1_High_Receive = 0; //风扇1接收高电平计数器
WORD Fan1_LOW_Receive = 0; //风扇1接收低电平计数器
WORD Fan2_Receive_Count = 0; //风扇2接收次数寄存器
bit Fan2_Receive_Value = 0; //风扇2接收电平寄存器
WORD Fan2_High_Receive = 0; //风扇2接收高电平计数器
WORD Fan2_LOW_Receive = 0; //风扇2接收低电平计数器
WORD Fan3_Receive_Count = 0; //风扇3接收次数寄存器
bit Fan3_Receive_Value = 0; //风扇3接收电平寄存器
WORD Fan3_High_Receive = 0; //风扇3接收高电平计数器
WORD Fan3_LOW_Receive = 0; //风扇3接收低电平计数器
bit FAN1_CHECK_FLOG = 0; //风扇1检测开启标志位
bit FAN2_CHECK_FLOG = 0; //风扇2检测开启标志位
bit FAN3_CHECK_FLOG = 0; //风扇3检测开启标志位
WORD PTC2_Close_Count = 0; //加热体2关闭检测计数器关闭计数
WORD PTC2_Close_Alrm_Count = 0;
WORD PTC3_Close_Count = 0; //加热体2�
评论8