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

📄 intf_7549.c

📁 一款实用的电磁炉源码!供给懂得单片机c语言的朋友参考!
💻 C
字号:
/****************************************************************************
*                                                                           *
*   file name   : intf_7549.c                                              *
*                                                                           *
*   Version     : 1.00  ( 2007-2-6 ) Initial                              *
*                                                                           *
*   Copyright(C) 2007. Renesas Technology Corp., All rights reserved.       *
*                                                                           *
*****************************************************************************/
/*                                                                          *
*   Write the interrupt function according to your system                   *
*                                                                           *
*****************************************************************************/
/*
  note:
    This data is a freeware for 7549 Group.
    RENESAS TECHNOLOGY CORPORATION assumes no responsibility for any damage
    that occurred by this data.
*/
#include <intr740.h>
#include "sfr_7549.h"
#include "main.h"

char FlagStatus;
bit FlagLed0;
bit FlagLed1;
bit FlagLed2;
bit FlagLed3;
bit FlagLed4;
bit FlagLed5;
char CountKey;
int CountLongKey;
int count_1s;
char count_5s;
char count_10s;
char count_30s;
char count_500ms;
char count_1min;
char count_3min;
int count_20min;
int count_2s;//independence counter for surge ,should not use count_1s

bit FlagSurgeProtect;

//const char FuncWholeProcessTimer[8]={24,36,12,36,36,72,48,72};//need *100
const char FuncWholeProcessTimer[8]={36,36,12,36,36,24,48,24};//need *100

//zhufan 40min(40*60=2400),shaokao=1h,shaoshui=2-min,zhengdun=1h,jiachao=1h,huoguo=2h,aozhou=1.5h,baotang=2h

bit Flag2s;
bit Flag1s;
bit Flag7500mS800W;//need not initial
bit Flag5000mS400W;//need not inital
bit Flag2500mS200W;//need not inital
bit Flag5s;

bit Flag1sStart;//only for start subprogrom
bit Flag1Min;
bit Flag500msTwinkle;
bit Flag500ms;//need not initial
bit Flag5sTwinkle;
bit Flag30s;
bit Flag30sBaotang;
bit Flag40s;
bit Flag2Min;
bit Flag3Min;
bit FlagFuncEndProssTimer;
bit EnableYuYueCounter;
bit buzzer_on_flag;
unsigned char counter_120ms=0;
unsigned char signal_512us_end=0;
unsigned char signal_102ms_end=0;
char  counter_512us=0;
char counterInt_pan_check;
char count500ms_pancheck;
void interrupt[0] I_BRK(void){

}

