Jump to content
frk

long integer (32bits) and LCD

Recommended Posts

Dear All,

has anybody experience how to get the result of 32bits operation in the LCD? This help I have found but thedecsription of the store operation as a possibility how to get the long data on display of the Jazz I did not understand.

see the attached help. I will do some experiments but if anybody has solved this problem please give me advice...

post-8346-064775200 1334353477_thumb.png

post-8346-055044700 1334353609_thumb.png

Share this post


Link to post
Share on other sites

I have asked this question a long time ago and the answer was that you can not put 32 bit values on the LCD. The Jazz only allows math manipulation in the ladder by use of the SB long integer bit, but it does not allow you toput the two integers it stores into intelligently on a screen.

Sorry

Keith

Share this post


Link to post
Share on other sites

You can break the 32 bit value down to two intelligible 16 bit values by doing a long divide of the 32 by 10,000. The high four digits will be in the low word of the result, and the low four digits will be in SI 4 (divide remainder). In the next network move these to values to two buffer registers and then display theses buffer values right next to each other with leading zeros enabled on the low value.

I don't have a Jazz here to test this. Try it out and let us know if it works.

Joe T.

Share this post


Link to post
Share on other sites

I'm surprised why this topic seems so complicated - even for Joe Touser!

There is standard solution: one needs to RESETSB82 and then to store "Long" register (as bitmap) to another "Long" register (two sequental MI). The result will be in decimal format, where the first 4 low significant numbers will be stored in the first MI and the rest - in the second.

Please take a look in the standard example (U90Ladder > Help menu > Sample U90 Projects... > Basic Ladder operation > Long Integer... There this way is shown - both in Ladder and in HMI.

If something still reminds unclear, please let me know and I'll write a special demo for you!

Share this post


Link to post
Share on other sites

Now it is clear. The point was that it is not just separating bitmap to bitmap but it is convertor bitmap to decimal (BCD convertor) so u get in every nibble of the MI a decimal number. I used this method many times in embedded uP in the past for LED displays...

As simple as possible :-) Just was not clear in the help file - let say different programmers terminology. (I understood after you use the sentence "The result will be in decimal format...")

Thank you very much all of you.

I'm surprised why this topic seems so complicated - even for Joe Touser!

There is standard solution: one needs to RESETSB82 and then to store "Long" register (as bitmap) to another "Long" register (two sequental MI). The result will be in decimal format, where the first 4 low significant numbers will be stored in the first MI and the rest - in the second.

Please take a look in the standard example (U90Ladder > Help menu > Sample U90 Projects... > Basic Ladder operation > Long Integer... There this way is shown - both in Ladder and in HMI.

If something still reminds unclear, please let me know and I'll write a special demo for you!

Share this post


Link to post
Share on other sites
I'm surprised why this topic seems so complicated - even for Joe Touser!

There is standard solution: one needs to RESETSB82 and then to store "Long" register (as bitmap) to another "Long" register (two sequental MI).

You guys and your system bits! I've said it before and I'll say it again- we need "system operators" webinars on both Visilogic and U90 help unlock more of the Unitronics magic.

I still think my way is cool.

Joe T.

Share this post


Link to post
Share on other sites

May be I am rather punctual but the set SB82 and reset SB82 in One NET is correct? You have this as a example so I suppose that it works. But I am talking about it generally because some oposite operations are not allowed in one net....And I have already a problem in another program with the setting and reseting bits in one net and then I read in your help that it is not good idea to do it this way...

Share this post


Link to post
Share on other sites

I have programmed it and tested so my program work and display 32 bits on LCD well. I have tried go over the 32767 nad other limit conditions. Just consider if there is any limit conditions that are not fullfilled regarding the process in one net and that it is all.

May be I am rather punctual but the set SB82 and reset SB82 in One NET is correct? You have this as a example so I suppose that it works. But I am talking about it generally because some oposite operations are not allowed in one net....And I have already a problem in another program with the setting and reseting bits in one net and then I read in your help that it is not good idea to do it this way...

Share this post


Link to post
Share on other sites

Please don't thhink about SET and REST of SB82 as ordinary bit operations. In fact, this is the "switch" to activate the function as "Long" after the bit. That's why, in this specific case, SET and RESET of the same bit (SB82) is fully legal. Even more - in some case you can make twice SET of SB82 in the same net - without RESET at all. It looks quite not logical, but - again - SET and RESET of SB82 in fact is a way to give the controller command to execute the function. In any case SB82 remains at "0".

I agree this way of handle special functions is not the most intuitive! But the way U90Ladder is written (the first fully Windows based PLC programming software in the world!!!) doesn't let adding more ladder modules, like in VisiLogic.

When you convert bitmap to decimal format, the LSB first 4 digits are going to the first MI (range up to 9999) and the second part - MSB to the second MI. There the value is up to 32767. This means, that the bigest number you can get in display with this function is 327,679,999. Please note - this number is sensitivelly lower than the max number the controller can hold as bitmap (+/- 2^31).

Share this post


Link to post
Share on other sites

Greeatings ,

 

I have one problem with u90 leader , I need to mul two number and result is bigger than 32k.

After mul this number i need to div , and that is problem i cant get right result.

Expmple :
MI0 = 1000
MI2= 53 


MI4=53000 that is ok ,
How can i divide MI4 now whit some number example 100 ???


Can someone help me ?

Share this post


Link to post
Share on other sites

I don't understand. You say you know how to multiply but don't know how to divide???

Or is it you're just getting the wrong result? If you're getting the wrong result it's because you cannot store 53000 in a 16-bit signed integer format. Try doing the divide before the multiply. If that's not possible, read the Help entry under "32-bit long values".

Share this post


Link to post
Share on other sites

Hi;

In Help -Samples -  Basic Ladder functions, there is a Sample program for using LONG INTS

                                                   Shows  Multiply, Divide and how to display.

 

   In Help,  Search     >   Long

 

DanT

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...