Timed exit while loop. Best way?
04 Jun 2013 04:18 #35229
by DaOne
Timed exit while loop. Best way? was created by DaOne
I would like to have a timed exit in a while loop for my hal tool changer component. I am waiting for an input in a loop and if I don't get it in a few seconds I want it to alarm out with a message. I am wondering the best way to achieve this. Probably a stupid question but I am still a newbie to LinuxCNC.
Please Log in or Create an account to join the conversation.
04 Jun 2013 04:48 - 04 Jun 2013 04:49 #35231
by BigJohnT
Replied by BigJohnT on topic Timed exit while loop. Best way?
The easy way to do a tool changer is with
classicladder
. My Hardinge CHNC configuration files are
here
.
JT
JT
Last edit: 04 Jun 2013 04:49 by BigJohnT.
Please Log in or Create an account to join the conversation.
- willburrrr2003
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
04 Jun 2013 04:48 #35232
by willburrrr2003
Replied by willburrrr2003 on topic Timed exit while loop. Best way?
I would use classicladder to handle the timing and alarm logic for this.
Regards,
Will
Regards,
Will
Please Log in or Create an account to join the conversation.
04 Jun 2013 04:59 #35233
by DaOne
Replied by DaOne on topic Timed exit while loop. Best way?
Is there a benefit to using classicladder? I am OK with C for the most part. I am not a coder by any means however.
I am working on a Hitachi Seiki 3NE-300
My turret sequence....
1)Tool change command given
2)Turret unclamped. (SOL 7 ON)
3)Turret checked to make sure its unclamped. (Limit switch 14 OFF)
4)Hydraulic motor turned on full speed to rotate the turret. (SOL 9 ON)
5)Truth table is read to determine correct tool position for commanded tool.(Limit switches 15-18)
6)Wait for rough alignment cam to switch. (limit switch 19 ON)
7)Slow turret while rough index pin is advanced. (SOL 8 ON)
8)Wait for alignment cam to switch. (limit switch 20 ON)
9)Clamp turret. (SOL 7 OFF)
10)Stop hydraulic motor. (SOL 9 OFF)
11)Check to make sure the turret is clamped (Limit switch 14 ON)
12)Rough index pin is retracted. (SOL 8 OFF)
13)Tool has been changed command returned.
My truth table is...
I was basing off the oracchanger.comp here
I am working on a Hitachi Seiki 3NE-300
My turret sequence....
1)Tool change command given
2)Turret unclamped. (SOL 7 ON)
3)Turret checked to make sure its unclamped. (Limit switch 14 OFF)
4)Hydraulic motor turned on full speed to rotate the turret. (SOL 9 ON)
5)Truth table is read to determine correct tool position for commanded tool.(Limit switches 15-18)
6)Wait for rough alignment cam to switch. (limit switch 19 ON)
7)Slow turret while rough index pin is advanced. (SOL 8 ON)
8)Wait for alignment cam to switch. (limit switch 20 ON)
9)Clamp turret. (SOL 7 OFF)
10)Stop hydraulic motor. (SOL 9 OFF)
11)Check to make sure the turret is clamped (Limit switch 14 ON)
12)Rough index pin is retracted. (SOL 8 OFF)
13)Tool has been changed command returned.
My truth table is...
-----------------------------------------
Tool| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|
-----------------------------------------
LS15| X| X| | | X| X| X| X| | | X| X|
-----------------------------------------
LS16| | X| X| X| X| | | X| X| X| X| |
-----------------------------------------
LS17| | | | X| X| X| X| X| X| | | |
-----------------------------------------
LS18| | | | | | | X| X| X| X| X| X|
-----------------------------------------
X= ON
I was basing off the oracchanger.comp here
Please Log in or Create an account to join the conversation.
04 Jun 2013 05:42 #35235
by DaOne
Replied by DaOne on topic Timed exit while loop. Best way?
BigJohnT, whats the best way to run your Hardinge setup without having that card? I have a 5i25 paired with a 7i77 and am still a newbie in this hal setup stuff. When I try to run your files without the hardware I get errors because the hardware isn't found. Thanks in advance.
-Wes
-Wes
Please Log in or Create an account to join the conversation.
04 Jun 2013 05:50 #35236
by BigJohnT
Replied by BigJohnT on topic Timed exit while loop. Best way?
Open a sample configuration with classicladder or create one with stepconf wizard and open the ladder editor. The open my harding.clp file to view it.
JT
JT
Please Log in or Create an account to join the conversation.
04 Jun 2013 05:52 #35237
by BigJohnT
Replied by BigJohnT on topic Timed exit while loop. Best way?
I also have a
sample config
to show how classicladder works with a tool changer on my web site.
John
John
Please Log in or Create an account to join the conversation.
04 Jun 2013 05:59 #35238
by DaOne
Replied by DaOne on topic Timed exit while loop. Best way?
BigJohn, Not sure where on your site the harding.clp file is? I downloaded the EMC2 CHNC Config Files and that file is not in there. Maybe I am looking in the wrong place?
Please Log in or Create an account to join the conversation.
04 Jun 2013 07:00 #35240
by DaOne
Replied by DaOne on topic Timed exit while loop. Best way?
Please Log in or Create an account to join the conversation.
04 Jun 2013 07:03 - 04 Jun 2013 07:04 #35241
by DaOne
Replied by DaOne on topic Timed exit while loop. Best way?
Ok, I am looking at the classic ladder. About the only part I can't wrap my head around is the truth table. Maybe someone can translate?
if(tts1 && !tts2 && !tts3 && !tts4)
position = 1;
else if(tts1 && tts2 && !tts3 && !tts4)
position = 2;
else if(!tts1 && tts2 && !tts3 && !tts4)
position = 3;
else if(!tts1 && tts2 && tts3 && !tts4)
position = 4;
else if(tts1 && tts2 && tts3 && !tts4)
position = 5;
else if(tts1 && !tts2 && tts3 && !tts4)
position = 6;
else if(tts1 && !tts2 && tts3 && tts4)
position = 7;
else if(tts1 && tts2 && tts3 && tts4)
position = 8;
else if(!tts1 && tts2 && tts3 && tts4)
position = 9;
else if(!tts1 && tts2 && !tts3 && tts4)
position = 10;
else if(tts1 && tts2 && !tts3 && tts4)
position = 11;
else if(tts1 && !tts2 && !tts3 && tts4)
position = 12;
else
position = 0;
Last edit: 04 Jun 2013 07:04 by DaOne.
Please Log in or Create an account to join the conversation.
Time to create page: 0.099 seconds