void interrupt[2] I_Null1(void){	
		
	
}
void interrupt[4] I_Null2(void){

		
}
void interrupt[6] I_Null3(void){


}
void interrupt[8] I_Null4(void){  

		      
}
void interrupt[10] I_Timer1(void){//2ms
	
	count_500ms++;
	if(count_500ms==250)
		{
		Flag500msTwinkle=!Flag500msTwinkle;
		count_500ms=0;
		Flag500ms=1;
		}
	if(Flag500ms)
		{
		Flag500ms=0;
		count_10s++;
		if(count_10s==1)//for duan xu jia re
			{
			Flag7500mS800W=1;
			Flag5000mS400W=1;
			Flag2500mS200W=1;
			
			}
		else if(count_10s==6)//2.5s
			{
			Flag2500mS200W=0;
			}
		else if(count_10s==11)//5s
			{
			Flag5000mS400W=0;
			}
		else if(count_10s==16)//7.5s
			{
			Flag7500mS800W=0;
			}
		else if(count_10s==20)
			{
			count_10s=0;
			}
		}
	count_1s++;
	if(count_1s==500)
		{
		Flag1s=1;//should not be used by others program
		Flag1sStart=1;
		count_1s=0;//time=1s
		}
	if(Flag1s==1)
		{
		Flag1s=0;
		count_5s++;
		count_30s++;
		count_1min++;
		
		if(count_5s==5)
			{
			Flag5s=1;
			Flag5sTwinkle=!Flag5sTwinkle;
			count_5s=0;
			}
		if(count_30s==30)
			{
			Flag30s=1;
			count_30s=0;
			}
		if(count_1min==60)
			{
			Flag1Min=1;
			count_1min=0;
			}
		if(count_1min==40)
			{
			Flag40s=1;
			}
		if(EnableYuYueCounter)
			{
			count_3min++;
			count_20min++;
			if(count_3min==120)//for voer 1000c
				{
				Flag2Min=1;
				}
			//if(count_3min==180)//for over 100oc
			
			if(count_3min==120)//for over 100oc shaoshui shiche decided delay 2min shut down it.
				{
				Flag3Min=1;
				}
			if(count_3min==15)//30s for baotang
				{
				Flag30sBaotang=1;
				}
			if(count_20min==(FuncWholeProcessTimer[FuncSerial]*100))//set func wholepprocess end time
			//if(count_20min==(FuncWholeProcessTimer[FuncSerial]*10))//for test
				{
				FlagFuncEndProssTimer=1;
				}
			}
		}

	count_2s++;
	if(count_2s==1000)//2s
		{
		count_2s=0;
		Flag2s=1;
		}
	
	CountKey++;
	CountLongKey++;
	if(CountKey==6)//12ms
		{
		KeyScanCs=1;
		CountKey=0;
		}
	if(CountLongKey==250)//500ms
		{
		LongKeyCs=1;
		CountLongKey=0;
		}
	
	#if 1//common anode m37549
	FlagStatus++;//four led status crycle
		if (FlagStatus==6)
			{
			FlagStatus=0;
			}
	switch(FlagStatus)
			{
			case 0: 
					if(FlagLed0==0)//8-SEG led0
						{
						cs0PiD=0;// change cs0 to input
						cs1PiD=0;//change cs1 to input
						cs2=1;
						cs3=1;
						SerialOutputProcess(0xff);//clear 164 display buffer
						keyscan();
						SerialOutputProcess(Disp[0]);
						FlagLed0=1;
						FlagLed1=0;

						cs0PiD=1;//change cs0 to output
						cs0=0;//
						cs2=1;
						cs3=1;
						};
				break;
			case 1:
					if(FlagLed1==0)//group led0
						{
						cs0PiD=0;// change cs0 to input
						cs1PiD=0;//change cs1 to input
						cs2=1;
						cs3=1;
						SerialOutputProcess(0xff);//clear 164 display buffer
						keyscan();
						SerialOutputProcess(Disp[4]);
						FlagLed1=1;
						FlagLed2=0;

						cs0PiD=1;//change cs0 to output
						cs0=1;
						cs2=1;
						cs3=1;
						};
				break;
			case 2:
					if(FlagLed2==0)//8-SEG LED1
						{
						cs0PiD=0;// change cs0 to input
						cs1PiD=0;//change cs1 to input
						cs2=1;
						cs3=1;
						SerialOutputProcess(0xff);//clear 164 display buffer
						keyscan();
						SerialOutputProcess(Disp[1]);
						cs1PiD=1;//change cs1 to output
						cs1=0;
						cs2=1;
						cs3=1;
						FlagLed2=1;
						FlagLed3=0;
						};
				break;
			case 3:
					if(FlagLed3==0)//GROUP LED1
						{
						cs0PiD=0;// change cs0 to input
						cs1PiD=0;//change cs1 to input
						cs2=1;
						cs3=1;
						SerialOutputProcess(0xff);//clear 164 display buffer
						keyscan();
						SerialOutputProcess(Disp[5]);
						cs1PiD=1;//change cs1 to output
						cs1=1;
						cs2=1;
						cs3=1;
						FlagLed3=1;
						FlagLed4=0;
						};
				break;
			case 4:
					if(FlagLed4==0)//8-SEG LED2
						{
						cs0PiD=0;// change cs0 to input
						cs1PiD=0;//change cs1 to input
						cs2=1;
						cs3=1;
						SerialOutputProcess(0xff);//clear 164 display buffer
						keyscan();
						SerialOutputProcess(Disp[2]);
						cs2=0;
						cs3=1;
						FlagLed4=1;
						FlagLed5=0;
						};
					break;
			case 5:
					if(FlagLed5==0)//8-SEG LED3
						{
						cs0PiD=0;// change cs0 to input
						cs1PiD=0;//change cs1 to input
						cs2=1;
						cs3=1;
						SerialOutputProcess(0xff);//clear 164 display buffer
						keyscan();
						SerialOutputProcess(Disp[3]);
						cs2=1;
						cs3=0;
						FlagLed0=0;
						FlagLed5=1;
						};
				break;
			default:break;
			}
	#endif
}

void interrupt[12] I_AD(void){
	
	
}

void interrupt[14] I_Timer2(void){
	
		
				
}

void interrupt[16] I_TimerA(void){
	
	signal_512us_end = 1;		/* 0.512ms timing for V/I sample */	
	if(buzzer_on_flag)
		{
			counter_120ms++;
		
		}


					
}

void interrupt[18] I_Compare(void){

	
}

void interrupt[20] I_Capture(void){
	

}

void interrupt[22] I_Keyon(void){


	
}

void interrupt[24] I_Int1(void){
	K=0;
	FlagSurgeProtect= 1;
	count_2s=0;
	Flag2s=0;

	
}
void interrupt[26] I_Int0(void){

	counterInt_pan_check++;
	
	
}
void interrupt[28] I_SIOT(void){


	
}
void interrupt[30] I_SIOR(void){


	
}
      

⌨️ 快捷键说明

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