#ifdef        GLOBALS_VARIABLE
    #define   EXTERN_VAR
    
#else
    #define   EXTERN_VAR     extern
    
#endif

#ifndef GLOBALS_VAR_H_
#define GLOBALS_VAR_H_ 

    EXTERN_VAR     volatile  INT8U               g_bReturn;     
    EXTERN_VAR     volatile  _Clock              g_Clock;     //ʱ��  
    EXTERN_VAR     volatile  _SysFlag            g_sysFlag;
    EXTERN_VAR     volatile  INT16U              g_busOffTime;//busoff�ָ�ʱ�� 
         
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FD0700;  
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FD7C00;  
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FED800; 
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FE4F17;  
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FF0113;  
    EXTERN_VAR     volatile  _CanMsg             g_Msg0CFED926;  
    EXTERN_VAR     volatile  _CanMsg             g_Msg18850000; 
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FF5100;
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FF5000;
    EXTERN_VAR     volatile  _CanMsg             g_Msg240;  //���� 100MM
    EXTERN_VAR     volatile  _CanMsg             g_Msg12B;
    EXTERN_VAR     volatile  _CanMsg             g_Msg125;
    EXTERN_VAR     volatile  _CanMsg             g_Msg230;
    EXTERN_VAR     volatile  _CanMsg             g_Msg7E8;
    EXTERN_VAR     volatile  _CanMsg             g_Msg7E82;
    EXTERN_VAR     volatile  _CanMsg             g_Msg18F0010B; 
    EXTERN_VAR     volatile  _CanMsg             g_Msg08FFF00B;  
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FEF100;
    EXTERN_VAR     volatile  _CanMsg             g_Msg18FEC600;
    
    EXTERN_VAR     volatile  _CanMsg             g_Msg0C01FF55;
    EXTERN_VAR     volatile  _CanMsg             g_Msg0C01FFAB;
    EXTERN_VAR     volatile  _CanMsg             g_Msg0C01FFA5;
    EXTERN_VAR     volatile  _CanMsg             g_Msg0A31FFE8;
    EXTERN_VAR     volatile  _CanMsg             g_Msg0A30FFE8;

    EXTERN_VAR     volatile  _CanMsg             g_Msg084;
    EXTERN_VAR     volatile  _CanMsg             g_Msg18DA17F9;
    EXTERN_VAR     volatile  _CanMsg             g_Msg101;  //ˮ�� ����
    EXTERN_VAR     volatile  _CanMsg             g_Msg402;  //������ָʾ��
    EXTERN_VAR     volatile  __RevCanMsg         g_Msg18DAF917;
 
    EXTERN_VAR     volatile  INT16U               g_frStep;
    EXTERN_VAR     volatile  INT16U               g_FRStep;
    EXTERN_VAR     volatile  INT16U               g_TLYStep;
    EXTERN_VAR     volatile  INT16U               g_SWStep;
    EXTERN_VAR     volatile  INT16U               g_runStep;  //����ѭ��λ��
    EXTERN_VAR     volatile  _Button             g_Button;
    EXTERN_VAR     volatile  INT8U               XUN_HUAN;
    EXTERN_VAR     volatile  INT8U               enable_24v;
    EXTERN_VAR  volatile    INT8U                   g_chksun;
    EXTERN_VAR     volatile  INT8U               g_curkeyinput;
    EXTERN_VAR  volatile    _SendCanMsg             g_txCanMsg;
     
    EXTERN_VAR     volatile  INT8U               Req_1001Flag;
    EXTERN_VAR     volatile  INT8U               Req_1003Flag; 
    EXTERN_VAR     volatile  INT8U               Req_2701Flag;
    EXTERN_VAR     volatile  INT8U               Req_2702Flag;
    
    EXTERN_VAR     volatile  INT8U               Req_1001FlagY;
    EXTERN_VAR     volatile  INT8U               Req_1003FlagY; 
    EXTERN_VAR     volatile  INT8U               Req_2701FlagY;
    EXTERN_VAR     volatile  INT8U               Req_2702FlagY;
    
    EXTERN_VAR     volatile  INT8U               Req_1001Flag1;
    EXTERN_VAR     volatile  INT8U               Req_1003Flag1; 
    EXTERN_VAR     volatile  INT8U               Req_2701Flag1;
    EXTERN_VAR     volatile  INT8U               Req_2702Flag1;
    
    EXTERN_VAR     volatile  INT8U               Req_1001FlagY1;
    EXTERN_VAR     volatile  INT8U               Req_1003FlagY1; 
    EXTERN_VAR     volatile  INT8U               Req_2701FlagY1;
    EXTERN_VAR     volatile  INT8U               Req_2702FlagY1;
    
    
    EXTERN_VAR     volatile  INT32U               CalcKey; 
                                                         
    EXTERN_VAR     volatile  INT32U               seed1; 
    EXTERN_VAR     volatile  INT32U               seed2; 
    EXTERN_VAR     volatile  INT32U               seed3; 
    EXTERN_VAR     volatile  INT32U               seed4;
    
    EXTERN_VAR     volatile  INT8U               DispFlag;
    
    EXTERN_VAR     volatile  INT32U   dwSeed1;
		EXTERN_VAR     volatile  INT32U   dwSeed2;
		EXTERN_VAR     volatile  INT32U   dwSeed3;
		EXTERN_VAR     volatile  INT32U   dwSeed4;		
    EXTERN_VAR     volatile  INT32U   dwKey1;
		EXTERN_VAR     volatile  INT32U   dwKey2;
		EXTERN_VAR     volatile  INT32U   dwKey3;
		EXTERN_VAR     volatile  INT32U   dwKey4;
		EXTERN_VAR     volatile  INT32U   a;
		EXTERN_VAR     volatile  INT32U   b;
		EXTERN_VAR     volatile  INT32U   c;
		EXTERN_VAR     volatile  INT32U   d;   
		
		EXTERN_VAR     volatile  INT8U               Lock; 
    EXTERN_VAR     volatile  INT8U               LockY;
    EXTERN_VAR     volatile  INT8U               LockY1;
    
    EXTERN_VAR     volatile  INT32U               glztest; 
    EXTERN_VAR     volatile  INT32U               glztestTime; 
    
    #define			cli()				DisableInterrupts
    #define			sei()				EnableInterrupts
    
    #define			PA8_EN				0
    #define			PA5_EN				1

    EXTERN_VAR     volatile   INT16U  CS_OUT_N;	
    EXTERN_VAR     volatile   INT16U  CS_OUT_CC;
    EXTERN_VAR     volatile   INT16U  CS_10VALUE;
    EXTERN_VAR     volatile   INT16U  CS_FR;
    EXTERN_VAR     volatile   INT16U  CS_FRset[20];
    EXTERN_VAR     volatile   INT16U   CS_FRNO;
    
    EXTERN_VAR     volatile   INT16U CS_FR_BASIC ;
    
    EXTERN_VAR     volatile   INT16U  ZS_OUT_N;	
    EXTERN_VAR     volatile   INT16U  ZS_OUT_CC;
    EXTERN_VAR     volatile   INT16U  ZS_10VALUE;
    EXTERN_VAR     volatile   INT16U  ZS_FR;
    EXTERN_VAR     volatile   INT16U  ZS_FRset[20];
    
    EXTERN_VAR   INT8U   CZBTIME0_6MSCCFF;    
    EXTERN_VAR   INT8U   iTIME1MS;                     //�ж���1MS��ʱ
    EXTERN_VAR   INT8U   iTIME2MS; 
    EXTERN_VAR   volatile INT8U T1MS_F1_FF;    //2MS��־(����ˮ�ͱ��߶�)

    EXTERN_VAR   volatile T2MS_F2_FF;     //2MS��־(���ڳ��ٱ��������峬�����)
    EXTERN_VAR   volatile T2MS_F9_FF;     //2MS��־(����ʱ���־)    
           
    #define         CZS_UP              0x04             
    #define         CZS_DN              0x05  
    #define         CZS_UP_COUNT        0x04+0x30   //������  
    EXTERN_VAR   INT16U   KeyPresTime;      	//��������ʱ��(��2MSΪ��λ)
    EXTERN_VAR   INT16U   Key1SCt;                 //2013-12-16 
    EXTERN_VAR   INT8U    KEYV;                   	//����ֵ //
    
    EXTERN_VAR     volatile   INT32U  WheelSpeedN; 
    EXTERN_VAR     volatile   INT32U  TxDelayTime; 
    EXTERN_VAR     volatile  _Button             G_Button;
    EXTERN_VAR     volatile  INT32U   AutoTime;
       
    
#endif /* GLOBALS_VAR_H_ */
