⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tbm.c

📁 AirConditioner project
💻 C
字号:
/* Include */
#include <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908GZ60.h> /* include peripheral declarations */
#include "COMMON.h"
#include "TBM.h"
#include "VFD.h"
#include "AD.h"
#include "PROCESS.h"
#include "TIM.h"

/* Global Variables */
extern KEYFLAG keyflag;
extern UINT8 power;
extern volatile VFD_G4_LOW g4_lo;
extern volatile VFD_G4_HI g4_hi;
extern UINT8 ad_channel[4];
extern UINT8 adch;
extern UINT8 ad_data[4];
extern UINT8 process_flag;
extern UINT8 fan_flag;
extern UINT8 motor_prosition[4];
extern UINT8 target_prosition[4];

/*****************************************************************************
 * Function:        Access_VFD()
 *
 * Description:     none
 *
 * Returns:         none
 *
 * Notes:           
 *
 *****************************************************************************/
void interrupt Access_VFD(void){
  
  static UINT8 i=0,j=0;
	
	ReadKey();
	
	ProcessKey();
	
	__RESET_WATCHDOG();
	//when any keys down, stop write VFD
	//only all keys up, then write VFD
	if(keyflag.keys==0){
		WriteVFD();
	}
	
 //////////  COMPRESSOR  //////////

 if(g4_hi.Bits.COOL == 1 && power==ON) {
   COMPRESSOR = ON;
  }
  else if(g4_hi.Bits.COOL == 0 || power==OFF) {
     COMPRESSOR = OFF;
    }
 
 ////////////  
 motor_prosition[0]=AD_Sample(MIX_Prosition);
 motor_prosition[1]=AD_Sample(CYCLE_Prosition);     
 motor_prosition[2]=AD_Sample(MODE_Prosition);
 if(MOTOR_CENTER == 1) {
 		motor_prosition[3]=AD_Sample(CENTER_Prosition);
    target_prosition[3]=AD_Sample(SunLight);
 }
 __RESET_WATCHDOG();
 
 ////////////   Fan  ///////////////
 j++;
 if(j==5){
   if(fan_flag == ON){ 
         Fan_Up();
      } else if(fan_flag == OFF){
         Fan_Down();
        }
 	 j=0;
 }
 
  ///////////////////////////////////////////
 i++;
 if(i == 40){                          //3s passed
     i=0;
     ADSCR_ADCH=0x1F;
     ADSCR_AIEN = 1;                    //ADC interrupt enabled
     ADSCR_ADCH=ad_channel[adch];       //Enter AD Interrupt routine
  }
         
 TBCR_TACK=1;
  
 __RESET_WATCHDOG();                     /* kicks the dog */
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -