bsp_gpio.h 4.23 KB
#ifndef _GLC_IO_H_
#define _GLC_IO_H_
#include "bsp.h"
/**********************************************************
		IO Define   [Add: 2016-10-24  By: CZ]
		宏定义:更加直观的编写程序
		端口编号从1开始++
***********************************************************/
//GLC_IO_ReadInput_24V---------------------------
//gpio引脚默认为低电平
#define  X1            			ReadInput(1) //壁障减速1
#define  X2   		     			ReadInput(2) //壁障减速2
#define  X3		     		    	ReadInput(3) //壁障停车
#define  X4         				ReadInput(4) // 后避障减速1
#define  X5 			     			ReadInput(5) // 后避障减速2
#define  X6 								ReadInput(6) // 后避障减速3
#define  X7  								ReadInput(7) // 急停 常开
#define  X8         		    ReadInput(8) //防撞条
#define  X9									ReadInput(9) // 启动 
#define  X10        	    	ReadInput(10) //暂停
#define  X11	    	        ReadInput(11)//左停靠
#define  X12	    					ReadInput(12)//右停靠
#define  X13	    	        ReadInput(13)//升降平台上限位
#define  X14	    					ReadInput(14)//升降平台下限位
#define  X15  	    				ReadInput(15)//左极限
#define  X16 	    	        ReadInput(16)//左到位对射
#define  X17	    	        ReadInput(17)//右到位对射
#define  X18	    					ReadInput(18)//右极限 
#define  X19	    	        ReadInput(19)//
#define  X20	    					ReadInput(20)//
#define  X21  	    				ReadInput(21)//急停	
#define  X22 	    	        ReadInput(22)		
#define  X23  	    				ReadInput(23)	
#define  X24 	    	        ReadInput(24)	
#define  X25	    	        GPIO_ReadInput_24V(24)
#define  X26	    					GPIO_ReadInput_24V(25)
#define  X27	    	        GPIO_ReadInput_24V(26)
#define  X28	    			    GPIO_ReadInput_24V(27)
#define  X29	    			  	GPIO_ReadInput_24V(28)
#define  X30	    			  	GPIO_ReadInput_24V(29)
#define  X31	    					GPIO_ReadInput_24V(30)
#define  X32	    	        GPIO_ReadInput_24V(31)
#define  X33	    			    GPIO_ReadInput_24V(32)
#define  X34	    			  	GPIO_ReadInput_24V(33)
#define  X35	    			  	GPIO_ReadInput_24V(34)
#define  X36	    					GPIO_ReadInput_24V(35)
#define  X37	    	        GPIO_ReadInput_24V(36)
#define  X38	    			    GPIO_ReadInput_24V(37)
#define  X39	    			  	GPIO_ReadInput_24V(38)
#define  X40	    			  	GPIO_ReadInput_24V(39)

//GLC_IO_SetOutput_24V-------------------------------------------------------
#define  Y1(n)			 				OutputProcess(1,n)//前壁障切换信号1
#define  Y2(n)			 				OutputProcess(2,n)//前壁障切换信号2
#define  Y3(n)			 				OutputProcess(3,n)//前壁障切换信号3
#define  Y4(n)							OutputProcess(4,n)//红灯
#define  Y5(n)							OutputProcess(5,n)//黄灯
#define  Y6(n)							OutputProcess(6,n)//绿灯
#define  Y7(n)		 		  		OutputProcess(7,n)//  启动灯
#define  Y8(n)		 	    		OutputProcess(8,n)//  暂停灯
#define  Y9(n)		 	    		OutputProcess(9,n)//  充电
#define  Y10(n)		 	    		OutputProcess(10,n)//  
#define  Y11(n)	        	  OutputProcess(11,n)// 
#define  Y12(n)	        	  OutputProcess(12,n)// 
#define  Y13(n)	     				OutputProcess(13,n)//
#define  Y14(n)	     				OutputProcess(14,n) //
#define  Y15(n)      				OutputProcess(15,n)//
#define  Y16(n)	     				OutputProcess(16,n) //
#define  Y17(n)	         	  OutputProcess(17,n)//
#define  Y18(n)	  					OutputProcess(18,n)//
#define  Y19(n)     				OutputProcess(19,n) //
#define  Y20(n)	   					OutputProcess(20,n)//
#define  Y21(n)	   					OutputProcess(21,n);//
#define  Y22(n)	   					OutputProcess(22,n);//
#define  Y23(n)	   					OutputProcess(23,n);//
#define  Y24(n)	   					OutputProcess(24,n);//
#define  Y25(n)	            GPIO_SetOutput_24V(24,n);//
#define  Y26(n)	   					GPIO_SetOutput_24V(25,n);//
#define  Y27(n)	   					GPIO_SetOutput_24V(26,n);//
#define  Y28(n)	            GPIO_SetOutput_24V(27,n);//

extern int InputData[3],OutputData[3];
typedef enum
{
    LE1=1,
	  LE2,
	  LE3
}LE;

typedef enum
{
    CS1 = 1,
	  CS2,
	  CS3
}INCS;

typedef union{
	short wValue[2];
	float fValue;
	int dwValue;
}tu_convert32;

void YOutputInit(void);
void XInputInit(void);
void SetOutput(u8 num);
void ResetOutput(u8 num);
bool ReadInput(u8 num);
void OutputProcess(u8 num,u8 value);
void UpdateGPIO_Input();
void UpdateGPIO_Output();
void Set573OutValue(u8 Data,LE LEX);
bool GPIO_ReadInput_24V(int index);
void GPIO_SetOutput_24V(int index, bool iBool);
bool GPIO_ReadOutput_24v(int index);
		
extern tu_convert32 tuconvert32,tuconvert32Two;
#endif