pncconf with 5i25 and 7i77 and I need analog outs

More
16 Feb 2016 20:13 #70248 by djs14
I've created a button and LED that shows up on axis using a separate xml file.

Shouldn't the code below link the LED to the button or what am I missing about the functionality of halpins.

In separate hal file:

# This file will not be overwritten when you run PNCconf again
net spindle-rpm-filtered => pyvcp.spindle-speed
# This doesn't seem to be having any effect
net pyvcp.ok-led => pyvcp.ok-button

And I have named the components in my XML file and they're showing up ... thoughts?

Let me know if I should be asking this in a different part of the forum.

Thank you all

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

More
16 Feb 2016 20:36 #70249 by djs14

I've created a button and LED that shows up on axis using a separate xml file.

Shouldn't the code below link the LED to the button or what am I missing about the functionality of halpins.

In separate hal file:

# This file will not be overwritten when you run PNCconf again
net spindle-rpm-filtered => pyvcp.spindle-speed
# This doesn't seem to be having any effect
net pyvcp.ok-led => pyvcp.ok-button

And I have named the components in my XML file and they're showing up ... thoughts?

Let me know if I should be asking this in a different part of the forum.

Thank you all


Maybe have to create a small ladder to do this? I'm still in the experiment mode starting to understand how everything meshes together... Thank you all for the input.

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

More
16 Feb 2016 21:04 #70252 by Todd Zuercher
I'm guessing that "pyvcp.ok-button" is the name of the output from your pyvcp button you've created?
And are you wanting that to turn on your LED you made?
Is the pin pyvcp.ok-led the input pin for the pyvcp LED?
If you connect both the input pin and the output pin to the same signal the LED will turn on when the button is pressed and turn off when you release the button.
Signal names are arbitrary, you make them up as you use them and are the first thing listed in a HAL "net" command.

In your 2 lines of HAL code you posted the first one has the signal name "spindle-rpm-filtered" connected to the pin "pyvcp.spindle-speed"
So you could put this in your hal file.
net ok-signal <= pyvcp.ok-button => pyvcp.ok-led
I created a new signal named "ok-signal" connected to your two pyvcp pins.
Each signal can only read data from one output connected to it, but can be connected and send to multiple inputs.
Signal names can be used multiple places in the same and different hal files to connect more pins to the same signal.
so
net ok-signal <= pyvcp.ok-button
net ok-signal => pyvcp.ok-led
does exactly the same thing as "net ok-signal <= pyvcp.ok-button => pyvcp.ok-led"
The arrows are meaningless, and can be put in by you the programmer to help you try to keep things straight. If you put the arrows in backwards or omit them entirely it makes no difference other than to make your code more confusing to look at.
The following user(s) said Thank You: djs14

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

More
16 Feb 2016 21:30 #70254 by djs14

I'm guessing that "pyvcp.ok-button" is the name of the output from your pyvcp button you've created?
And are you wanting that to turn on your LED you made?
Is the pin pyvcp.ok-led the input pin for the pyvcp LED?
If you connect both the input pin and the output pin to the same signal the LED will turn on when the button is pressed and turn off when you release the button.
Signal names are arbitrary, you make them up as you use them and are the first thing listed in a HAL "net" command.

In your 2 lines of HAL code you posted the first one has the signal name "spindle-rpm-filtered" connected to the pin "pyvcp.spindle-speed"
So you could put this in your hal file.
net ok-signal <= pyvcp.ok-button => pyvcp.ok-led
I created a new signal named "ok-signal" connected to your two pyvcp pins.
Each signal can only read data from one output connected to it, but can be connected and send to multiple inputs.
Signal names can be used multiple places in the same and different hal files to connect more pins to the same signal.
so
net ok-signal <= pyvcp.ok-button
net ok-signal => pyvcp.ok-led
does exactly the same thing as "net ok-signal <= pyvcp.ok-button => pyvcp.ok-led"
The arrows are meaningless, and can be put in by you the programmer to help you try to keep things straight. If you put the arrows in backwards or omit them entirely it makes no difference other than to make your code more confusing to look at.



Thank you for the explanation.... still doesn't seem to be working with your changes. I've attached my files ... what did I do wrong ...

File Attachment:

File Name: panel.xml
File Size:0 KB


File Attachment:

File Name: spindle_to_pyvcp.hal
File Size:0 KB


File Attachment:

File Name: MiyanoLatheTwo.ini
File Size:3 KB
Attachments:

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

More
16 Feb 2016 21:39 #70255 by djs14

