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!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-14 11:51 AM
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.
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 ?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-14 10:48 PM
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
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-14 10:48 PM
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
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-15 07:34 AM
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 ?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-15 07:46 AM
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.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-15 08:49 AM
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 ?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-17 09:07 AM
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.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-19 10:49 PM
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.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-06-20 12:35 PM
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:
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 ?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-02-28 04:52 AM
@Bastian_Schmitz wrote:
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
Can you update the link for the additional libraries, I'm not sure where to find them. Current link is broken.
Thanks,
Josh
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-03-03 04:00 AM
Hello Josh,
It´s been a while, so I am not sure. But I think this one is the file Bastian shared.
Regards
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.