key.h 2.47 KB
#ifndef _KEY_H
#define _KEY_H
#include "sys.h"

//////////////////////////////////////////////////////////////////////////////////	 
////////////////////////////////////////////////////////////////////////////////// 	

//手持器输入
#define REMOTE1 PFin(0)
#define REMOTE2 PFin(1)
#define REMOTE3 PFin(2)
#define REMOTE4 PFin(3)
#define REMOTE5 PFin(4)
#define REMOTE6 PFin(5)
#define REMOTE7 PFin(6)
#define REMOTE8 PFin(7)
#define REMOTE9 PFin(8)
#define REMOTE10 PFin(9)
#define REMOTE11 PFin(10)
//4路报错输入
#define ERR1 PEin(2)
#define ERR2 PEin(3)
#define ERR3 PEin(4)
#define ERR4 PEin(5)
//3路LED输出
#define LED1 PDout(12)
#define LED2 PDout(13)
#define LED3 PDout(14)
//4路防撞输入
#define KNOCK1 PDin(11)
#define KNOCK2 PDin(10)
#define KNOCK3 PDin(9)
#define KNOCK4 PDin(8)
//4路防撞输出
#define CRL_sensor1 PFout(11)
#define CRL_sensor2 PFout(12)
#define CRL_sensor3 PFout(13)
#define CRL_sensor4 PFout(14)
//3路继电器控制输出
#define CRL_RELAY1  PBout(9)
#define CRL_RELAY2  PEout(0)
#define CRL_RELAY3  PEout(1)
//4路限位输入
#define Limit1      PBin(8)
#define Limit2      PBin(7)
#define Limit3      PAin(3)
#define Limit4      PAin(0)
//3路3.3v开关输入
#define KEY1        PFin(15)
#define KEY2        PGin(0)
#define KEY3        PGin(1)
//18路24V输入
#define STANDBY1    PDin(15)
#define STANDBY2    PGin(2)
#define STANDBY3    PGin(3)
#define STANDBY4    PGin(4)
#define STANDBY5    PGin(5)
#define STANDBY6    PGin(6)
#define STANDBY7    PGin(7)
#define STANDBY8    PGin(8)
#define STANDBY9    PAin(15)
#define STANDBY10    PGin(15)
#define STANDBY11    PBin(3)
#define STANDBY12    PBin(4)
#define STANDBY13    PBin(5)
#define STANDBY14    PBin(6)
#define STANDBY15    PCin(0)
#define STANDBY16    PCin(2)
#define STANDBY17    PCin(3)
#define STANDBY18    PAin(6)
//8路24V输出
#define OUT1        PCout(9)
#define OUT2        PCout(10)
#define OUT3        PCout(11)
#define OUT4        PDout(7)
#define OUT5        PDout(4)
#define OUT6        PGout(9)
#define OUT7        PGout(10)
#define OUT8        PGout(12)


extern short hand_control_data;//手持器状态字获取
extern short error_data;//4路报错输入状态字获取
extern short avoid_data;//4路防撞状态字获取
extern short limit_data;//限位开关状态字获取
extern int standby_data;//18路24输入状态字获取
extern short light_data;//扩展限位输入
extern short key_data;//3.3v开关输入

void In_Out(void);
void Input(void);
void get_comio_state(void);
void LED_out(short led);
void CRL_sensor(short crl);
void CRL_RELAY(short crl);
void OUT24V(short out);

#endif