is it possible to switch outputs using Numeric Data from hmi

mills8088

Member
Join Date
Feb 2024
Location
lincolnshire
Posts
1
Hi all so i have a robot project im working on were i need to set the layers. using the hmi screen i would like to use the numeric data display to select how many layers and use different outputs with the numbers what are selected on screen if possible

using sysmac studio 1.45
plc nx1p2-9b40dt1
 
Put each layer in a subroutine and call that subroutine when the value of the HMI number is correct for it.


Subroutines not called will have no effect on the IO or any internal bits or values
EDIT: Since some subroutie may be identical just calling different IO it could be possible to set a certain bit ir value and call one subroutine that depending on which bit or value triggers different outputs.
 
I agree with I_Automation. just to clarify you could write a routine for each HMI value using the real I/O as if not called then the outputs have no effect in that routine, alternatively use internal bits in the routines then OR them to the relevant outputs in a cyclic scan block that way when monitoring that block you can see which bit is driving the outputs.
 
As a counterpoint, not a fan of writing subroutines for specific variations of a pattern. The problem with that methodology is it requires a programmer to add a variation in the future. I just rewrote a large PLC5 program like this with 48 subroutines to cover each recipe.

I've done robotic palletizing with different patterns and layer counts using definition tables to define what action is done or in this case what output is fired. Then, new definitions can be defined without the need for programming new routines.

If you do go the conditional subroutine route, care must be taken on when the routine is no longer called. All outputs, memory or IO will retain their values even if not called.
 
If you do go the conditional subroutine route, care must be taken on when the routine is no longer called. All outputs, memory or IO will retain their values even if not called.

I always program in a last scan of a subroutine and ote a Skip_Bit for it.

That last scan turns off all outputs and memory bits used, sets values to 0, resets timers on use, etc.

When the condition ends that calls the subroutine I set a last scan but and run through it when that last time.
 
My project which is a model railroad layout uses conditional subroutines for different train operations, selected from the HMI. Each subroutine does have to manipulate several outputs for the track power. What I did was one subroutine which is unconditional will use an integer value to energize an output. If the integer is zero, the output is off, non-zero, output is on.



This keeps all the outputs in one place and I can determine where it was energized from. Example, if Ladder 22, rung 15 wants to energize an output, I put 2215 in the integer. So as I am debugging, I know where the output was turned on from.



Mike
 
My project which is a model railroad layout uses conditional subroutines for different train operations, selected from the HMI. Each subroutine does have to manipulate several outputs for the track power. What I did was one subroutine which is unconditional will use an integer value to energize an output. If the integer is zero, the output is off, non-zero, output is on.



This keeps all the outputs in one place and I can determine where it was energized from. Example, if Ladder 22, rung 15 wants to energize an output, I put 2215 in the integer. So as I am debugging, I know where the output was turned on from.



Mike

Pretty cool....I have a ton of HO stuff from the 70's and always thought about doing a PLC controlled layout. Most modern layouts are DCC controlled and I didn't want to reinvest in all new hardware. Would love to see a pic of your setup.
 
Only scanned through some of the posts so not sure if it is mentioned but why not use a group of values for example:
0 - 190 Format 1
200 - 390 Format 2
400 - 590 format 3
& so on
i.e. each set of integer values runs a particular routine
do it in steps of 10 that leaves plenty for any modifications to the steps for each program
for example:
If program 1 is selected on the HMI then load 10 (first step in format 1) into a sequence variable so any value of 10 to 190 will run format 1.
It's simple & allows extra steps to be incorporated for each program.
There are many ways to implement this i.e. do a compare for example of a value > 0 & < 199 & call a function block or routine what ever you want to call them, each routine will step through say 10 at a time & use the sequence variable to enable the outputs. You can also use this variable to display messages on the screen i,e, 0 = IDLE, 10 run motor 1, 20 open valve 3 & so on all you need is a text list tied to the sequence variable.
The code for the outputs is simple just use compares of the sequence variable


i.e.
[SEq. > 0 < 30]

OR
[SEQ. > 30 < 100]
OR
[SEQ. >220 < 300] out motor 1


The call to the routines could be true i.e. always scanning but use limits of the SEQ. variable to enable the transitions but as I think is mentioned if only calling routines during a process then it may be required to reset the controlling bits perhaps at start of main routine as disabling a call may cause control bits to stay true.
 
Put each layer in a subroutine and call that subroutine when the value of the HMI number is correct for it.


Subroutines not called will have no effect on the IO or any internal bits or values
EDIT: Since some subroutie may be identical just calling different IO it could be possible to set a certain bit ir value and call one subroutine that depending on which bit or value triggers different outputs.

To NOT generate compile warnings and generally avoid debugging headache, a simple state/step machine could be used in lieu of this with the HMI layer setpoint.
 

Similar Topics

Hi guys, I'm building a architecture on IAB and, in this project, we use Belden Switchs. My problem is I want to create a user device who will...
Replies
4
Views
2,179
Hello all , i just bought a plc 5 ,and changing the key lock switch does not put the processor in either run or program mode. I can only do this...
Replies
6
Views
3,165
Hello All, I need the ability to remotely reboot a Red Lion CR3000 HMI. Due to some graphics issues when the database is updated the HMI must be...
Replies
4
Views
221
Hello The plant is running and there is no shutdown nowadays therefore I can add 1734- AENTR and its card while PLC is in Run? I do not wanna...
Replies
8
Views
348
Folks, I have a client with an old ABB Advant / MOD300 system (v14.4). Around y2k I installed the ABB Industrial IT MOD300 OPC Server 1.1/2...
Replies
1
Views
179
Back
Top Bottom