请大神看看这个主程序里面的变量跟配置的管对应的,一直看不出来程序是怎么输出的,用哪个变量输出的,拜托了一下是主程序:
/**
Generated Main Source File
Company:
Microchip Technology Inc.
File Name:
main.c
Summary:
This is the main file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
Description:
This header file provides .implementations for driver APIs for all modules selected in the GUI.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2
Device : PIC16F15355
Driver Version : 2.00
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "mcc_generated_files/mcc.h"
#define State_Stop 0
#define State_Running 1
#define State_Error 2
#define State_Set_Temp 3
#define Set_TorH 4
#define Set_adjust_Fn 5
#define State_adjustTemp 6
#define State_adjustVn 7
#define State_PCF 8
#define mark_C 10
#define mark_E 11
#define mark_F 12
#define mark_Fu 13
#define mark_VL 14
#define mark_VM 15
#define mark_VH 16
#define mark_Nop 17
#define mark_P 18
#define mark_r 19
//#define mark_o 20
const uint8_t LED_SEG_TAB[]={0x88,0xbb,0xa4,0xa1,0x93,0xc1,0xc0,0xab,0x80,0x81, 0xcc,0xc4,0xc6, 0xf7, 0xfd,0xf5,0xe5, 0xff, 0x06,0xf6,0xf0}; //0123456789CEF - "L" "M" "H" *afb gcde
//温度范围:-30到50度。
const uint8_t BOX_TempAD[] =
{
25,27,28,30,32,33,35,37,39,41,//-30~-21
43,45,48,50,52,54,57,60,62,65,//-20~-11
67,70,73,76,79,82,85,88,91,94,//-10~-1
97,100,103,106,109,112,115,118,122,125,//0~9
128,131,134,137,140,143,146,149,151,154,//10~19
157,160,162,165,167,170,172,175,177,180,//20~29
182,184,186,188,190,192,194,196,198,200,//30~39
201,203,205,206,208,209,211,212,214,215,//40~49
216,217,218,219,220,221,222,223,224,225,//50~59
226,
};
#define Flash_addr_Onoff 0x1f00 // Set Onoff
#define Flash_addr_Temp 0x1f01 // Set_temper
#define Flash_addr_MAX 0x1f02 // MAX/ECO
#define Flash_addr_UintC 0x1f03 // UintC
#define Flash_addr_F0 0x1f04 // Set F1
#define Flash_addr_F1 0x1f05 // Set F2
#define Flash_addr_F2 0x1f06 // Set F3
#define Flash_addr_Vn 0x1f07 // Set Vn
#define OFF 0
#define ON 1
uint16_t RI_Temp=0;
uint8_t RI_Cnt=0;
uint8_t BL_Flag=0;
uint8_t BL_Delay;
uint8_t flag_5ms=0;
uint16_t n_5ms=0;
uint8_t Work_state=State_Stop;
uint16_t key_down_n=0;
uint8_t flag_key_down=0;
uint8_t flag_key_up=0;
uint8_t flag_keydown3s=0;
uint8_t Ssuo_3s_cnt=0;
uint8_t Key_Period=0;
uint8_t Set_Temp=18,Set_Temp_buff = 18; //0C;
uint8_t MAX_flag=1 , MAX_flag_buff=1;
uint8_t F_N=0;
uint8_t V_N=1;
uint8_t V_N_buff=1;
uint8_t Unit_C=1;
uint8_t FN_Tadj_N[] = {6, 6, 6}; //-4,-4,-4
//uint8_t FN_Tadj_N_buff[] = {8, 6, 4};
uint8_t data_baiwei=0;
uint8_t data_shiwei=0;
uint8_t data_gewei =0;
int16_t Error_Cnt=0;
int16_t Temp_current=0;
int16_t Temp_current_buff=0;
uint8_t Flag_ssuo_3s=0;
uint8_t XS_Com_N=0;
uint8_t Compre_err_cnt=0;
uint8_t Compre_Err_N=0;
uint8_t Refresh_time=0;
uint32_t DataAdd1 = 0;
uint16_t AdCount = 0;
uint8_t Start_delay_1s=0;
uint8_t Onoff_Status=OFF;
uint8_t Onoff_Status_buff=OFF;
uint8_t WriteBlock_flag=0;
uint16_t WriteWord_data[8];
uint8_t PowerUP_250ms=0;
uint8_t N_250ms=0;
uint8_t High_10ms=0;
uint8_t Low_10ms=0;
uint8_t Pulse_num=0;
uint16_t Error_500ms=0;
uint8_t ON_OFF_Flag;
uint8_t ON_OFF_Flag2;
uint8_t PCF_Flag;
uint8_t Compressor_Start_Flag=0;
uint8_t BL_Get_ONE;
uint8_t BL_Get_TWO;
uint8_t Flag_20mS;
uint8_t BL_Down_Flag;
//==========================================================================
void Work_start(void)
{
Onoff_Status = ON;
Work_state = State_Running;
//Work_state=State_Set_Temp; //
//Ssuo_3s_cnt=10;
}
//---------------------------------------
void Work_stop(void)
{
Ssuo_3s_cnt = 0;
Onoff_Status=OFF;
Work_state = State_Stop;
F_N=0;
Start_delay_1s=0;
}
void Scan_Key()
{
uint8_t Key_Current=0;
if(Key_DOWN_GetValue()==0) Key_Current|=0x01;
else Key_Current&=0b00001110;
if(Key_UP_GetValue()==0) Key_Current|=0x02;
else Key_Current&=0b00001101;
if(Key_ONOFF_GetValue()==0) Key_Current|=0x08;
else
{
Key_Current&=0b00000111;
ON_OFF_Flag2=0;
ON_OFF_Flag=0;
}
/*if((Work_state==State_Error)&&(Key_Current!=0x08)) Key_Current=0;*/
if(Key_Current==0)
{
key_down_n=0;
flag_key_up=0;
if(flag_keydown3s==1)
{
flag_keydown3s=0;
Ssuo_3s_cnt=20;
}
}
else if(Key_Current>0)
{
if(key_down_n<1) Key_Period=Key_Current;
if((Key_Period==Key_Current)&&(key_down_n<600))
{
key_down_n++;
}
else
{
key_down_n=0;
}
}
if(flag_key_up==0)
{
if(key_down_n>=5)
{
flag_key_up=1;
flag_key_down=1;
}
}
else if((key_down_n>=25)&&flag_keydown3s) //长按连续响应
{
key_down_n=0;
if(Work_state!=State_Running)
{
flag_key_down=1;
}
}
else if(key_down_n>=600)
{
if(Key_Period==0x08)
{
flag_key_down=1;
ON_OFF_Flag=1;
key_down_n=0;
}else if((Key_Period==0x06)&&(Work_state==State_Stop))
{
Work_state=Set_TorH;
Ssuo_3s_cnt=20;
key_down_n=0;
}
else if((Key_Period==0x03)&&(Work_state==State_Running))
{
Work_state=Set_adjust_Fn;
Ssuo_3s_cnt=20;
key_down_n=0;
F_N=0;
}
else if((Key_Period==0x03)&&(Work_state==State_Stop))
{
// Work_state=State_adjustVn;
Work_state=State_PCF;
Ssuo_3s_cnt=20;
key_down_n=0;
}
else if((Key_Period==0x01)||(Key_Period==0x02)) //add/dec
{
if(Work_state!=State_Stop)
{
flag_keydown3s=1;
flag_key_down=1;
Ssuo_3s_cnt=0;
}
}
}
}
//===============================================================================
void Key_deal(void)
{
if(flag_key_down)
{
flag_key_down=0;
key_down_n=0;
switch (Key_Period)
{
case 1: //dec
if(flag_keydown3s==0)
{
Ssuo_3s_cnt=15;
}
if(Work_state==State_Running)
{
Work_state=State_Set_Temp;
}
else if(Work_state==State_Set_Temp)
{
if(Set_Temp>0) Set_Temp--; //0: -18c
}
else if(Work_state==Set_TorH)
{
if(Unit_C) Unit_C=0;
else Unit_C=1;
}else if(Work_state==State_PCF)
{
if(PCF_Flag==0)
{
Work_state=State_adjustVn;
}else
{
Work_state=Set_TorH;
}
}
else if(Work_state==Set_adjust_Fn) Work_state=State_adjustTemp;
else if(Work_state==State_adjustTemp)
{
if(FN_Tadj_N[F_N]>0) FN_Tadj_N[F_N]--;
}
else if(Work_state ==State_adjustVn)
{
if(V_N>0) V_N--;
}
else Ssuo_3s_cnt=0;
break;
case 2: //add
if(flag_keydown3s==0)
{
Ssuo_3s_cnt=15;
}
if(Work_state==State_Running)
{
Work_state=State_Set_Temp;
}
else if(Work_state==State_Set_Temp)
{
if(Set_Temp<28) Set_Temp++; //0: -18c
}else if(Work_state==Set_TorH)
{
if(Unit_C) Unit_C=0;
else Unit_C=1;
}else if(Work_state==State_PCF)
{
if(PCF_Flag==0)
{
Work_state=State_adjustVn;
}else
{
Work_state=Set_TorH;
}
}
else if(Work_state==Set_adjust_Fn)
Work_state=State_adjustTemp;
else if(Work_state==State_adjustTemp)
{
if(FN_Tadj_N[F_N]<20) FN_Tadj_N[F_N]++;
}
else if(Work_state ==State_adjustVn)
{
if(V_N<2) V_N++;
}
else Ssuo_3s_cnt=0;
break;
case 4: //SET
/*if((Work_state==State_Running)||(Work_state==State_Set_Temp))
{
if(MAX_flag) MAX_flag=0;
else MAX_flag=1;
//Ssuo_3s_cnt=5;
}
else if((Work_state==Set_adjust_Fn)||(Work_state==State_adjustTemp))
{
Work_state = Set_adjust_Fn;
Ssuo_3s_cnt=15;
if(F_N<2) F_N++;
else F_N=0;
}*/
break;
case 8 : //on/off
if((Work_state==Set_adjust_Fn)||(Work_state==State_adjustTemp))
{
Work_state = Set_adjust_Fn;
Ssuo_3s_cnt=15;
if(F_N<2) F_N++;
else F_N=0;
}else if((ON_OFF_Flag==1)&&(ON_OFF_Flag2==0))
{
ON_OFF_Flag=0;
ON_OFF_Flag2=1;
key_down_n=0;
if(Work_state==State_Stop) Work_start();
else if((Work_state!=State_Stop)||(Work_state==State_Error))
{
Compre_Err_N=0;
Work_stop();
}
}else if(Work_state==State_PCF)
{
PCF_Flag^=1;
}
break;
}
Key_Period=0;
}
}
//---------------------------------------
void Temperature_Conversion(int16_t Temperature)
{
int16_t Temp_int=0;
uint8_t shiwei_buff=0;
uint8_t gewei_buff=0;
Temp_int=Temperature;
if (Unit_C == 0) Temp_int=(int16_t)Temp_int*18/10+32; // C --> F
if (Temp_int <0)
{
data_baiwei =LED_SEG_TAB[mark_Fu];
Temp_int = 0-Temp_int;
}
else
{
if (Temp_int>98) Temp_int=98;
data_baiwei =LED_SEG_TAB[mark_Nop];
}
Temperature =(uint8_t)Temp_int;
while (Temperature >= 10)
{
Temperature -= 10;
shiwei_buff++;
}
data_shiwei =LED_SEG_TAB[shiwei_buff];
gewei_buff = (uint8_t)Temperature;
data_gewei =LED_SEG_TAB[gewei_buff];
}
//---------------------------------------
void Updata_Display(void)
{
uint8_t XS_baiwei=0;
uint8_t XS_shiwei=0;
uint8_t XS_gewei =0;
if(PowerUP_250ms<8)
{
data_gewei = data_shiwei = data_baiwei =0x0;
}
else if(Work_state==State_Stop)
{
data_baiwei =0xff;
data_shiwei =0xff;
data_gewei =0xff;
}
else if(Work_state==State_Running)
{
Temperature_Conversion(Temp_current);
}
else if(Work_state==State_Set_Temp)
{
Temperature_Conversion(Set_Temp-18);
}
else if(Work_state==Set_TorH)
{
data_shiwei =data_baiwei =LED_SEG_TAB[mark_Nop];
if(Unit_C) data_gewei =LED_SEG_TAB[mark_C];
else data_gewei =LED_SEG_TAB[mark_F];
}
else if(Work_state==Set_adjust_Fn)
{
data_baiwei =LED_SEG_TAB[mark_Nop];
data_shiwei =LED_SEG_TAB[mark_F];
data_gewei =LED_SEG_TAB[F_N+1];
}
else if(Work_state==State_adjustTemp)
{
Temperature_Conversion(FN_Tadj_N[F_N]-10);
}
else if(Work_state==State_adjustVn)
{
if (V_N == 0)
{
data_gewei =data_shiwei = data_baiwei =LED_SEG_TAB[mark_VL];
}
else if (V_N == 1)
{
data_gewei =data_shiwei = data_baiwei =LED_SEG_TAB[mark_VM];
}
else if (V_N == 2)
{
data_gewei =data_shiwei = data_baiwei =LED_SEG_TAB[mark_VH];
}
}
else if(Work_state==State_PCF)
{
if(PCF_Flag==0)
{
data_shiwei =LED_SEG_TAB[mark_P];
data_gewei =LED_SEG_TAB[mark_r];
}else
{
if(Unit_C) data_gewei =LED_SEG_TAB[mark_C];
else data_gewei =LED_SEG_TAB[mark_F];
data_shiwei =0xff;
}
}
else if((Work_state==State_Error)&&(Error_Cnt==0))
{
data_baiwei =LED_SEG_TAB[mark_Nop];
data_shiwei =LED_SEG_TAB[mark_E];
data_gewei =LED_SEG_TAB[Compre_Err_N];
}
if(PowerUP_250ms>=8)
{
if(Flag_ssuo_3s)
{
XS_baiwei=0xff;
XS_shiwei=0xff;
XS_gewei =0xff;
}
else
{
XS_baiwei=data_baiwei;
XS_shiwei=data_shiwei;
XS_gewei =data_gewei;
}
}
PORTC=0xff; //COM_ge_SetHigh();
COM_shi_SetHigh();
COM_bai_SetHigh();
XS_Com_N++;
if(XS_Com_N>3) XS_Com_N=1;
switch (XS_Com_N)
{
case 1:
PORTC=XS_gewei;
COM_ge_SetLow();
COM_shi_SetHigh();
COM_bai_SetHigh();
break;
case 2:
PORTC=XS_shiwei;
COM_ge_SetHigh();
COM_shi_SetLow();
COM_bai_SetHigh();
break;
case 3:
PORTC=XS_baiwei;
COM_ge_SetHigh();
COM_shi_SetHigh();
COM_bai_SetLow();
break;
}
}
//======================================================
void AD_Conversion(void)
{
uint8_t RT_Value=0;
uint8_t XS_Temp_Value=0;
uint8_t jn=0;
uint8_t FN_Tadj_AD=0;
//uint8_t RI_Temp=0;
// if(Work_state==State_Running)
//{
DataAdd1 +=ADC_GetConversion(RT);
if(++AdCount >= 256)
{
//RI_Temp = DataAdd1>>16;
RT_Value += DataAdd1>>16;
if((RT_Value < 0x0A)||(RT_Value>250))//开路或短路
{
if(Work_state==State_Running)
{
Compre_err_cnt++;
if(Compre_err_cnt>=2)
{
Compre_err_cnt=0;
Compre_Err_N=6; //开路 或RT_Value >= 0xf8 短路
Work_state=State_Error;
Error_Cnt=400;
}
}
}
else
{
if(RT_Value<25) RT_Value=25;
while(RT_Value>BOX_TempAD[jn]) jn++; //60
if (jn >= 30) FN_Tadj_AD=FN_Tadj_N[0]; //>0 F1
else if((jn>=16)&&(jn<=29)) FN_Tadj_AD=FN_Tadj_N[1]; //0~-14 F2
else FN_Tadj_AD=FN_Tadj_N[2]; //<-15 F3
jn=(uint8_t)(jn+FN_Tadj_AD); //FN=init_data+10
Temp_current=(int16_t)jn-40; //表为30,由于实际补偿值=补偿值-10 补偿10为0 ,默认减30+10=40
if(Temp_current>60) Temp_current=60;
else if(Temp_current<-24) Temp_current=-24;
if((Work_state==State_Error)&&(Compre_Err_N==6))
{
Compre_err_cnt++;
if(Compre_err_cnt>2)
{
Compre_Err_N = 0;
Work_state=State_Running;
}
}
}
DataAdd1 = 0;
AdCount = 0;
}
}
//----------------------------------
void Compressor_ON (void)
{
//if(MAX_flag) //MAX 3500
// {
SP1_SetHigh();
SP2_SetHigh();
/* }
else //ECO 2500
{
SP1_SetHigh();
SP2_SetLow();
}*/
}
void Compressor_OFF(void)
{
SP1_SetLow();
SP2_SetLow();
}
//==========================================================================
void Compressor_Control(void) //250ms
{
int16_t Temp_true_set=0;
N_250ms++;
if(N_250ms>4) //1S
{
N_250ms=0;
if((Work_state==State_Running)||(Work_state==State_Set_Temp)||(Work_state==Set_adjust_Fn)||(Work_state==State_adjustTemp))
{
if(V_N ==0) //0k
{
VL1_SetHigh();
}
else if(V_N ==1) //8.2k
{
VL1_SetLow();
VL2_SetHigh();
}
else if(V_N ==2) //47k
{
VL1_SetLow();
VL2_SetLow();
}
Temp_true_set=(int16_t)Set_Temp-18;
if(Compressor_Start_Flag==0)
{
if(Start_delay_1s<10)
Start_delay_1s++; //压缩机启动延时 1s*10=10s
else if((Temp_current>=Temp_true_set+2)&&(BL_Flag==0))
{
Compressor_ON();
}
else if(Temp_current<=Temp_true_set)
{
Compressor_OFF();
Compressor_Start_Flag=1;
Start_delay_1s=0;
}
}else
{
if(Start_delay_1s<45) Start_delay_1s++; //压缩机启动延时 1s*10=10s
else if((Temp_current>=Temp_true_set+2)&&(BL_Flag==0))
{
Compressor_ON();
}
else if(Temp_current<=Temp_true_set)
{
Compressor_OFF();
Start_delay_1s=0;
}
}
}
else if((Work_state==State_Error)&&(Compre_Err_N<7));
else Compressor_OFF();
}
}
//==========================================================================
void Check_Compressor_Error(void)
{
if((Work_state==State_Stop)||(Work_state==Set_TorH)||(Work_state==Set_adjust_Fn)||(Work_state==State_adjustTemp)||(Work_state==State_adjustVn)||(Work_state==State_adjustVn)||(Work_state==State_PCF)) return;
if(ERR_GetValue()==0)
{
High_10ms=0;
Error_500ms=0;
if(Work_state!=State_Error)
{
Low_10ms++;
if(Low_10ms>=36) //L puls 36*5=180ms
{
Low_10ms=0;
Pulse_num++;
}
}
}
else //if(ERR_GetValue())
{
Low_10ms=0;
High_10ms++;
if(High_10ms>=100) //H puls 500ms
{
High_10ms=0;
if(Work_state!=State_Error)
{
Error_500ms=0;
if(Pulse_num>0)
{
Work_state=State_Error;
Compre_Err_N=Pulse_num;
Error_Cnt=400;
Pulse_num=0;
}
}
else if((Compre_Err_N>0)&&(Compre_Err_N<6)) //if(Work_state==State_Error)
{
if(Error_500ms<10) Error_500ms++;
else if(Error_500ms>=10) //500ms*10=5s
{
Error_500ms=0;
Pulse_num=0;
Compre_Err_N=0;
Work_state=State_Running;
}
}
}
}
}
//================================================
void Read_Momery_flash(void) //读FLASH函数
{
uint8_t Flash_Data=0;
Flash_Data = (uint8_t)FLASH_ReadWord(Flash_addr_Onoff);
if(Flash_Data==1)
{
Work_state=State_Running;
Onoff_Status = ON;
}
else
{
Work_state=State_Stop;
Onoff_Status = OFF;
}
Onoff_Status_buff=Onoff_Status;
Flash_Data = (uint8_t)FLASH_ReadWord(Flash_addr_Temp);
if (Flash_Data > 28) Set_Temp_buff =Set_Temp = 18; //00
else {Set_Temp_buff = Set_Temp = Flash_Data;}
Flash_Data = (uint8_t)FLASH_ReadWord(Flash_addr_MAX);
if (Flash_Data==0) MAX_flag=0;
else MAX_flag=1;
Flash_Data = (uint8_t)FLASH_ReadWord(Flash_addr_UintC);
if(Flash_Data<2) Unit_C=Flash_Data;
else Unit_C=1;
Flash_Data = (uint8_t)FLASH_ReadWord(Flash_addr_F0);
if(Flash_Data<21) FN_Tadj_N[0]=Flash_Data;
else FN_Tadj_N[0]=6; //-4
Flash_Data = (uint8_t)FLASH_ReadWord(Flash_addr_F1);
if(Flash_Data<21) FN_Tadj_N[1]=Flash_Data;
else FN_Tadj_N[1]=6; //-4
Flash_Data = (uint8_t)FLASH_ReadWord(Flash_addr_F2);
if(Flash_Data<21) FN_Tadj_N[2]=Flash_Data;
else FN_Tadj_N[2]=6; //-4
Flash_Data = (uint8_t)FLASH_ReadWord(Flash_addr_Vn);
if(Flash_Data<3)
{
V_N = Flash_Data;
}else
{
V_N=1; //H YCD60S1
}
V_N_buff=V_N;
}
//==========================================================================
/*
Main application
*/
void main(void)
{
// initialize the device
SYSTEM_Initialize();
// When using interrupts, you need to set the Global and Peripheral Interrupt Enable bits
// Use the following macros to:
// Enable the Global Interrupts
INTERRUPT_GlobalInterruptEnable();
// Enable the Peripheral Interrupts
INTERRUPT_PeripheralInterruptEnable();
// Disable the Global Interrupts
//INTERRUPT_GlobalInterruptDisable();
// Disable the Peripheral Interrupts
//INTERRUPT_PeripheralInterruptDisable();
Compressor_OFF();
Read_Momery_flash();
while (1)
{
// Add your application code
asm("CLRWDT");
if(flag_5ms)
{
flag_5ms=0;
if(RI_Cnt>=2)
{
RI_Cnt=0;
AD_Conversion();
}
if(Flag_20mS++>=5)
{
Flag_20mS=0;
if(Error_Cnt>0)
Error_Cnt--;
if(Work_state==State_Running)
{
if(BL_GetValue()==0)
{
if(BL_Get_ONE==0)
BL_Get_ONE=1;
else if(BL_Get_TWO==0)
{
BL_Get_ONE=0;
BL_Delay++;
if(BL_Delay>=50)
{
BL_Delay=0;
Compressor_OFF();
BL_Down_Flag=1;
BL_Flag=1;
}
//Work_stop();
}
}else
{
BL_Delay=0;
if(BL_Down_Flag==1)
{
BL_Down_Flag=0;
Work_start();
BL_Flag=0;
}
}
}
}
Scan_Key();
Key_deal();
Updata_Display();
Check_Compressor_Error();
if(n_5ms>=50) //50*5ms
{
n_5ms=0;
if(PowerUP_250ms<8) PowerUP_250ms++;
Compressor_Control();
if ((Onoff_Status_buff!=Onoff_Status)||(MAX_flag_buff!=MAX_flag)) WriteBlock_flag=1;
if (Ssuo_3s_cnt > 0)
{
Ssuo_3s_cnt--;
if (flag_keydown3s == 0)
{
if((Work_state==State_Set_Temp)||(Work_state == State_adjustTemp)||(Work_state==Set_TorH)||(Work_state==State_adjustVn)) Flag_ssuo_3s=~Flag_ssuo_3s;
else Flag_ssuo_3s=0;
}
else Flag_ssuo_3s=0;
if ((Ssuo_3s_cnt == 0)&&(flag_keydown3s == 0))
{
WriteBlock_flag=1;
if ((Work_state == Set_adjust_Fn) || (Work_state == State_adjustTemp)||(Work_state==State_Set_Temp)) Work_start();
else if((Work_state==State_PCF)||(Work_state==State_adjustVn)||(Work_state==Set_TorH))
{
Work_stop();
PCF_Flag=0;
}
//else Work_state = State_Running;
}
}
else
{
Flag_ssuo_3s = 0;
}
if(WriteBlock_flag==1)
{
WriteBlock_flag=0;
if(V_N_buff!=V_N) V_N_buff=V_N;
if (MAX_flag_buff!=MAX_flag) MAX_flag_buff=MAX_flag;
if(Onoff_Status_buff!=Onoff_Status) Onoff_Status_buff=Onoff_Status;
WriteWord_data[0] = Onoff_Status;
WriteWord_data[1] = Set_Temp;
WriteWord_data[2] = MAX_flag;
WriteWord_data[3] = Unit_C;
WriteWord_data[4] = FN_Tadj_N[0];
WriteWord_data[5] = FN_Tadj_N[1];
WriteWord_data[6] = FN_Tadj_N[2];
WriteWord_data[7] = V_N;
FLASH_WriteBlock(Flash_addr_Onoff,WriteWord_data);
}
}
}
}
}
/**
End of File
*/
以下是寄存器配置:
/**
Generated Pin Manager File
Company:
Microchip Technology Inc.
File Name:
pin_manager.c
Summary:
This is the Pin Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
Description:
This header file provides implementations for pin APIs for all pins selected in the GUI.
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2
Device : PIC16F15355
Driver Version : 2.11
The generated drivers are tested against the following:
Compiler : XC8 1.45
MPLAB : MPLAB X 4.15
Copyright (c) 2013 - 2015 released Microchip Technology Inc. All rights reserved.
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include <xc.h>
#include "pin_manager.h"
#include "stdbool.h"
void PIN_MANAGER_Initialize(void)
{
/**
LATx registers
*/
LATA = 0x00;
LATB = 0x30;
LATC = 0x00;
/**
TRISx registers
*/
TRISA = 0xA1;
TRISB = 0xDA;
TRISC = 0x00;
/**
ANSELx registers
*/
ANSELC = 0x00;
ANSELB = 0x04;
ANSELA = 0x20;
/**
WPUx registers
*/
WPUE = 0x00;
WPUB = 0xDA;
WPUA = 0x80;
WPUC = 0x7f;
/**
ODx registers
*/
ODCONA = 0x00;
ODCONB = 0x00;
ODCONC = 0x00;
/**
SLRCONx registers
*/
SLRCONA = 0xFF;
SLRCONB = 0xFF;
SLRCONC = 0xFF;
}
void PIN_MANAGER_IOC(void)
{
}
/**
End of File
*/
以下是另一个配置寄存器程序:
/**
@Generated Pin Manager Header File
@Company:
Microchip Technology Inc.
@File Name:
pin_manager.h
@Summary:
This is the Pin Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
@Description
This header file provides APIs for driver for .
Generation Information :
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2
Device : PIC16F15355
Driver Version : 2.11
The generated drivers are tested against the following:
Compiler : XC8 1.45
MPLAB : MPLAB X 4.15
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef PIN_MANAGER_H
#define PIN_MANAGER_H
#define INPUT 1
#define OUTPUT 0
#define HIGH 1
#define LOW 0
#define ANALOG 1
#define DIGITAL 0
#define PULL_UP_ENABLED 1
#define PULL_UP_DISABLED 0
// get/set ERR aliases
#define ERR_TRIS TRISAbits.TRISA0
#define ERR_LAT LATAbits.LATA0
#define ERR_PORT PORTAbits.RA0
#define ERR_WPU WPUAbits.WPUA0
#define ERR_OD ODCONAbits.ODCA0
#define ERR_ANS ANSELAbits.ANSA0
#define ERR_SetHigh() do { LATAbits.LATA0 = 1; } while(0)
#define ERR_SetLow() do { LATAbits.LATA0 = 0; } while(0)
#define ERR_Toggle() do { LATAbits.LATA0 = ~LATAbits.LATA0; } while(0)
#define ERR_GetValue() PORTAbits.RA0
#define ERR_SetDigitalInput() do { TRISAbits.TRISA0 = 1; } while(0)
#define ERR_SetDigitalOutput() do { TRISAbits.TRISA0 = 0; } while(0)
#define ERR_SetPullup() do { WPUAbits.WPUA0 = 1; } while(0)
#define ERR_ResetPullup() do { WPUAbits.WPUA0 = 0; } while(0)
#define ERR_SetPushPull() do { ODCONAbits.ODCA0 = 0; } while(0)
#define ERR_SetOpenDrain() do { ODCONAbits.ODCA0 = 1; } while(0)
#define ERR_SetAnalogMode() do { ANSELAbits.ANSA0 = 1; } while(0)
#define ERR_SetDigitalMode() do { ANSELAbits.ANSA0 = 0; } while(0)
// get/set VL1 aliases
#define VL1_TRIS TRISAbits.TRISA1
#define VL1_LAT LATAbits.LATA1
#define VL1_PORT PORTAbits.RA1
#define VL1_WPU WPUAbits.WPUA1
#define VL1_OD ODCONAbits.ODCA1
#define VL1_ANS ANSELAbits.ANSA1
#define VL1_SetHigh() do { LATAbits.LATA1 = 1; } while(0)
#define VL1_SetLow() do { LATAbits.LATA1 = 0; } while(0)
#define VL1_Toggle() do { LATAbits.LATA1 = ~LATAbits.LATA1; } while(0)
#define VL1_GetValue() PORTAbits.RA1
#define VL1_SetDigitalInput() do { TRISAbits.TRISA1 = 1; } while(0)
#define VL1_SetDigitalOutput() do { TRISAbits.TRISA1 = 0; } while(0)
#define VL1_SetPullup() do { WPUAbits.WPUA1 = 1; } while(0)
#define VL1_ResetPullup() do { WPUAbits.WPUA1 = 0; } while(0)
#define VL1_SetPushPull() do { ODCONAbits.ODCA1 = 0; } while(0)
#define VL1_SetOpenDrain() do { ODCONAbits.ODCA1 = 1; } while(0)
#define VL1_SetAnalogMode() do { ANSELAbits.ANSA1 = 1; } while(0)
#define VL1_SetDigitalMode() do { ANSELAbits.ANSA1 = 0; } while(0)
// get/set VL2 aliases
#define VL2_TRIS TRISAbits.TRISA2
#define VL2_LAT LATAbits.LATA2
#define VL2_PORT PORTAbits.RA2
#define VL2_WPU WPUAbits.WPUA2
#define VL2_OD ODCONAbits.ODCA2
#define VL2_ANS ANSELAbits.ANSA2
#define VL2_SetHigh() do { LATAbits.LATA2 = 1; } while(0)
#define VL2_SetLow() do { LATAbits.LATA2 = 0; } while(0)
#define VL2_Toggle() do { LATAbits.LATA2 = ~LATAbits.LATA2; } while(0)
#define VL2_GetValue() PORTAbits.RA2
#define VL2_SetDigitalInput() do { TRISAbits.TRISA2 = 1; } while(0)
#define VL2_SetDigitalOutput() do { TRISAbits.TRISA2 = 0; } while(0)
#define VL2_SetPullup() do { WPUAbits.WPUA2 = 1; } while(0)
#define VL2_ResetPullup() do { WPUAbits.WPUA2 = 0; } while(0)
#define VL2_SetPushPull() do { ODCONAbits.ODCA2 = 0; } while(0)
#define VL2_SetOpenDrain() do { ODCONAbits.ODCA2 = 1; } while(0)
#define VL2_SetAnalogMode() do { ANSELAbits.ANSA2 = 1; } while(0)
#define VL2_SetDigitalMode() do { ANSELAbits.ANSA2 = 0; } while(0)
// get/set SP1 aliases
#define SP1_TRIS TRISAbits.TRISA3
#define SP1_LAT LATAbits.LATA3
#define SP1_PORT PORTAbits.RA3
#define SP1_WPU WPUAbits.WPUA3
#define SP1_OD ODCONAbits.ODCA3
#define SP1_ANS ANSELAbits.ANSA3
#define SP1_SetHigh() do { LATAbits.LATA3 = 1; } while(0)
#define SP1_SetLow() do { LATAbits.LATA3 = 0; } while(0)
#define SP1_Toggle() do { LATAbits.LATA3 = ~LATAbits.LATA3; } while(0)
#define SP1_GetValue() PORTAbits.RA3
#define BL_GetValue() PORTBbits.RB4
#define SP1_SetDigitalInput() do { TRISAbits.TRISA3 = 1; } while(0)
#define SP1_SetDigitalOutput() do { TRISAbits.TRISA3 = 0; } while(0)
#define SP1_SetPullup() do { WPUAbits.WPUA3 = 1; } while(0)
#define SP1_ResetPullup() do { WPUAbits.WPUA3 = 0; } while(0)
#define SP1_SetPushPull() do { ODCONAbits.ODCA3 = 0; } while(0)
#define SP1_SetOpenDrain() do { ODCONAbits.ODCA3 = 1; } while(0)
#define SP1_SetAnalogMode() do { ANSELAbits.ANSA3 = 1; } while(0)
#define SP1_SetDigitalMode() do { ANSELAbits.ANSA3 = 0; } while(0)
// get/set SP2 aliases
#define SP2_TRIS TRISAbits.TRISA4
#define SP2_LAT LATAbits.LATA4
#define SP2_PORT PORTAbits.RA4
#define SP2_WPU WPUAbits.WPUA4
#define SP2_OD ODCONAbits.ODCA4
#define SP2_ANS ANSELAbits.ANSA4
#define SP2_SetHigh() do { LATAbits.LATA4 = 1; } while(0)
#define SP2_SetLow() do { LATAbits.LATA4 = 0; } while(0)
#define SP2_Toggle() do { LATAbits.LATA4 = ~LATAbits.LATA4; } while(0)
#define SP2_GetValue() PORTAbits.RA4
#define SP2_SetDigitalInput() do { TRISAbits.TRISA4 = 1; } while(0)
#define SP2_SetDigitalOutput() do { TRISAbits.TRISA4 = 0; } while(0)
#define SP2_SetPullup() do { WPUAbits.WPUA4 = 1; } while(0)
#define SP2_ResetPullup() do { WPUAbits.WPUA4 = 0; } while(0)
#define SP2_SetPushPull() do { ODCONAbits.ODCA4 = 0; } while(0)
#define SP2_SetOpenDrain() do { ODCONAbits.ODCA4 = 1; } while(0)
#define SP2_SetAnalogMode() do { ANSELAbits.ANSA4 = 1; } while(0)
#define SP2_SetDigitalMode() do { ANSELAbits.ANSA4 = 0; } while(0)
// get/set RT aliases
#define RT_TRIS TRISAbits.TRISA5
#define RT_LAT LATAbits.LATA5
#define RT_PORT PORTAbits.RA5
#define RT_WPU WPUAbits.WPUA5
#define RT_OD ODCONAbits.ODCA5
#define RT_ANS ANSELAbits.ANSA5
#define RT_SetHigh() do { LATAbits.LATA5 = 1; } while(0)
#define RT_SetLow() do { LATAbits.LATA5 = 0; } while(0)
#define RT_Toggle() do { LATAbits.LATA5 = ~LATAbits.LATA5; } while(0)
#define RT_GetValue() PORTAbits.RA5
#define RT_SetDigitalInput() do { TRISAbits.TRISA5 = 1; } while(0)
#define RT_SetDigitalOutput() do { TRISAbits.TRISA5 = 0; } while(0)
#define RT_SetPullup() do { WPUAbits.WPUA5 = 1; } while(0)
#define RT_ResetPullup() do { WPUAbits.WPUA5 = 0; } while(0)
#define RT_SetPushPull() do { ODCONAbits.ODCA5 = 0; } while(0)
#define RT_SetOpenDrain() do { ODCONAbits.ODCA5 = 1; } while(0)
#define RT_SetAnalogMode() do { ANSELAbits.ANSA5 = 1; } while(0)
#define RT_SetDigitalMode() do { ANSELAbits.ANSA5 = 0; } while(0)
// get/set COM_ge aliases
#define COM_ge_TRIS TRISAbits.TRISA6
#define COM_ge_LAT LATAbits.LATA6
#define COM_ge_PORT PORTAbits.RA6
#define COM_ge_WPU WPUAbits.WPUA6
#define COM_ge_OD ODCONAbits.ODCA6
#define COM_ge_ANS ANSELAbits.ANSA6
#define COM_ge_SetHigh() do { LATAbits.LATA6 = 1; } while(0)
#define COM_ge_SetLow() do { LATAbits.LATA6 = 0; } while(0)
#define COM_ge_Toggle() do { LATAbits.LATA6 = ~LATAbits.LATA6; } while(0)
#define COM_ge_GetValue() PORTAbits.RA6
#define COM_ge_SetDigitalInput() do { TRISAbits.TRISA6 = 1; } while(0)
#define COM_ge_SetDigitalOutput() do { TRISAbits.TRISA6 = 0; } while(0)
#define COM_ge_SetPullup() do { WPUAbits.WPUA6 = 1; } while(0)
#define COM_ge_ResetPullup() do { WPUAbits.WPUA6 = 0; } while(0)
#define COM_ge_SetPushPull() do { ODCONAbits.ODCA6 = 0; } while(0)
#define COM_ge_SetOpenDrain() do { ODCONAbits.ODCA6 = 1; } while(0)
#define COM_ge_SetAnalogMode() do { ANSELAbits.ANSA6 = 1; } while(0)
#define COM_ge_SetDigitalMode() do { ANSELAbits.ANSA6 = 0; } while(0)
// get/set Key_DOWN aliases
#define Key_DOWN_TRIS TRISAbits.TRISA7
#define Key_DOWN_LAT LATAbits.LATA7
#define Key_DOWN_PORT PORTAbits.RA7
#define Key_DOWN_WPU WPUAbits.WPUA7
#define Key_DOWN_OD ODCONAbits.ODCA7
#define Key_DOWN_ANS ANSELAbits.ANSA7
#define Key_DOWN_SetHigh() do { LATAbits.LATA7 = 1; } while(0)
#define Key_DOWN_SetLow() do { LATAbits.LATA7 = 0; } while(0)
#define Key_DOWN_Toggle() do { LATAbits.LATA7 = ~LATAbits.LATA7; } while(0)
#define Key_DOWN_GetValue() PORTBbits.RB1
#define Key_DOWN_SetDigitalInput() do { TRISAbits.TRISA7 = 1; } while(0)
#define Key_DOWN_SetDigitalOutput() do { TRISAbits.TRISA7 = 0; } while(0)
#define Key_DOWN_SetPullup() do { WPUAbits.WPUA7 = 1; } while(0)
#define Key_DOWN_ResetPullup() do { WPUAbits.WPUA7 = 0; } while(0)
#define Key_DOWN_SetPushPull() do { ODCONAbits.ODCA7 = 0; } while(0)
#define Key_DOWN_SetOpenDrain() do { ODCONAbits.ODCA7 = 1; } while(0)
#define Key_DOWN_SetAnalogMode() do { ANSELAbits.ANSA7 = 1; } while(0)
#define Key_DOWN_SetDigitalMode() do { ANSELAbits.ANSA7 = 0; } while(0)
// get/set COM_shi aliases
#define COM_shi_TRIS TRISBbits.TRISB0
#define COM_shi_LAT LATBbits.LATB0
#define COM_shi_PORT PORTBbits.RB0
#define COM_shi_WPU WPUBbits.WPUB0
#define COM_shi_OD ODCONBbits.ODCB0
#define COM_shi_ANS ANSELBbits.ANSB0
#define COM_shi_SetHigh() do { LATBbits.LATB0 = 1; } while(0)
#define COM_shi_SetLow() do { LATBbits.LATB0 = 0; } while(0)
#define COM_shi_Toggle() do { LATBbits.LATB0 = ~LATBbits.LATB0; } while(0)
#define COM_shi_GetValue() PORTBbits.RB0
#define COM_shi_SetDigitalInput() do { TRISBbits.TRISB0 = 1; } while(0)
#define COM_shi_SetDigitalOutput() do { TRISBbits.TRISB0 = 0; } while(0)
#define COM_shi_SetPullup() do { WPUBbits.WPUB0 = 1; } while(0)
#define COM_shi_ResetPullup() do { WPUBbits.WPUB0 = 0; } while(0)
#define COM_shi_SetPushPull() do { ODCONBbits.ODCB0 = 0; } while(0)
#define COM_shi_SetOpenDrain() do { ODCONBbits.ODCB0 = 1; } while(0)
#define COM_shi_SetAnalogMode() do { ANSELBbits.ANSB0 = 1; } while(0)
#define COM_shi_SetDigitalMode() do { ANSELBbits.ANSB0 = 0; } while(0)
// get/set Key_UP aliases
#define Key_UP_TRIS TRISBbits.TRISB1
#define Key_UP_LAT LATBbits.LATB1
#define Key_UP_PORT PORTBbits.RB1
#define Key_UP_WPU WPUBbits.WPUB1
#define Key_UP_OD ODCONBbits.ODCB1
#define Key_UP_ANS ANSELBbits.ANSB1
#define Key_UP_SetHigh() do { LATBbits.LATB1 = 1; } while(0)
#define Key_UP_SetLow() do { LATBbits.LATB1 = 0; } while(0)
#define Key_UP_Toggle() do { LATBbits.LATB1 = ~LATBbits.LATB1; } while(0)
#define Key_UP_GetValue() PORTAbits.RA7
#define Key_UP_SetDigitalInput() do { TRISBbits.TRISB1 = 1; } while(0)
#define Key_UP_SetDigitalOutput() do { TRISBbits.TRISB1 = 0; } while(0)
#define Key_UP_SetPullup() do { WPUBbits.WPUB1 = 1; } while(0)
#define Key_UP_ResetPullup() do { WPUBbits.WPUB1 = 0; } while(0)
#define Key_UP_SetPushPull() do { ODCONBbits.ODCB1 = 0; } while(0)
#define Key_UP_SetOpenDrain() do { ODCONBbits.ODCB1 = 1; } while(0)
#define Key_UP_SetAnalogMode() do { ANSELBbits.ANSB1 = 1; } while(0)
#define Key_UP_SetDigitalMode() do { ANSELBbits.ANSB1 = 0; } while(0)
// get/set LED_ECO aliases
#define LED_ECO_TRIS TRISBbits.TRISB4
#define LED_ECO_LAT LATBbits.LATB4
#define LED_ECO_PORT PORTBbits.RB4
#define LED_ECO_WPU WPUBbits.WPUB4
#define LED_ECO_OD ODCONBbits.ODCB4
#define LED_ECO_ANS ANSELBbits.ANSB4
#define LED_ECO_SetHigh() do { LATBbits.LATB4 = 1; } while(0)
#define LED_ECO_SetLow() do { LATBbits.LATB4 = 0; } while(0)
#define LED_ECO_Toggle() do { LATBbits.LATB4 = ~LATBbits.LATB4; } while(0)
#define LED_ECO_GetValue() PORTBbits.RB4
#define LED_ECO_SetDigitalInput() do { TRISBbits.TRISB4 = 1; } while(0)
#define LED_ECO_SetDigitalOutput() do { TRISBbits.TRISB4 = 0; } while(0)
#define LED_ECO_SetPullup() do { WPUBbits.WPUB4 = 1; } while(0)
#define LED_ECO_ResetPullup() do { WPUBbits.WPUB4 = 0; } while(0)
#define LED_ECO_SetPushPull() do { ODCONBbits.ODCB4 = 0; } while(0)
#define LED_ECO_SetOpenDrain() do { ODCONBbits.ODCB4 = 1; } while(0)
#define LED_ECO_SetAnalogMode() do { ANSELBbits.ANSB4 = 1; } while(0)
#define LED_ECO_SetDigitalMode() do { ANSELBbits.ANSB4 = 0; } while(0)
// get/set LED_MAX aliases
#define LED_MAX_TRIS TRISBbits.TRISB5
#define LED_MAX_LAT LATBbits.LATB5
#define LED_MAX_PORT PORTBbits.RB5
#define LED_MAX_WPU WPUBbits.WPUB5
#define LED_MAX_OD ODCONBbits.ODCB5
#define LED_MAX_ANS ANSELBbits.ANSB5
#define LED_MAX_SetHigh() do { LATBbits.LATB5 = 1; } while(0)
#define LED_MAX_SetLow() do { LATBbits.LATB5 = 0; } while(0)
#define LED_MAX_Toggle() do { LATBbits.LATB5 = ~LATBbits.LATB5; } while(0)
#define LED_MAX_GetValue() PORTBbits.RB5
#define LED_MAX_SetDigitalInput() do { TRISBbits.TRISB5 = 1; } while(0)
#define LED_MAX_SetDigitalOutput() do { TRISBbits.TRISB5 = 0; } while(0)
#define LED_MAX_SetPullup() do { WPUBbits.WPUB5 = 1; } while(0)
#define LED_MAX_ResetPullup() do { WPUBbits.WPUB5 = 0; } while(0)
#define LED_MAX_SetPushPull() do { ODCONBbits.ODCB5 = 0; } while(0)
#define LED_MAX_SetOpenDrain() do { ODCONBbits.ODCB5 = 1; } while(0)
#define LED_MAX_SetAnalogMode() do { ANSELBbits.ANSB5 = 1; } while(0)
#define LED_MAX_SetDigitalMode() do { ANSELBbits.ANSB5 = 0; } while(0)
// get/set Key_ONOFF aliases
#define Key_ONOFF_TRIS TRISBbits.TRISB6
#define Key_ONOFF_LAT LATBbits.LATB6
#define Key_ONOFF_PORT PORTBbits.RB6
#define Key_ONOFF_WPU WPUBbits.WPUB6
#define Key_ONOFF_OD ODCONBbits.ODCB6
#define Key_ONOFF_ANS ANSELBbits.ANSB6
#define Key_ONOFF_SetHigh() do { LATBbits.LATB6 = 1; } while(0)
#define Key_ONOFF_SetLow() do { LATBbits.LATB6 = 0; } while(0)
#define Key_ONOFF_Toggle() do { LATBbits.LATB6 = ~LATBbits.LATB6; } while(0)
#define Key_ONOFF_GetValue() PORTBbits.RB3
#define Key_ONOFF_SetDigitalInput() do { TRISBbits.TRISB6 = 1; } while(0)
#define Key_ONOFF_SetDigitalOutput() do { TRISBbits.TRISB6 = 0; } while(0)
#define Key_ONOFF_SetPullup() do { WPUBbits.WPUB6 = 1; } while(0)
#define Key_ONOFF_ResetPullup() do { WPUBbits.WPUB6 = 0; } while(0)
#define Key_ONOFF_SetPushPull() do { ODCONBbits.ODCB6 = 0; } while(0)
#define Key_ONOFF_SetOpenDrain() do { ODCONBbits.ODCB6 = 1; } while(0)
#define Key_ONOFF_SetAnalogMode() do { ANSELBbits.ANSB6 = 1; } while(0)
#define Key_ONOFF_SetDigitalMode() do { ANSELBbits.ANSB6 = 0; } while(0)
// get/set Key_SET aliases
#define Key_SET_TRIS TRISBbits.TRISB7
#define Key_SET_LAT LATBbits.LATB7
#define Key_SET_PORT PORTBbits.RB7
#define Key_SET_WPU WPUBbits.WPUB7
#define Key_SET_OD ODCONBbits.ODCB7
#define Key_SET_ANS ANSELBbits.ANSB7
#define Key_SET_SetHigh() do { LATBbits.LATB7 = 1; } while(0)
#define Key_SET_SetLow() do { LATBbits.LATB7 = 0; } while(0)
#define Key_SET_Toggle() do { LATBbits.LATB7 = ~LATBbits.LATB7; } while(0)
#define Key_SET_GetValue() PORTBbits.RB7
#define Key_SET_SetDigitalInput() do { TRISBbits.TRISB7 = 1; } while(0)
#define Key_SET_SetDigitalOutput() do { TRISBbits.TRISB7 = 0; } while(0)
#define Key_SET_SetPullup() do { WPUBbits.WPUB7 = 1; } while(0)
#define Key_SET_ResetPullup() do { WPUBbits.WPUB7 = 0; } while(0)
#define Key_SET_SetPushPull() do { ODCONBbits.ODCB7 = 0; } while(0)
#define Key_SET_SetOpenDrain() do { ODCONBbits.ODCB7 = 1; } while(0)
#define Key_SET_SetAnalogMode() do { ANSELBbits.ANSB7 = 1; } while(0)
#define Key_SET_SetDigitalMode() do { ANSELBbits.ANSB7 = 0; } while(0)
// get/set IO_RC0 aliases
#define IO_RC0_TRIS TRISCbits.TRISC0
#define IO_RC0_LAT LATCbits.LATC0
#define IO_RC0_PORT PORTCbits.RC0
#define IO_RC0_WPU WPUCbits.WPUC0
#define IO_RC0_OD ODCONCbits.ODCC0
#define IO_RC0_ANS ANSELCbits.ANSC0
#define IO_RC0_SetHigh() do { LATCbits.LATC0 = 1; } while(0)
#define IO_RC0_SetLow() do { LATCbits.LATC0 = 0; } while(0)
#define IO_RC0_Toggle() do { LATCbits.LATC0 = ~LATCbits.LATC0; } while(0)
#define IO_RC0_GetValue() PORTCbits.RC0
#define IO_RC0_SetDigitalInput() do { TRISCbits.TRISC0 = 1; } while(0)
#define IO_RC0_SetDigitalOutput() do { TRISCbits.TRISC0 = 0; } while(0)
#define IO_RC0_SetPullup() do { WPUCbits.WPUC0 = 1; } while(0)
#define IO_RC0_ResetPullup() do { WPUCbits.WPUC0 = 0; } while(0)
#define IO_RC0_SetPushPull() do { ODCONCbits.ODCC0 = 0; } while(0)
#define IO_RC0_SetOpenDrain() do { ODCONCbits.ODCC0 = 1; } while(0)
#define IO_RC0_SetAnalogMode() do { ANSELCbits.ANSC0 = 1; } while(0)
#define IO_RC0_SetDigitalMode() do { ANSELCbits.ANSC0 = 0; } while(0)
// get/set IO_RC1 aliases
#define IO_RC1_TRIS TRISCbits.TRISC1
#define IO_RC1_LAT LATCbits.LATC1
#define IO_RC1_PORT PORTCbits.RC1
#define IO_RC1_WPU WPUCbits.WPUC1
#define IO_RC1_OD ODCONCbits.ODCC1
#define IO_RC1_ANS ANSELCbits.ANSC1
#define IO_RC1_SetHigh() do { LATCbits.LATC1 = 1; } while(0)
#define IO_RC1_SetLow() do { LATCbits.LATC1 = 0; } while(0)
#define IO_RC1_Toggle() do { LATCbits.LATC1 = ~LATCbits.LATC1; } while(0)
#define IO_RC1_GetValue() PORTCbits.RC1
#define IO_RC1_SetDigitalInput() do { TRISCbits.TRISC1 = 1; } while(0)
#define IO_RC1_SetDigitalOutput() do { TRISCbits.TRISC1 = 0; } while(0)
#define IO_RC1_SetPullup() do { WPUCbits.WPUC1 = 1; } while(0)
#define IO_RC1_ResetPullup() do { WPUCbits.WPUC1 = 0; } while(0)
#define IO_RC1_SetPushPull() do { ODCONCbits.ODCC1 = 0; } while(0)
#define IO_RC1_SetOpenDrain() do { ODCONCbits.ODCC1 = 1; } while(0)
#define IO_RC1_SetAnalogMode() do { ANSELCbits.ANSC1 = 1; } while(0)
#define IO_RC1_SetDigitalMode() do { ANSELCbits.ANSC1 = 0; } while(0)
// get/set IO_RC2 aliases
#define IO_RC2_TRIS TRISCbits.TRISC2
#define IO_RC2_LAT LATCbits.LATC2
#define IO_RC2_PORT PORTCbits.RC2
#define IO_RC2_WPU WPUCbits.WPUC2
#define IO_RC2_OD ODCONCbits.ODCC2
#define IO_RC2_ANS ANSELCbits.ANSC2
#define IO_RC2_SetHigh() do { LATCbits.LATC2 = 1; } while(0)
#define IO_RC2_SetLow() do { LATCbits.LATC2 = 0; } while(0)
#define IO_RC2_Toggle() do { LATCbits.LATC2 = ~LATCbits.LATC2; } while(0)
#define IO_RC2_GetValue() PORTCbits.RC2
#define IO_RC2_SetDigitalInput() do { TRISCbits.TRISC2 = 1; } while(0)
#define IO_RC2_SetDigitalOutput() do { TRISCbits.TRISC2 = 0; } while(0)
#define IO_RC2_SetPullup() do { WPUCbits.WPUC2 = 1; } while(0)
#define IO_RC2_ResetPullup() do { WPUCbits.WPUC2 = 0; } while(0)
#define IO_RC2_SetPushPull() do { ODCONCbits.ODCC2 = 0; } while(0)
#define IO_RC2_SetOpenDrain() do { ODCONCbits.ODCC2 = 1; } while(0)
#define IO_RC2_SetAnalogMode() do { ANSELCbits.ANSC2 = 1; } while(0)
#define IO_RC2_SetDigitalMode() do { ANSELCbits.ANSC2 = 0; } while(0)
// get/set IO_RC3 aliases
#define IO_RC3_TRIS TRISCbits.TRISC3
#define IO_RC3_LAT LATCbits.LATC3
#define IO_RC3_PORT PORTCbits.RC3
#define IO_RC3_WPU WPUCbits.WPUC3
#define IO_RC3_OD ODCONCbits.ODCC3
#define IO_RC3_ANS ANSELCbits.ANSC3
#define IO_RC3_SetHigh() do { LATCbits.LATC3 = 1; } while(0)
#define IO_RC3_SetLow() do { LATCbits.LATC3 = 0; } while(0)
#define IO_RC3_Toggle() do { LATCbits.LATC3 = ~LATCbits.LATC3; } while(0)
#define IO_RC3_GetValue() PORTCbits.RC3
#define IO_RC3_SetDigitalInput() do { TRISCbits.TRISC3 = 1; } while(0)
#define IO_RC3_SetDigitalOutput() do { TRISCbits.TRISC3 = 0; } while(0)
#define IO_RC3_SetPullup() do { WPUCbits.WPUC3 = 1; } while(0)
#define IO_RC3_ResetPullup() do { WPUCbits.WPUC3 = 0; } while(0)
#define IO_RC3_SetPushPull() do { ODCONCbits.ODCC3 = 0; } while(0)
#define IO_RC3_SetOpenDrain() do { ODCONCbits.ODCC3 = 1; } while(0)
#define IO_RC3_SetAnalogMode() do { ANSELCbits.ANSC3 = 1; } while(0)
#define IO_RC3_SetDigitalMode() do { ANSELCbits.ANSC3 = 0; } while(0)
// get/set IO_RC4 aliases
#define IO_RC4_TRIS TRISCbits.TRISC4
#define IO_RC4_LAT LATCbits.LATC4
#define IO_RC4_PORT PORTCbits.RC4
#define IO_RC4_WPU WPUCbits.WPUC4
#define IO_RC4_OD ODCONCbits.ODCC4
#define IO_RC4_ANS ANSELCbits.ANSC4
#define IO_RC4_SetHigh() do { LATCbits.LATC4 = 1; } while(0)
#define IO_RC4_SetLow() do { LATCbits.LATC4 = 0; } while(0)
#define IO_RC4_Toggle() do { LATCbits.LATC4 = ~LATCbits.LATC4; } while(0)
#define IO_RC4_GetValue() PORTCbits.RC4
#define IO_RC4_SetDigitalInput() do { TRISCbits.TRISC4 = 1; } while(0)
#define IO_RC4_SetDigitalOutput() do { TRISCbits.TRISC4 = 0; } while(0)
#define IO_RC4_SetPullup() do { WPUCbits.WPUC4 = 1; } while(0)
#define IO_RC4_ResetPullup() do { WPUCbits.WPUC4 = 0; } while(0)
#define IO_RC4_SetPushPull() do { ODCONCbits.ODCC4 = 0; } while(0)
#define IO_RC4_SetOpenDrain() do { ODCONCbits.ODCC4 = 1; } while(0)
#define IO_RC4_SetAnalogMode() do { ANSELCbits.ANSC4 = 1; } while(0)
#define IO_RC4_SetDigitalMode() do { ANSELCbits.ANSC4 = 0; } while(0)
// get/set IO_RC5 aliases
#define IO_RC5_TRIS TRISCbits.TRISC5
#define IO_RC5_LAT LATCbits.LATC5
#define IO_RC5_PORT PORTCbits.RC5
#define IO_RC5_WPU WPUCbits.WPUC5
#define IO_RC5_OD ODCONCbits.ODCC5
#define IO_RC5_ANS ANSELCbits.ANSC5
#define IO_RC5_SetHigh() do { LATCbits.LATC5 = 1; } while(0)
#define IO_RC5_SetLow() do { LATCbits.LATC5 = 0; } while(0)
#define IO_RC5_Toggle() do { LATCbits.LATC5 = ~LATCbits.LATC5; } while(0)
#define IO_RC5_GetValue() PORTCbits.RC5
#define IO_RC5_SetDigitalInput() do { TRISCbits.TRISC5 = 1; } while(0)
#define IO_RC5_SetDigitalOutput() do { TRISCbits.TRISC5 = 0; } while(0)
#define IO_RC5_SetPullup() do { WPUCbits.WPUC5 = 1; } while(0)
#define IO_RC5_ResetPullup() do { WPUCbits.WPUC5 = 0; } while(0)
#define IO_RC5_SetPushPull() do { ODCONCbits.ODCC5 = 0; } while(0)
#define IO_RC5_SetOpenDrain() do { ODCONCbits.ODCC5 = 1; } while(0)
#define IO_RC5_SetAnalogMode() do { ANSELCbits.ANSC5 = 1; } while(0)
#define IO_RC5_SetDigitalMode() do { ANSELCbits.ANSC5 = 0; } while(0)
// get/set IO_RC6 aliases
#define IO_RC6_TRIS TRISCbits.TRISC6
#define IO_RC6_LAT LATCbits.LATC6
#define IO_RC6_PORT PORTCbits.RC6
#define IO_RC6_WPU WPUCbits.WPUC6
#define IO_RC6_OD ODCONCbits.ODCC6
#define IO_RC6_ANS ANSELCbits.ANSC6
#define IO_RC6_SetHigh() do { LATCbits.LATC6 = 1; } while(0)
#define IO_RC6_SetLow() do { LATCbits.LATC6 = 0; } while(0)
#define IO_RC6_Toggle() do { LATCbits.LATC6 = ~LATCbits.LATC6; } while(0)
#define IO_RC6_GetValue() PORTCbits.RC6
#define IO_RC6_SetDigitalInput() do { TRISCbits.TRISC6 = 1; } while(0)
#define IO_RC6_SetDigitalOutput() do { TRISCbits.TRISC6 = 0; } while(0)
#define IO_RC6_SetPullup() do { WPUCbits.WPUC6 = 1; } while(0)
#define IO_RC6_ResetPullup() do { WPUCbits.WPUC6 = 0; } while(0)
#define IO_RC6_SetPushPull() do { ODCONCbits.ODCC6 = 0; } while(0)
#define IO_RC6_SetOpenDrain() do { ODCONCbits.ODCC6 = 1; } while(0)
#define IO_RC6_SetAnalogMode() do { ANSELCbits.ANSC6 = 1; } while(0)
#define IO_RC6_SetDigitalMode() do { ANSELCbits.ANSC6 = 0; } while(0)
// get/set COM_bai aliases
#define COM_bai_TRIS TRISCbits.TRISC7
#define COM_bai_LAT LATCbits.LATC7
#define COM_bai_PORT PORTCbits.RC7
#define COM_bai_WPU WPUCbits.WPUC7
#define COM_bai_OD ODCONCbits.ODCC7
#define COM_bai_ANS ANSELCbits.ANSC7
#define COM_bai_SetHigh() do { LATCbits.LATC7 = 1; } while(0)
#define COM_bai_SetLow() do { LATCbits.LATC7 = 0; } while(0)
#define COM_bai_Toggle() do { LATCbits.LATC7 = ~LATCbits.LATC7; } while(0)
#define COM_bai_GetValue() PORTCbits.RC7
#define COM_bai_SetDigitalInput() do { TRISCbits.TRISC7 = 1; } while(0)
#define COM_bai_SetDigitalOutput() do { TRISCbits.TRISC7 = 0; } while(0)
#define COM_bai_SetPullup() do { WPUCbits.WPUC7 = 1; } while(0)
#define COM_bai_ResetPullup() do { WPUCbits.WPUC7 = 0; } while(0)
#define COM_bai_SetPushPull() do { ODCONCbits.ODCC7 = 0; } while(0)
#define COM_bai_SetOpenDrain() do { ODCONCbits.ODCC7 = 1; } while(0)
#define COM_bai_SetAnalogMode() do { ANSELCbits.ANSC7 = 1; } while(0)
#define COM_bai_SetDigitalMode() do { ANSELCbits.ANSC7 = 0; } while(0)
/**
@Param
none
@Returns
none
@Description
GPIO and peripheral I/O initialization
@Example
PIN_MANAGER_Initialize();
*/
void PIN_MANAGER_Initialize (void);
/**
* @Param
none
* @Returns
none
* @Description
Interrupt on Change Handling routine
* @Example
PIN_MANAGER_IOC();
*/
void PIN_MANAGER_IOC(void);
#endif // PIN_MANAGER_H
/**
End of File
*/
|