General Category > Application Showcase

Multistate with embedded variables - Value, LSB, & Bit Array

(1/5) > >>

Phrog30:
There have been a few requests for a multistate that works with bit arrays.  Here is a rough draft.  This control can use values, LSB, or bit arrays.  Values will only show one value at a time.  LSB will only show one value at a time... the LSB.  However, bit will cycle through all high bits in the array.  You can still take advantage of embedded variables and the state colors and options.  I didn't work out what to show for word 0 bit 0, maybe I can add a default message?

https://drive.google.com/file/d/1jmsMc-JoSFKvO-EJsQZ71nrA1HYimoFv/view?usp=sharing

It was done while watching the superbowl, so expect a bug or two.  I installed the control in Archies beta v18.  Download, rebuild, and you should be good to go.  I tested with ModbusSim.  I used ini file, which is also included.

Tazmahal:
I've succesfully add it to my project  :D  Man I wish I were as good as you are !

Works perfectly !

Phrog30:
All credit goes to Archie.  All I did was add to his stuff, and it's pretty hacked up.  I don't think I really did it correctly.  It should behave like LSB, but cycle through all bits high.  It does cycle, but I think it's one bit off, on the low side.  Which makes sense because you should be able to set a message for state 0, this would be the state where no bits are high.  So, try making a change, in AdvancedHMI, purchased folder, select ctrlMultistate and hit F7 to open code.  Go to line 403 and 404, change "b + Binary_Offset" to b + 1 + Binary_Offset".  Should look like this...


--- Code: ---If IsNumeric(b + 1 + Binary_Offset) Then
      dr("#") = b + 1 + Binary_Offset
End If

--- End code ---

Let me  know what you think.  Also, I suggest using the ini where possible.  I think it's lighter weight and faster, especially if you have a lot of states.  The easiest method is add a few states in development, then export.  Use this file and edit in excel or something.  You can bang a file out quick. 

If you like the change, I will edit the code and repost.

Tazmahal:
I’ll try that tonight !

For the ini file , I don’t know what i’m doing wrong but it just don’t work.. For now I just load the txt and edit in the designer but if you reload it, you lost your blinking settings. Will give a another look !

Thanks Phrog! and hats down to you Archie  ;)

Phrog30:
If the path isn't correct, the INI will not work.

If you import the INI it will overwrite everything.  If you have under a couple hundred states, doing it in the designer will be fine.

Navigation

[0] Message Index

[#] Next page

Go to full version