Unity M340 Function Block Syntax

Join Date
Feb 2014
Location
BC
Posts
10
I'm relatively new to FB after programming in ladder for year. In Unity, how can I have an output of a block set multiple bits? For instance, the output of an AND block should turn on 3 separate coils.

Thanks
 
insert a move block (CTRL+I) move <enter>

copy paste your move block two times to get three move blocks

connect the output of the AND block to the input pin of all three move blocks

on the output of the move blocks put the tags that you want turned on
 
insert a move block (CTRL+I) move <enter>

copy paste your move block two times to get three move blocks

connect the output of the AND block to the input pin of all three move blocks

on the output of the move blocks put the tags that you want turned on

That's what I was going to do, but was thinking there was a more elegant way. Thanks.
 
you can use move block as Von_hydro suggested.
Also you can make own FBD (function block)

inside block do same with move block or set /reset blocks. Connect to output of FBD block and you have block with one input and 3 outputs.

Also you can use array block commands, but then you need to use consistently bits for this and animation don't show values if you look FBD editor.
 
While we are at it, what the best FB to use to reset a bit based on a condition? I can only find RESET which has no input parameters. Weird that they wouldnt have one since they have a SET block.
 
Use RS or SR blocks if you want a latched bit. But be careful if you expect the latch state to be maintained in Plc memory through power cycles etc.

You can also use move blocks with the enable input but this is less elegant than using a latch block

I try and use latches sparingly as it creates more state in the Plc program, wherever possible any tag that is written is continuously written as a product of the inputs.

It is also more elegant for a tag to only be written in one place so I prefer latch blocks to multiple move blocks
 
Use RS or SR blocks if you want a latched bit. But be careful if you expect the latch state to be maintained in Plc memory through power cycles etc.

You can also use move blocks with the enable input but this is less elegant than using a latch block

I try and use latches sparingly as it creates more state in the Plc program, wherever possible any tag that is written is continuously written as a product of the inputs.

It is also more elegant for a tag to only be written in one place so I prefer latch blocks to multiple move blocks

Not trying to do any latching logic. I have a bit that is toggles remotely via an HMI. I want to reset that bit to 0 if a condition is true. What block would let me do that? In ladder I would use the RESET coil, but can't find such think in FB...only an SR combo block.
 
What I ended up doing is writing a quick script in the HMI to reset the bit based on the condition of another. I think this makes most sense since the bit control is through the HMI anyhow.
 
While we are at it, what the best FB to use to reset a bit based on a condition? I can only find RESET which has no input parameters. Weird that they wouldnt have one since they have a SET block.

What I ended up doing is writing a quick script in the HMI to reset the bit based on the condition of another. I think this makes most sense since the bit control is through the HMI anyhow.


You can use reset block and from proprties select show EN-pin.

What if script gets stuck. Bit is not reset anymore. Reseting on PLC, which is setted on HMI is bulletproof for communication losts etc.
If you need to look bit status also on animation view, you can use ton block and reseting bit after 0,5-1s when it goes to "1" status
 

Similar Topics

Hello. New to Unity and had a couple quick questions. Can a Modicon M340 output to a small multiline LCD screen and not a full HMI?
Replies
4
Views
940
Hello. I'm trying to set up an M340 with a BMX AMO 0410 and a BMX AMI 0410 in Unity Pro XL 13.1. While trying to set up the IODDT for the card...
Replies
8
Views
4,102
Greetings, I'm new at PLC programming, but good a logic - so I thought. I've inherited a PLC system, which is presently operating in the field...
Replies
6
Views
2,449
If I am disconnected from M340, I cant see the Values. Unlike RSLogix when one gets to choose upload state values upon exit, and these state...
Replies
4
Views
2,224
I am trying to create a DFB that moves 16bits to Word, Word to INT, INT to Array of EBOOL. Basically a discrete output map. For the last function...
Replies
5
Views
2,399
Back
Top Bottom