Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
84522members
353757posts

UDINT bits

Machine Automation Forum

A forum addressing machine automation solutions for the complete machine lifecycle. Including offers like Machine Advisor, Modicon PLC/PacDrive, Lexium or Preventa. Discuss and share knowledge on offers relating to cloud-based service platforms, machine localization and monitoring, industrial operations control, motion products as well as safety function!

Solved
otrotabi
Lieutenant
Lieutenant
0 Likes
8
510

UDINT bits

I need to access the bits of a Udint variable. Particularly I need to know when a compressor is working during it´s minimum on time delay. This is signaled by bit 28 of the CompCntrl_OnOff FB.

 

status.png

 

So, how can I access that ? I know how to use WordtoBit funcion block, but there does not seem to be a similar one for UDINT format.

 

Is there an easy way for this ?

 

 


Accepted Solutions
Bastian_Schmitz
Commander Commander
Commander
0 Likes
7
493

Re: UDINT bits

Hi,

The possible solution depends on the used target.

IF you use TM172 you can read out a single bit via the syntax var.numberofbit.

In your case var.28.

This solution is not supported of the firmware of TM171O or TM171P.

 

You could also use  AND with the word with the constant 2#10000000000000000000000000000 or 536870912 or 16#2000000.

That is more or less the say way how the wordtobit function work.

 

You can find these as example here

 

And at least there is also an additional library for your purpose. You can find these here

In the Basic addon library is a function to convert a dword to bit. 

Between dword and udint is not a real difference. 

BYTE,WORD,DWORD will be shown as hexadecimal value USINT,UINT,UDINT as decimal value.

 

best regards

 

See Answer In Context

Tags (3)
8 Replies 8
Bastian_Schmitz
Commander Commander
Commander
0 Likes
7
494

Re: UDINT bits

Hi,

The possible solution depends on the used target.

IF you use TM172 you can read out a single bit via the syntax var.numberofbit.

In your case var.28.

This solution is not supported of the firmware of TM171O or TM171P.

 

You could also use  AND with the word with the constant 2#10000000000000000000000000000 or 536870912 or 16#2000000.

That is more or less the say way how the wordtobit function work.

 

You can find these as example here

 

And at least there is also an additional library for your purpose. You can find these here

In the Basic addon library is a function to convert a dword to bit. 

Between dword and udint is not a real difference. 

BYTE,WORD,DWORD will be shown as hexadecimal value USINT,UINT,UDINT as decimal value.

 

best regards

 

Tags (3)
otrotabi
Lieutenant
Lieutenant
0 Likes
6
476

Re: UDINT bits

Thanks for the very detailed answer. I gather that if I want to share the same code for TM172 and TM171 it is better to use a function rather than use the bit access like in "Var.bit" format.

 

I had tried this before but I do not remember whether the development platform was a TM171 or I was expecting the IDE to show me the bits like it does when you write "." in a function ... 

 

One further question, although I think I know the answer: having a library available to the project´s library tree does not impose any further PLC memory overhead, right ? I mean, you only include and use those functions or FB that are used within a project´s program actually included in a task list, right ?

 

libraries.png

 

 

Tags (1)
Bastian_Schmitz
Commander Commander
Commander
0 Likes
5
472

Re: UDINT bits

Only in the Project used FBs FCs use space. You can add so many Libararys you want. But if I can give you a tip please remove the Pumping library. These is in 99% not used and need 2MB in the project file. The last 10 versions of the project are saved in the project folder. If you remove the pumping library you can save a lot of space. That could be usefull if you want send the project per E-Mail.

Tags (1)
otrotabi
Lieutenant
Lieutenant
0 Likes
4
464

Re: UDINT bits

Ok. Thanks for the tip.

 

So, If I add a library, the library is stored in the project (it is not a link to where the library manager points to) and this is how it can warn you about the library being updated on the library location, when you first open the project.

 

I agree, I did check the pumping library and seems to be quite sofisticaded for a standard project. I had to develop my own function block for the pump, including a flow sensor input which we always use in our chillers. 

 

As a side note (if you want to dig into it), the .plcprj  shrinked by about 500 kbytes after removing this library and though not present in the library manager, it is still present in the HMIRemote folder.

 

One last question: I think of FB as "classes" but the inheritance concept seems to be missing. So you need to be very carefull about how you define inputs and outputs, right ? If you want to modify a previously defined function included on a library by adding more inputs or outputs, what is your strategy ? Name it differently ?

 

 

 

Tags (1)
FedericoM
Lieutenant Lieutenant
Lieutenant
0 Likes
3
430

Re: UDINT bits

Hi,

 

if you add input/output to a FB and you want to maintain back compability with previous versions, you have to add them in the last position (in FBD language it will appear on the bottom).

Moreover, your updated FB with an additional input should work like the previous one when the new input is disconnected, i.e. the default value of the new input has to be selected in order to obtain this behavior.

If you do this, you can update your project with the new library containing this FB and you don't have to update the programs using it, unless you want to really set the additional input.

Tags (1)
otrotabi
Lieutenant
Lieutenant
0 Likes
2
422

Re: UDINT bits

I see.  Great tip.

 

Thanks

Tags (1)
Bastian_Schmitz
Commander Commander
Commander
0 Likes
1
371

Re: UDINT bits

As example you can look on the press2temp FB. These get additional inputs in the past. If you use them in an older project you will have only the inputs which are still shown in the online help. If you renew the block with the exisiting instance you will see the additional inputs. But it will work proper in both cases.

Tags (1)
otrotabi
Lieutenant
Lieutenant
0 Likes
0
350

Re: UDINT bits

Thanks Bastian for your comments.

 

One further thing about libraries. According to  2014 Programming guide:

 

3.8.2.1 UNDOING EXPORT TO A LIBRARY
So far, it is not possible to undo export to a library. The only possibility to remove an ob-
ject is to create another library containing all the objects of the current one, except the
one you wish to delete.

 

And this is the what happens if you right click on a function block and Export to Library:

 

library management.jpg

 

So, is there anything new about library housekeeping ? Is it possible to update a function block (I mean, replace it with a newer version withouth changing the rest of the FBs). Moreover, how does library directory structure work, is it possible with tools available to non-Schneider people ? 

 

library structure.jpg

 

 

Tags (1)