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

📄 init.c

📁 一整套电梯控制器源程序
💻 C
字号:
#include "public.h"

void init(void)
{

    P1=0xf5;      
    P3=0xff;  
     
    P2_0=0;
    P2_1=0;
    P2_2=0;
    P2_3=1;

    P2_5=0;
    P2_6=0;

	

    P2_4=!P2_4;   //sja1000片选选中   //LHM QUESTION: 是否应该是P2_4=0更好一些
//    PA377=0xff;
//    PB377=0xff;
//    PC377=0xff;
//    PD377=0xff;

    //定时器初始化(T1为20ms定时器:0001,0101;)
    TMOD=0x15;
    TH1=-20000/256;
    TL1=-20000%256;
    IP=0x08;      
    EA=1;
    ET1=1;        //T1开中断
    TR1=1;        //启动计数    
}

void init_data(void)
{   
    uchar i=0;
    m_set5045flg=1;
    //rec
    for(i=0; i<FLOOR_MAX; i++){
        m_cInSelLamp[i]=0;      
        array0[i]=0xFF; 
        array1[i]=0xFF; 
        array2[i]=0xFF; 
        array3[i]=0xFF; 
        array4[i]=0xFF; 
        keyboard[i]=0xFF;
		keyboardorg[i]=0xFF;
    }        
    m_cOverLoadLampFlg=0;
    m_cBingFlg=0;
    m_cArriveRingFlg=0;
    m_cInSelAllOffFlg=0;
// for test LHM 2004.12.31
//    m_cMaxFloorCnt=2;
//	m_cMaxFloorCnt=48;

    m_cDirect=0xFF;     
    m_cCurFloorNum=0;  


    time_5sta_count=TIMER_FILTER_NUM;
    time_5sta_flg=0;

	 time_insel_count=TIMER_100ms;
	 time_insel_flg=0;


    time_500ms_count=TIMER_500ms;
    time_500ms_flg=0;  

    time_arrive2s_count=TIMER_2s;
    time_arrive2s_flg=0;  

    time_bing2s_count=TIMER_2s;
    time_bing2s_flg=0;

    temp_state1=1;
    temp_state2=1;
    temp_state3=1;
    temp_state4=1;
    temp_state5=1;

    sum_state1=0;
    sum_state2=0;
    sum_state3=0;
    sum_state4=0;
    sum_state5=0;

    m_state1=0;  
    m_state2=0;  
    m_state3=0;  
    m_state4=0;  
    m_state5=0;  

    time_nocan_count=TIMER_5s;
	time_nocan_flg=0;

}

⌨️ 快捷键说明

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