这个是头文件,数据结构
typedef struct{
unsigned char coil:1;
unsigned char contact:1;
unsigned int acc;
unsigned int set;
}TIME_RELAY;
typedef struct{
unsigned char coil:1;
unsigned char coil_old:1;
unsigned char contact:1;
unsigned char overflow:1;
unsigned int acc;
unsigned int set;
}COUNTER;
typedef struct {
unsigned char in:1;
unsigned char out:1;
unsigned char out_old:1;
unsigned char rise:1;
unsigned char fall:1;
unsigned char high_acc:8;
unsigned char low_acc:8;
unsigned char confirm_time;
}DI_FILTER;
void init_time_relay(TIME_RELAY *time_relay);
void scan_time_relay(TIME_RELAY *time_relay);
void init_counter(COUNTER *cu);
void scan_counter(COUNTER *cu);
void init_digital_input(DI_FILTER *di);
void scan_digital_input(DI_FILTER *di);
void init_plc(void);
void scan_plc(void);
unsigned char is_fall(unsigned char new,unsigned char *old);
unsigned char is_rise(unsigned char new,unsigned char *old);
|