Browse Source

信息表

master
sc 6 months ago
parent
commit
7240e0f37d
  1. 67
      applications/data/SC828_DATA_table.c
  2. 48
      applications/data/SC828_DATA_table.h

67
applications/data/SC828_DATA_table.c

@ -204,8 +204,6 @@ IO_State_AIO ao_table[] = {
{5015, 0, STR_NULL},
{5016, 0, STR_NULL}
};
//步骤数据表最大99
IO_STEP_DATA step_table[99];
const unsigned char DI_TABLE_SIZE = sizeof(di_table) / sizeof(di_table[0]);
const unsigned char DO_TABLE_SIZE = sizeof(do_table) / sizeof(do_table[0]);
@ -213,37 +211,32 @@ const unsigned char AI_TABLE_SIZE = sizeof(ai_table) / sizeof(ai_table[0]);
const unsigned char AO_TABLE_SIZE = sizeof(ao_table) / sizeof(ao_table[0]);
const unsigned char DATA_TABLE_SIZE = sizeof(data_table) / sizeof(data_table[0]);
void DATA_Table_Init(){
for(int i=0;i<DI_TABLE_SIZE;i++)
{
di_table[i].current_state = 0;
}
for(int i=0;i<DO_TABLE_SIZE;i++)
{
do_table[i].current_state = 0;
}
//步骤数据表最大
//IO_STEP_DATA step_table[256] ;
IO_STEP_DATA *step_table= NULL;
for(int i=0;i<AI_TABLE_SIZE;i++)
{
ai_table[i].current_Value = 0;
}
for(int i=0;i<AO_TABLE_SIZE;i++)
{
ao_table[i].current_Value = 0;
}
extern struct rt_memheap sram_SRAM1,sdram_heap;
void DATA_Table_Init(){
step_table = rt_memheap_alloc(&sdram_heap, sizeof(IO_STEP_DATA)*256);
for(int i=0;i<DATA_TABLE_SIZE;i++)
{
data_table[i].current_data = 0;
}
for(int i=0;i<99;i++)
for(int i=0;i<256;i++)
{
step_table[i].RUN = 0;
rt_snprintf(step_table[i].Dyelot ,1,"");
step_table[i].ReDye = 0;
rt_snprintf(step_table[i].StepID ,1,"");
rt_snprintf(step_table[i].StepName ,1,"");
rt_snprintf(step_table[i].ParameterName ,1,"");
step_table[i].Parameter1 = 0;
step_table[i].Parameter2 = 0;
step_table[i].Parameter3 = 0;
step_table[i].Parameter4 = 0;
step_table[i].Parameter5 = 0;
step_table[i].P6 = 0;
step_table[i].P7 = 0;
step_table[i].P8 = 0;
step_table[i].P9 = 0;
step_table[i].P10 = 0;
step_table[i].Parameter1_S1 = 0;
step_table[i].Parameter2_S1 = 0;
step_table[i].Parameter3_S1 = 0;
@ -267,14 +260,24 @@ void DATA_Table_Init(){
}
//运行指令:开始
void DATA_INSTRUCTION_START(char p[25]){
for(int i=0;i<99;i++)
for(int i=0;i<256;i++)
{
step_table[i].RUN = 0;
rt_snprintf(step_table[i].Dyelot ,1,"");
step_table[i].ReDye = 0;
rt_snprintf(step_table[i].StepID ,1,"");
rt_snprintf(step_table[i].StepName ,1,"");
rt_snprintf(step_table[i].ParameterName ,1,"");
step_table[i].Parameter1 = 0;
step_table[i].Parameter2 = 0;
step_table[i].Parameter3 = 0;
step_table[i].Parameter4 = 0;
step_table[i].Parameter5 = 0;
step_table[i].P6 = 0;
step_table[i].P7 = 0;
step_table[i].P8 = 0;
step_table[i].P9 = 0;
step_table[i].P10 = 0;
step_table[i].Parameter1_S1 = 0;
step_table[i].Parameter2_S1 = 0;
step_table[i].Parameter3_S1 = 0;
@ -312,14 +315,24 @@ void DATA_INSTRUCTION_START(char p[25]){
}
//运行指令:结束
void DATA_INSTRUCTION_STOP(){
for(int i=0;i<99;i++)
for(int i=0;i<256;i++)
{
step_table[i].RUN = 0;
rt_snprintf(step_table[i].Dyelot ,1,"");
step_table[i].ReDye = 0;
rt_snprintf(step_table[i].StepID ,1,"");
rt_snprintf(step_table[i].StepName ,1,"");
rt_snprintf(step_table[i].ParameterName ,1,"");
step_table[i].Parameter1 = 0;
step_table[i].Parameter2 = 0;
step_table[i].Parameter3 = 0;
step_table[i].Parameter4 = 0;
step_table[i].Parameter5 = 0;
step_table[i].P6 = 0;
step_table[i].P7 = 0;
step_table[i].P8 = 0;
step_table[i].P9 = 0;
step_table[i].P10 = 0;
step_table[i].Parameter1_S1 = 0;
step_table[i].Parameter2_S1 = 0;
step_table[i].Parameter3_S1 = 0;
@ -420,6 +433,8 @@ static struct rt_thread dat_table_thread;
static void *dat_comm_stack __attribute__((aligned(4)))= RT_NULL ;
int data_table_th(void)
{
DATA_Table_Init();
rt_err_t dat_err;
dat_comm_stack = rt_memheap_alloc(&sram_DTCMRAM, 1024);

48
applications/data/SC828_DATA_table.h

@ -28,40 +28,6 @@ typedef struct {
char *Remark; //
} WorkOrder_DATA;
typedef struct {
char Dyelot[32]; // 单号
int ReDye;
char *Mode;
char StepID[4];
char *StepName;
char *ParameterName;
double P1;
double P2;
double P3;
double P4;
double P5;
int P6;
int P7;
int P8;
int P9;
int P10;
double P1_S1;
double P2_S1;
double P3_S1;
double P4_S1;
double P5_S1;
double P1_S2;
double P2_S2;
double P3_S2;
double P4_S2;
double P5_S2;
double P1_S3;
double P2_S3;
double P3_S3;
double P4_S3;
double P5_S3;
} Step_DATA;
typedef struct {
int pin; // ID
rt_int32_t current_data; // 当前状态
@ -69,13 +35,22 @@ typedef struct {
} IO_State_DATA;
typedef struct {
char Dyelot[32]; // 单号
int ReDye;
int RUN;
char StepID[3];
char StepID[4];
char StepName[20];
char ParameterName[50];
double Parameter1;
double Parameter2;
double Parameter3;
double Parameter4;
double Parameter5;
int P6;
int P7;
int P8;
int P9;
int P10;
char StepID_S1[3];
char StepID_S2[3];
char StepID_S3[3];
@ -101,7 +76,8 @@ extern IO_State_DIO do_table[];
extern IO_State_AIO ai_table[];
extern IO_State_AIO ao_table[];
extern IO_State_DATA data_table[];
extern IO_STEP_DATA step_table[99];
//extern IO_STEP_DATA step_table[256];
extern IO_STEP_DATA *step_table;
extern const unsigned char DI_TABLE_SIZE;
extern const unsigned char DO_TABLE_SIZE;

Loading…
Cancel
Save