Reuse signal in postgui hal file

More
21 Oct 2023 21:44 #283461 by Guglielmi
Hello,
I would like to show the spindle frequency on my HMI.
The frequency is read through modbus and it's linked already to a signal "actual_speed", I use it to perform some check in ladder..
Well, in postgui, I would like to use the same signal and link it to a HALLabel.
It's possible to reuse the signal defined in the HAL file into postgui HAL?
Should I copy it in a ladder pin?
Thanks
Bye
Andrea

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

More
22 Oct 2023 00:29 #283469 by tommylight

It's possible to reuse the signal defined in the HAL file into postgui HAL?

Probably yes, give it a try, LinuxCNC is pretty good at pointing out errors.

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

More
22 Oct 2023 07:06 #283483 by Guglielmi
Of course I tried a lot before write.. so just reusing the signal doesn't work, in postgui raises an error for signal not existing, I tried also to use a classicladder variable even it's not a nice solution without find a way.
I searched a lot in HAL documentation and on the web looking for a kind of syntax to define signal global.. nothing.
I had the idea to move all related to spindle frequency in the postgui.. maybe in this way it works but I'm also curious to know if it's possible.

So I wrote the post.

Code in the mail HAL:
net speed_in conv-s32-float.0.in <= classicladder.0.s32out-03
net actual_speed conv-s32-float.0.out => spindle.0.speed-in
net actual_speed => near.0.in2 classicladder.0.floatin-00

Code in postgui HAL:
net SpindleFreq classicladder.0.floatin-00 => AG_CncHmi.lblFreq

It doesn't work, error:
hmi_postgui.hal:31: Pin 'classicladder.0.floatin-00' was already linked to signal 'actual_speed'

but again here I'm trying to use floatin-00, I prefer to use actual_speed directly if possible.

Thanks
Andrea
 

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

More
22 Oct 2023 07:48 #283484 by chris@cnc
net actual_speed => near.0.in2 classicladder.0.floatin-00 AG_CncHmi.lblFreq
Does this work?

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

More
22 Oct 2023 07:55 #283485 by Guglielmi
The problem is that  AG_CncHmi.lblFreq is a label of my HMI so it should be handled in postgui,
this line of code is in the main HAL ...

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

More
22 Oct 2023 08:31 #283488 by rodw

The problem is that  AG_CncHmi.lblFreq is a label of my HMI so it should be handled in postgui,
this line of code is in the main HAL ...

That is not a problem. Using a postgui file just changes the order of hal loading. Its still updated in real time, but the gui may not refresh immediately.
Alternatively, use this in your postgui
net actual_speed => AG_CncHmi.lblFreq
The following user(s) said Thank You: Guglielmi

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

More
22 Oct 2023 11:31 #283492 by Guglielmi
Thanks for answer.
the order of call is the correct one if I'm not wrong:
HALFILE = cnc3040.hal

# list of halcmd commands to execute
# commands are executed in the order in which they appear
#HALCMD = save neta

# Single file that is executed after the GUI has started.  Only supported by
# AXIS at this time (only AXIS creates a HAL component of its own)
POSTGUI_HALFILE = hmi_postgui.hal

So the postgui is called after.. the order you mean the order inside the ini, right?

I tried your line of code and it works.. incredible because it was the first I try.. or most probably the mistake is
that I tried with:
net SpindleFreq actual_speed => AG_CncHmi.lblFreq

maybe it is considered differenty.. I got this error:
hmi_postgui.hal:27: Pin 'actual_speed' does not exist

that confused my.. "does not exist" it's not really true. It works just removing SpindleFreq signal.. 
Perfect! Tanks a lot rodw!
The following user(s) said Thank You: rodw

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

Time to create page: 0.074 seconds
Powered by Kunena Forum