I finally convinced my boss, and we went with Weintek MT8051iP.
Unfortunately i am not able to make any progress with automatic work cycle other than getting function blocks to work at last. Although nothing happens when i press fbAutoCycleOn.
Also i wanted to make things easier for me and tried to rename generated variable names for Neuron I/O, but i think the way I did it is completely wrong as I've ran into random troubles.
At first i tried something like this :
hw.$Neuron M203_RO_2.01_w$:= bPumpOn;
But it didnt work, neither for RO or DI's.
iPressure:= REAL_TO_INT(hw.$Neuron M203_AI_1.01$);
iPressure_setpoint:=200;
IF iPressure >= iPressure_setpoint THEN
xPressureReached:= TRUE;
ELSE
xPressureReached:= FALSE;
END_IF;
(*// relay outputs binding
// down valve
IF bTableDown_valve THEN
hw.$Neuron M203_RO_2.01_w$:= TRUE;
ELSE
hw.$Neuron M203_RO_2.01_w$:= FALSE;
END_IF;
// up valve
IF bTableUp_valve THEN
hw.$Neuron M203_RO_2.02_w$:= TRUE;
ELSE
hw.$Neuron M203_RO_2.02_w$:= FALSE;
END_IF;
// bot down valve
IF bBottomTableDown_valve THEN
hw.$Neuron M203_RO_2.03_w$:= TRUE;
ELSE
hw.$Neuron M203_RO_2.03_w$:= FALSE;
END_IF;
// bot up valve
IF bBottomTableUp_valve THEN
hw.$Neuron M203_RO_2.04_w$:= TRUE;
ELSE
hw.$Neuron M203_RO_2.04_w$:= FALSE;
END_IF;
// high pressure
IF bHighPressure_valve THEN
hw.$Neuron M203_RO_2.05_w$:= TRUE;
ELSE
hw.$Neuron M203_RO_2.05_w$:= FALSE;
END_IF;
// pump
IF bPumpOn THEN
hw.$Neuron M203_RO_2.06_w$:= TRUE;
ELSE
hw.$Neuron M203_RO_2.06_w$:= FALSE;
END_IF;
// input assignment
// manual
IF hw.$Neuron M203_DI_2.10$ THEN
bManualMode:= TRUE;
ELSE
bManualMode:= FALSE;
END_IF;
// auto
IF hw.$Neuron M203_DI_2.11$ THEN
bAutoMode:= TRUE;
ELSE
bAutoMode:= FALSE;
END_IF;
// autoeject
IF hw.$Neuron M203_DI_2.12$ THEN
bAutoEjectorMode:= TRUE;
ELSE
bAutoEjectorMode:= FALSE;
END_IF;
// Limit up
IF hw.$Neuron M203_DI_1.01$ THEN
bLimitTableZero:= TRUE;
ELSE
bLimitTableZero:= FALSE;
END_IF;
// Limit bot up
IF hw.$Neuron M203_DI_1.02$ THEN
bLimitBottomTableUp:= TRUE;
ELSE
bLimitBottomTableUp:= FALSE;
END_IF;
// Limit bot down
IF hw.$Neuron M203_DI_1.03$ THEN
bLimitBottomTableDown:= TRUE;
ELSE
bLimitBottomTableDown:= FALSE;
END_IF;
// Pump on
IF hw.$Neuron M203_DI_2.01$ THEN
bPumpOn_button:= TRUE;
ELSE
bPumpOn_button:= FALSE;
END_IF;
// Pump off
IF hw.$Neuron M203_DI_2.02$ THEN
bPumpOff_button:= TRUE;
ELSE
bPumpOff_button:= FALSE;
END_IF;
// Table down
IF hw.$Neuron M203_DI_2.03$ THEN
bTableDown_button:= TRUE;
ELSE
bTableDown_button:= FALSE;
bTableDown_valve:= FALSE;
END_IF;
// Table up
IF hw.$Neuron M203_DI_2.04$ THEN
bTableUp_button:= TRUE;
ELSE
bTableUp_button:= FALSE;
bTableUp_valve:= FALSE;
END_IF;
// Bot table up
IF hw.$Neuron M203_DI_2.05$ THEN
bBottomTableUp_button:= TRUE;
ELSE
bBottomTableUp_button:= FALSE;
END_IF;
// Bot table down
IF hw.$Neuron M203_DI_2.06$ THEN
bBottomTableDown_button:= TRUE;
ELSE
bBottomTableDown_button:= FALSE;
END_IF;
// Auto on
IF hw.$Neuron M203_DI_2.07$ THEN
bAutoCycleOn:= TRUE;
ELSE
bAutoCycleOn:= FALSE;
END_IF;
// Auto off
IF hw.$Neuron M203_DI_2.08$ THEN
bAutoCycleOff:= TRUE;
ELSE
bAutoCycleOff:= FALSE;
END_IF;
// Zero
IF hw.$Neuron M203_DI_2.09$ THEN
bZeroTable_button:= TRUE;
ELSE
bZeroTable_button:= FALSE;
END_IF;
So right after this I have these IF's :
// table up
IF bTableUp_button = TRUE AND NOT bLimitTableZero THEN
bTableUp_valve:=TRUE;
ELSE
bTableUp_valve:=FALSE;
END_IF;
// table down
IF bTableDown_button = TRUE AND NOT xPressureReached THEN
bTableDown_valve:=TRUE;
ELSE
bTableDown_valve:=FALSE;
END_IF;
// ejector down
IF bBottomTableDown_button = TRUE &
bLimitBottomTableDown = FALSE &
bManualMode = TRUE THEN
bBottomTableDown_valve:=TRUE;
ELSE
bBottomTableDown_valve:= FALSE;
END_IF;
// ejector up
IF bBottomTableUp_button = TRUE &
bLimitBottomTableUp = FALSE &
bManualMode = TRUE THEN
bBottomTableUp_valve:=TRUE;
ELSE
bBottomTableUp_valve:=FALSE;
END_IF;
///
fbAutoInit_RTRIG(CLK:=bAutoCycleOn);
fbAutoOff_RTRIG(CLK:=bAutoCycleOff);
IF fbAutoInit_RTRIG.Q THEN
xPumpStart:= TRUE;
iState:= 10;
ELSE
xPumpStart:= FALSE;
END_IF;
CASE iState OF
10:
// timer init to let the pump run well
fbStartautotimer(IN:=xPumpStart,PT:=iPumpTimeDelay);
IF fbStartautotimer.Q THEN
fbStartautotimer(IN:=FALSE);
END_IF;
fbCycle_RTRIG(clk:=fbStartautotimer.Q);
IF fbCycle_RTRIG.Q THEN
sCurrentCycleState:= "Pressing cycle start";
END_IF;
IF bLimitTableZero = FALSE THEN
bTableUp_valve:= TRUE;
END_IF;
iState:= 20;
20:
IF iPressure <= iPressure_setpoint AND NOT fbAutoOff_RTRIG.Q AND bLimitBottomTableDown THEN
bTableDown_valve:= TRUE;
sCurrentCycleState:= "Pressing to the pressure setpoint";
xAutoZeroPos:= TRUE;
ELSE
bTableDown_valve:= FALSE;
sCurrentCycleState:= "Cycle stopped, reset";
END_IF;
iState:= 30;
30:
// expression cycle completed, move the table upwards to 0 position
fbZeropos_RTRIG(clk:=xAutoZeroPos);
IF fbZeropos_RTRIG.Q AND NOT bLimitTableZero & fbAutoOff_RTRIG.Q THEN
bTableUp_valve:= TRUE;
iTotalAutoCycles:= iTotalAutoCycles +1;
sCurrentCycleState:= "Zeroing table, cycle end";
END_IF;
END_CASE;
And im totally clueless about what's wrong. I also should point out that i have all that code in one main .st file. Should i divide functions for manual operation and automatic cycle into another .st? Set individual tasks for them?
Any help or tips on this would be very appreciated. Im basically out of ideas and my knowledge on PLC programming is narrow.
Oh of course Mervis shows no errors. I can upload the project if someone is willing to take a look.