Programming a 'custom' button

More
15 Apr 2013 18:36 #32740 by beltramidave
Thank you ArcEye & Andy...you guys are awesome! That screen looks like it will do exactly what I need and more.
As I said before, I know nothing of programing with C. Could you elaborate more on what I need to to with that code (patch comp). Sorry for being so dense, but I actually am trying to learn from what you are putting out there.

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

More
15 Apr 2013 22:43 #32755 by ArcEye
Hi

If you are using 10.04, you don't need to do anything with the code, there is a compiled module in the zip.
Copy it to /usr/bin

Try out the sim, then look at the .xml and custom.hal files for how to load the module and connect up the pins to pyVCP panel etc in your own config

regards

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

More
20 Apr 2013 19:44 #32942 by beltramidave
Sorry for the lapse, I have been out of town. I have not been able to get permissions for /usr/bin to copy points to it. Can you tell me what I need to do. I am the administrator and only user on this computer. Thanks

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

More
20 Apr 2013 20:44 #32944 by ArcEye

I have not been able to get permissions for /usr/bin to copy points to it. Can you tell me what I need to do. I am the administrator and only user on this computer.


Either use sudo before each command or su root (if you have root set up, Ubuntu disables it by default, but the scripts you ran should have enabled it)

From the directory with points in, try
sudo chmod 777 points to set the permissions on it wide open
then
sudo cp points /usr/bin/points

regards

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

More
24 Apr 2013 06:02 #33101 by beltramidave
Would a button that stores the position in persistent G-code variables (#5161-#5390) work?
www.linuxcnc.org/docs/html/gcode/overview.html#sec:parameters

Program button calls MDI sub, #5161=#5420 / #5162=#5421

Recall button calls MDI sub G0 X#5161 Y#5162

Andy,
I can't seem to figure out how to "program" more than 1 button using this method. I'm sure there is a simple fix, but I can't figure it out.

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

More
24 Apr 2013 06:28 #33104 by andypugh

I can't seem to figure out how to "program" more than 1 button using this method. I'm sure there is a simple fix, but I can't figure it out.

What part of it isn't working?

(And how are you doing it?)

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

More
24 Apr 2013 07:11 #33106 by beltramidave
Sorry, I should have elaborated a bit more.

Basically, I only have 3 buttons created at the moment, 'Program', 'Custom1', and 'Custom2'.
'Program' records the current position by calling a subroutine with #5161=#5420 & #5162=#5421.
'Custom1' calls a subroutine with G0 X#5161 Y#5162.
'Custom2' calls a subroutine with G0 X#5163 Y#5164.

'Custom1' works great! I know why 'Custom2' doesn't work as I haven't moved any values into 5163 & 5164. Without having a seperate 'Program' button for each 'Custom' button, I am not sure how to do this.

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

More
24 Apr 2013 07:33 #33109 by andypugh

'Custom1' works great! I know why 'Custom2' doesn't work as I haven't moved any values into 5163 & 5164. Without having a seperate 'Program' button for each 'Custom' button, I am not sure how to do this.

I think a separate "program" for each "apply" is probably the way to go, to be honest.
Laid out next to each other, with number boxes to show the current status, it should look quite tidy.
The following user(s) said Thank You: beltramidave

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

More
24 Apr 2013 08:44 #33110 by beltramidave
Thanks Andy, you may be right. I was hoping to not take up so much screen space.

I had thought about making the 'program' button a set/reset button, then looking to see if it was set and then by pushing 'custom1', it would send current coordinates to #5161 & #5162 or by pushing 'custom2', send coordinates to #5163 & #5164 and so forth. Then If the 'program' button wasn't set, just run the sub with the loaded coordinates.

I am a plc guy and I am pretty confident I could do it with plc logic, but not so sure with this programming. Thanks again for your help.

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

More
24 Apr 2013 16:03 - 24 Apr 2013 16:04 #33122 by andypugh

I am a plc guy and I am pretty confident I could do it with plc logic

Ah, well, in that case:
www.linuxcnc.org/docs/html/ladder/classic_ladder.html

Though I am fairly sure that you could do what you want in the G-code subroutines.
O<program1> sub
   #5161=#5420
   #5162=#5421
O<program1> endsub
O<custom1> sub
  O100 if [#5161 ne 9999]
    G0 X#5161 Y#5162
    #5161 = 9999
    #5162 = 9999
  O100 else
    #5161 = #5420
    #5162 =# 5421
  O100 endif
O<custom1> endsub

And so on. I don't think this does what you want, but I am not entirely clear what you want. I am just demonstrating the use of the G-code "if" statement and a "magic number" stored in the parameters as a way to set behaviour.
Last edit: 24 Apr 2013 16:04 by andypugh.

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

Time to create page: 0.114 seconds
Powered by Kunena Forum