Hallabel simple usage

More
26 Jun 2023 18:53 #274275 by Guglielmi
Hi,
I'm creating my own Hmi and I'm quite happy about the result using qt and python. 
I desire to add some information I'm getting through Modbus on a page and the perfect widget I understood is Hallabel.
To be honest I'm not able to find a simple tutorial and I miss something, step by step what I did:

1. add a widget hallabel on the page
2. define the hal pin as "in" or something like this
3. I have my value on %QW10 and in the hal file I connected it to a variable: "net WaterTemp <= %QW10
4. In same hal file, I connected "net WaterTemp => qtpyvcp.myhallabel.in"

Running the hmi, I get an error that  "qtpyvcp.myhallabel.in" doesn't exist.
Disabling the last line in hal (#4) the hmi starts and in hal config I can see WaterTemp with correct value got from modbus, and searching on different elements, I found "AG_CncHmi.in" that is in reality my label!
Trying to set this, like to 102, I can see the value on Hmi... 
So, I tried to exchange the item #4 with "net WaterTemp => AG_CncHmi.in" I get the same issue that it doesn't exist..

I'm confused.
What I have to use?
Should I initialize something in hal file before use the hallabel?

Thanks
Bye
Andrea
 

Please Log in or Create an account to join the conversation.

More
26 Jun 2023 19:26 #274276 by TurBoss
Replied by TurBoss on topic Hallabel simple usage
Hello,

you can try to change the hal label from the halshow tool under tools/halshow

pins -> qtpyvcp -> myhallabel -> in

by goin to the watch tab and click the "in" element of the tree will add it to the list and show some buttons


 

the label has diferent types that need to be the same type returned by %QW10 thats a s32 so need to modify the properties if the hal label in the designer by click on the hal label and press "Ctrl+i" the scroll down and set the pin type to s32

you should also need to fix the text format

 


 
Attachments:
The following user(s) said Thank You: KCJ, Guglielmi

Please Log in or Create an account to join the conversation.

More
26 Jun 2023 19:36 #274277 by KCJ
Replied by KCJ on topic Hallabel simple usage
You need to connect the HAL label signal in your postgui HAL file, since this is loaded after all the GUI objects are created.

If you try connecting in your regular HAL file, the label will not yet have been created, so you will get the qtpyvcp.myhallabel.in does not exist error.

Cheers,
Kurt
The following user(s) said Thank You: TurBoss, Guglielmi

Please Log in or Create an account to join the conversation.

More
26 Jun 2023 21:18 #274283 by Guglielmi
Replied by Guglielmi on topic Hallabel simple usage
Thanks a lot guys!
I followed both suggestions and finally I found how to close the loop.. what was strange to me is, as I wrote, I don't have qtpyvcp element in hal configuration.
I explain deeply what I found so it could be helpful for someone else with same issue.

1) add hallabel in the gui
2) change the name of object as you want, in my example "lblTemp"
3) specify the correct datatype (thanks TurBoss)
 
4) decide if specify or not the pin_name, finally in the hal you should point to the label name if empty, label name.pin_name if specified
5) Create a postgui hal file if not already used (thanks KCJ)
6) IMPORTANT! check in the screen_options object in your gui the "halCompBaseName", if empty, you should use the ui file name
 
I can imagine, by default here there was "qtpyvcp", I don't know.. but in my case, leaving empty it, you should consider the ui name, otherwise you can specify a custom name.
7) finally, in the postgui hal file, add the link: "net WaterTemp => AG_CncHmi.lblTemp" because my ui file is called AG_CncHmi.ui

This is the result! 
 

Thanks a lot
Andrea
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: KCJLcvette
Time to create page: 0.251 seconds
Powered by Kunena Forum