# Logic gates for MB

## Recommended Posts

Hi guys,

I tried to do a logic for some MBs such us:

If MB01=1 AND MB02=1 then

MB03=1

Else

MB03=0

End If

I've found the AND, OR and XOR gates in the Logic menu, but looks like these gates don't accepts as input the MBs (just MI, XI, ML, etc).

There is a reason for not accepting MBs as inputs?

There is any option to have these gates for MBs?

Cheers for help,

Marius

##### Share on other sites

Hello Marius,

The AND/OR/XOR logic functions evaluates the state of two integers.

This gates can not be use with MB directly.

You can convert a two vectors of MBs to MIs then use the gates between this two MIs.

VIsiLoigc uses Ladder diagram to program the PLC

In ladder diagram you can do what you wish with two dirrect contacts and a direct coil as fallow.

---[MB1]----[MB2]------(MB3)

regards.

##### Share on other sites

Hello Marius,

The AND/OR/XOR logic functions evaluates the state of two integers.

This gates can not be use with MB directly.

You can convert a two vectors of MBs to MIs then use the gates between this two MIs.

VIsiLoigc uses Ladder diagram to program the PLC

In ladder diagram you can do what you wish with two dirrect contacts and a direct coil as fallow.

---[MB1]----[MB2]------(MB3)

regards.

Hi EduMarg,

I tried to find in the manual how to convert the vectors of the MB to MI.

It is something as

MB1=1 -> MI1=00000001

or

MB2=0 -> MI2=00000000

?

Could be a silly question, but I am not sure about Visilogic philosophy ...

Cheers,

Marius

##### Share on other sites

Marius.

The memory on Vision PLC is a diferrent from other PLCs

in Vision MB1=0 is not the same as M1=00000001.

There is not direct relation between MBs and MIs as opose for example with siemens where MB0=1 is equal to MI0.0=1 or MI0=00000001.

This means you can use in VisiLogic MB0 with out interfering on the value of MI0.

To convert from MB to MI you need a function block called bit to num.

Is there any specific reason why you whant to use the and/or/xor FB instead of ladder logic?

regards.

• 1
##### Share on other sites

I think the confusion is that an and/or function block is designed to work with MI type data sets.

When working with MB, you don't need to use the function block, you use the design of your ladder diagram to make your AND/OR on MBs.

It sounds like you don't have a good understanding of relay ladder logic (RLL), which is where you should start first.

If MB01=1 AND MB02=1 then

MB03=1

Else

MB03=0

End If

[MB1]----[MB2]-----(MB3)

In this case, when MB1 and MB2 are both active (AND), MB3 is turned on.  This ladder is identical to your IF/Then/Else statement in terms of functionality.

If you wanted an OR function it looks like this:

[MB1]----|-----(MB3)
[MB2]----|

If MB1, or MB2 is on, the circuit to MB3 completes.  This is the same as:

IF MB1 OR MB2
THEN MB3=1
ELSE
MB3 = 0
ENDIF

There's a lot of "Gotcha" situations you need to keep in mind when working with RLL.

##### Share on other sites

Hi Cantcliff,

You are right, I am not too familiar with RLL as I am used more with the structured text programming than the ladder diagram. My confusion it was that in other PLCs I have seen function blocks already built for OR/AND/XOR gates, including for MBs as compared with Visilogic where the function block is just for MIs (and similar data types).

Cheers,

Marius

## Create an account

Register a new account

×