HAL net command question

More
03 Jul 2011 17:53 #11105 by kostas
I made some experiments for a custom component that I make and saw that when I create a new signal and connect a pin to it, the signal defaults to a value of 0.
I thought that the signal would take the pin's value.

Is this correct or am I missing something?

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

More
03 Jul 2011 18:42 #11107 by andypugh
The signal will only take the value of the pin if the pin is an output. And, also, if the component is running (ie, attached to a thread, with the thread started)

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

More
03 Jul 2011 18:51 #11108 by kostas
Replied by kostas on topic Re:HAL net command question
Both signals I connect are IO. I guess taking the value of the pin doesn't apply to this type?

What I try to do is make a component that will change a pin based on it's previous value and adding a value from some other component pin, which will change.
My purpose is to be able to change the pid values with the help of some external rotary encoders. I want to be able every time to start with the predefined pid values though and not from zero.

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

More
03 Jul 2011 20:05 #11113 by andypugh
Create a parameter called (for example) "init-value" then you can use setp in the HAL file to give it a starting value.

From then on the code can use that as a variable, as the setp command is only run once when the hal file is loaded.

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

More
03 Jul 2011 20:10 #11115 by kostas
Replied by kostas on topic Re:HAL net command question
Yep! That's what I did already. I think I managed to get it working now. It would be much easier and simple if the values were loaded from the pin though.

Doing some initial tests now. I'm in a good path already.

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

More
03 Jul 2011 23:07 #11116 by andypugh
kostas wrote:

It would be much easier and simple if the values were loaded from the pin though.

If you think it through carefully, I think you would find that that could lead to inconsistency. How do you decide which value to use?

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

More
04 Jul 2011 05:48 #11120 by kostas
Replied by kostas on topic Re:HAL net command question
Yes, I know. I would take the value of the first pin connected on the net, but this would probably lead to some other problems.

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

Time to create page: 0.157 seconds
Powered by Kunena Forum