Hi,
I'm trying to create an adjustable step generator in SCL, the idea being that a DB of words holds the step order and when the step has completed, the code looks to the next word for the step value.
i.e
DB1.DBW0 = 2 (move 2 to active step)
step done then
DB1.DBW2 = 15 (move 15 to active step)
step done then
DB1.DBW4 = 10 (move 10 to active step)
etc
each number is assigned to an action and once completed sets step end "high" to increment to the next word.
Ultimately i can alter the sequence order (valve control) via datablock edit.
Heres what i've wrote so far, but i get the following error on line 53 "Invalid data type" which is this line of code:
Active_Step:= Seq_DB.DW[step_index];
How do i address this so i can access each word with the offset provided by step_index?
this is my first attempt at SCL, so all criticism good and bad welcome
thanks Steve
I'm trying to create an adjustable step generator in SCL, the idea being that a DB of words holds the step order and when the step has completed, the code looks to the next word for the step value.
i.e
DB1.DBW0 = 2 (move 2 to active step)
step done then
DB1.DBW2 = 15 (move 15 to active step)
step done then
DB1.DBW4 = 10 (move 10 to active step)
etc
each number is assigned to an action and once completed sets step end "high" to increment to the next word.
Ultimately i can alter the sequence order (valve control) via datablock edit.
Heres what i've wrote so far, but i get the following error on line 53 "Invalid data type" which is this line of code:
Active_Step:= Seq_DB.DW[step_index];
How do i address this so i can access each word with the offset provided by step_index?
this is my first attempt at SCL, so all criticism good and bad welcome
thanks Steve
FUNCTION_BLOCK FB305
TITLE = 'Sequencer'
// know_how_protect
//
//
//
VERSION : '1.0'
AUTHOR : ???
FAMILY : SEQ_S7
NAME : Seq
VAR_INPUT
Seq_DB:BLOCK_DB;
Step_end:BOOL;
Max_Step:INT;
Reset:BOOL;
END_VAR
VAR_IN_OUT
Supervisor_time: INT;
END_VAR
VAR_OUTPUT
Active_Step:INT;
END_VAR
VAR_TEMP
END_VAR
VAR
//Static Variables
Step_end_store: BOOL;
Step_end_Pulse:BOOL;
Step_index:INT;
END_VAR
// Generate one shot pulse for Step_end
Step_end_Pulse:= Step_end AND NOT Step_end_store;
Step_end_store:=Step_end;
// maximum step reached or Reset needed?
IF step_index >= Max_step OR Reset THEN
step_index:=0;
END_IF;
// Step increment
IF Step_end_Pulse then
step_index:= step_index + 1;
Supervisor_time:=0;
Active_Step:= Seq_DB.DW[step_index];
// Active_Step:=step_index
END_IF;
END_FUNCTION_BLOCK