AdvancedHMI Software

General Category => Application Showcase => Topic started by: Phrog30 on February 03, 2019, 09:08:33 PM

Title: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on February 03, 2019, 09:08:33 PM
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 (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.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Tazmahal on February 04, 2019, 12:57:57 AM
I've succesfully add it to my project  :D  Man I wish I were as good as you are !

Works perfectly !
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on February 04, 2019, 07:55:28 AM
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: [Select]
If IsNumeric(b + 1 + Binary_Offset) Then
      dr("#") = b + 1 + Binary_Offset
End If

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.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Tazmahal on February 04, 2019, 08:50:26 AM
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  ;)
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on February 04, 2019, 09:49:11 AM
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.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Tazmahal on February 04, 2019, 09:38:46 PM
I've inclued Alarm.txt in my project in folder \Purchased
So the path must be Purchased\Alarm.txt , but always getting Undefined message bit etc..

In the alarm.txt each line is like ; 1,QUAD: ALARME MOTEUR POMPE HYDRAULIQUE ENTRAINEMENT,,-65536,,-16777216,True

 I got over 1000 states

I've also tried to put in the main folder and try .\Alarme.txt , \Alarme.txt , Alarme.txt
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on February 05, 2019, 07:51:17 AM
If you created a folder under AdvancedHMI project called "Purchased", and your file is called "Alarm.txt", the path should be "Purchased\Alarm.txt".  So, sounds like you had the correct path.  Make sure you set copy to output directory to copy if newer or copy always.  See attached photo.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Tazmahal on February 12, 2019, 05:38:05 PM
Thanks Phrog ! Working now  ;)

Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on February 12, 2019, 07:32:21 PM
Thanks Phrog ! Working now  ;)
Glad to hear. See any issues so far? Was that what you were looking for?
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Tazmahal on February 13, 2019, 12:51:30 PM
Exactly what I'm looking for !! And no issues  ;D

Thanks again !
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: oqapsking on May 09, 2019, 02:15:23 PM
HELLO
AND THANK U FOR SHARING

BUT I HAVE A PROBLEM

I EXTRACTED THE FILE
THEN STARTED IT
REBUILD THE PROJECT

BUT GIVES MULTIPLE ERRORS

AS IN THE PHOTOS

Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on May 10, 2019, 08:05:34 AM
HELLO
AND THANK U FOR SHARING

BUT I HAVE A PROBLEM

I EXTRACTED THE FILE
THEN STARTED IT
REBUILD THE PROJECT

BUT GIVES MULTIPLE ERRORS

AS IN THE PHOTOS



You added the reference? It looks like you did. The error is related to the reference in some way. I'm limited on time until Monday.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Godra on May 10, 2019, 01:23:21 PM
That yellow triangle with exclamation mark indicates that something is missing and needs to be resolved first.

It probably relates to incorrect file path or inability to locate the file.

Maybe remove it and then manually browse to it to add it again.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: oqapsking on May 11, 2019, 01:54:48 PM
i didn`t add or remove anything
just extracted the files and rebuild the project

Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Godra on May 11, 2019, 03:13:39 PM
I just did the same and got the same errors since the AHMIClassLibrary.dll file is missing.

You can get it from the other project: https://www.advancedhmi.com/forum/index.php?topic=2079.0

It is inside AdvancedHMI/MyHMI/DLL folder.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on May 11, 2019, 05:52:48 PM
I'm not able to look, but the dll should be part of the project.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on May 13, 2019, 02:21:08 PM
Here's the file, just in case...
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: oqapsking on May 19, 2019, 05:23:56 PM
thanks for your replay and help Phrog30 and Godra

am trying to use your interface mr Phrog30 for my project

but i have few problems i need your help with them


i will send you my file in the messages and i hope you can help me if you can spare some time for me
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on May 19, 2019, 05:44:56 PM
Yep, happy to help. I haven't seen any message yet, but I'll be on the lookout.
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: oqapsking on May 19, 2019, 06:17:41 PM
i just sent it thanks
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: Phrog30 on May 20, 2019, 09:40:45 AM
I have to go on a startup, so I will try and help if time permits...
Title: Re: Multistate with embedded variables - Value, LSB, & Bit Array
Post by: oqapsking on May 20, 2019, 03:11:32 PM
at this time i will continue building my project as it was

after i finish it i will send you a copy and tell you what i need your help with

and thanks in advance