Setting a signal to a constant value
26 Jun 2019 09:22 #137874
by JetForMe
Setting a signal to a constant value was created by JetForMe
I don't have a pressure sensor yet in my system, but I wanted to fake it by setting a signal `pressure-ok` to TRUE. I can do that with newsig and setp, but as soon as I connect that signal to a lut5 input pin, it gets set to false again.
This works:
newsig pressure-ok bit
sets pressure-ok TRUE
If I then add this line to my HAL file:
net pressure-ok => lut5.0.in-2
Then the value of the signal is FALSE (as shown by HAL Configuration in Axis).
Is there a way to get a constant TRUE output pin of bit type?
This works:
newsig pressure-ok bit
sets pressure-ok TRUE
If I then add this line to my HAL file:
net pressure-ok => lut5.0.in-2
Then the value of the signal is FALSE (as shown by HAL Configuration in Axis).
Is there a way to get a constant TRUE output pin of bit type?
Please Log in or Create an account to join the conversation.
26 Jun 2019 11:06 #137883
by pl7i92
Replied by pl7i92 on topic Setting a signal to a constant value
this is redundant
so just setp
setp lut5.0.in-2 1
you can set pins from wherever you want in Mcode
ocodes
python .....
so just setp
setp lut5.0.in-2 1
you can set pins from wherever you want in Mcode
ocodes
python .....
Please Log in or Create an account to join the conversation.
26 Jun 2019 17:14 #137912
by andypugh
Replied by andypugh on topic Setting a signal to a constant value
Try doing the "sets" after the "net"
Please Log in or Create an account to join the conversation.
26 Jun 2019 17:29 #137915
by pl7i92
Replied by pl7i92 on topic Setting a signal to a constant value
that worked on my testsetup
is there a documentation on the behavior of lut5 backporting to signals
or a general Rule on setting pins and signals fix at the end of the HAL or on the last Hal loaded
so a preset.hal woudt be good to set things at the end
is there a documentation on the behavior of lut5 backporting to signals
or a general Rule on setting pins and signals fix at the end of the HAL or on the last Hal loaded
so a preset.hal woudt be good to set things at the end
Please Log in or Create an account to join the conversation.
26 Jun 2019 21:37 - 26 Jun 2019 22:03 #137930
by JetForMe
The problem is not setting an input pin of the lut5 to a constant value. The problem is I want to set a net to a constant value so that later I can set it to an input pin, and have it used throughout my HAL.
I should be able to write
Replied by JetForMe on topic Setting a signal to a constant value
this is redundant
so just setp
setp lut5.0.in-2 1
you can set pins from wherever you want in Mcode
ocodes
python .....
The problem is not setting an input pin of the lut5 to a constant value. The problem is I want to set a net to a constant value so that later I can set it to an input pin, and have it used throughout my HAL.
I should be able to write
net pressure-ok <= TRUE
...
net pressure-ok => lut5.0.in-2
...
net pressure-ok => lut5.1.in-4
...
net pressure-ok => lut5.2.in-3
Last edit: 26 Jun 2019 22:03 by JetForMe.
Please Log in or Create an account to join the conversation.
27 Jun 2019 00:37 #137942
by rodw
Replied by rodw on topic Setting a signal to a constant value
I think it needs to be more like this.
comment some lines out maybe?
setp lut5.0.in-2 TRUE
comment some lines out maybe?
Please Log in or Create an account to join the conversation.
27 Jun 2019 00:38 #137943
by rodw
Replied by rodw on topic Setting a signal to a constant value
Actually try using sets (set signal). Not sure if it will work
Please Log in or Create an account to join the conversation.
27 Jun 2019 00:53 #137945
by lorenzn
Replied by lorenzn on topic Setting a signal to a constant value
andypugh is correct of course. The "sets" must come after "net" if this is a newly created signal. For my own understanding I did some testing:
In the next test, the signal is not reset to FALSE.
$ halrun -I testdelayname.hal
Note: Using POSIX realtime
halcmd: gets mynet
<stdin>:1: signal 'mynet' not found
halcmd: newsig mynet bit
halcmd: sets mynet 1
halcmd: gets mynet
TRUE
halcmd: net mynet mydelay.in
halcmd: gets mynet
FALSE
In the next test, the signal is not reset to FALSE.
$ halrun -I testdelayname.hal
Note: Using POSIX realtime
halcmd: net mynet mydelay.in
halcmd: sets mynet 1
halcmd: gets mynet
TRUE
halcmd: net mynet anotherdelay.in
halcmd: gets mynet
TRUE
Please Log in or Create an account to join the conversation.
27 Jun 2019 01:04 #137946
by JetForMe
Replied by JetForMe on topic Setting a signal to a constant value
Do I have to do `sets` after all the possible `net` expressions I might have (if this is an input to several different components)? If not, then I'd argue the first `net` is doing something that `newsig` should do.
Please Log in or Create an account to join the conversation.
27 Jun 2019 01:08 #137947
by lorenzn
Replied by lorenzn on topic Setting a signal to a constant value
I'm still a new user, but no it does not appear that you have to do the "sets" after all the possible "net" expressions. The unconnected signal appears to be reset but if the signal already exists it was not reset by the second "net" expression.
The following user(s) said Thank You: JetForMe
Please Log in or Create an account to join the conversation.
Time to create page: 0.090 seconds