I'm guessing that "pyvcp.ok-button" is the name of the output from your pyvcp button you've created?
And are you wanting that to turn on your LED you made?
Is the pin pyvcp.ok-led the input pin for the pyvcp LED?
If you connect both the input pin and the output pin to the same signal the LED will turn on when the button is pressed and turn off when you release the button.
Signal names are arbitrary, you make them up as you use them and are the first thing listed in a HAL "net" command.

In your 2 lines of HAL code you posted the first one has the signal name "spindle-rpm-filtered" connected to the pin "pyvcp.spindle-speed"
So you could put this in your hal file.
net ok-signal <= pyvcp.ok-button => pyvcp.ok-led
I created a new signal named "ok-signal" connected to your two pyvcp pins.
Each signal can only read data from one output connected to it, but can be connected and send to multiple inputs.
Signal names can be used multiple places in the same and different hal files to connect more pins to the same signal.
so
net ok-signal <= pyvcp.ok-button
net ok-signal => pyvcp.ok-led
does exactly the same thing as "net ok-signal <= pyvcp.ok-button => pyvcp.ok-led"
The arrows are meaningless, and can be put in by you the programmer to help you try to keep things straight. If you put the arrows in backwards or omit them entirely it makes no difference other than to make your code more confusing to look at.


Ok fixed it ... I didn't have the postgui_halfile in the right place. Thank you again for the help!

cheers

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

More
16 Feb 2016 21:49 #70256 by djs14
Ok ... so now I want to make these buttons connect to my ladder.

It seems like I could use the same hal signal (is that correct nomenclature?) that you created (ok-signal) to one of the inputs in the ladder.

I do this in the custom.clp file?

I recall reading something about this somewhere ... sorry if I'm being lazy. You guys are so helpful.

cheers

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

More
16 Feb 2016 21:57 - 16 Feb 2016 22:02 #70257 by djs14
Looks like I need something like this:

net ext-estop classicladder.0.in-00<= pyvcp.py-estop

with the correct names in the custom hal file.... not the postgui hal file?... or it doesn't matter?

Thanks all ...

edit: Looks like it should be in the postgui hal file ....
Last edit: 16 Feb 2016 22:02 by djs14.

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

More
16 Feb 2016 22:02 #70258 by Todd Zuercher
It's been a little while since I messed with Classic Ladder. Bassically CL will make a whole pile of pins named something like "clasicladder.0.in-00" or "clasicladder.0.out-00" that you will connect in your hal file(s) to whatever signals you have.
So to connect you new pyvcp button to the first CL input bit you'd add the line.
net ok-signal => clasicladder.0.in-00

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

More
16 Feb 2016 22:48 #70262 by Clive S

net ext-estop classicladder.0.in-00<= pyvcp.py-estop

....

I think you need a space before the <= But I am only learning so perhaps don't take any notice and listen to the wise one's :unsure:

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

More
17 Feb 2016 16:34 - 17 Feb 2016 16:36 #70293 by djs14
OK guys whats going on here.

I set up a couple buttons using pyvcp's and got my practice ladder working the way I wanted. I had to put a "one shot" contact in there that would increment my tool number to mimick the tool changer limit switches. I would click on my pyvcp button and see my variable that is mimicking my tool number increment down as I expected. Huge victory yesterday!

This morning I connected a physical pin to this "one shot" contact in my ladder but its not acting like a one shot. When I connect 12v to the input instead of incrementing my variable by 1 (starts at 5 should increment by 1 each time input is made), it runs my loop a bunch of times so the tool number decreases from 5 all the way to 1 instantly ... which is what the ladder was doing before I realized I needed a one shot contact.

You can see in my hal file that I commented out the pyvcp button and added the input halpin ... so you can undo that maybe if you want to see how it was working with the button.

Do I need to do some signal conditioning to the input or something?

File Attachment:

File Name: MiyanoLatheTwo-2.hal
File Size:11 KB


File Attachment:

File Name: MiyanoLatheTwo-2.ini
File Size:3 KB


File Attachment:

File Name: panel-2.xml
File Size:0 KB


File Attachment:

File Name: another.clp
File Size:8 KB



cheers all

edit: the ladder I was using is in section 2 of the ladder diagram ... section 1 is an old e-stop ladder I started with to get familiar with things so you can ignore that
Attachments:
Last edit: 17 Feb 2016 16:36 by djs14.

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

Moderators: cmorley
Time to create page: 0.211 seconds
Powered by Kunena Forum