Urgent help required with EMC please

More
16 Aug 2016 15:23 #78870 by sxyuklad
No, the closest one to my physical setup of ATC I have found is ORAC ATC by ArcEye. But it is still different, because it uses 3 opto seonsors to determine position, but I have two sensors, 1 for index / tool 1 and the other is basically to count on each tool. So it is very basic stuff but the problem is when I am altering the code, it will not compile. So if any one having just a little knowledge of language can easily point me to the right direction or alter the code for me to suit my needs. I can explain everything and I have already in my previous posts. So I am sure it will be a few lines to alter within the same ORAC ATC which has already been written and tested. But the problem is no one is coming up to show that courage to help me out with coding that suits my setup or at least guide me a little about basic stuff like adding timer to stop and take pause in the tool change process before processing next line. And I do have basic knowledge of the language, like loops, conditional and comparing stuff and all that. It is that I just need linuxcnc related stuff explanation.

Huh, I do not know man what to do now. I am stuck here and awaiting for someone to come up and say hi, please tell me your setup and I will change the code for you or say ok, what you want to do, I can tell you the lines to add,

So I can go step by step through the ATC process and he keeps telling me the lines...

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

More
16 Aug 2016 15:37 #78874 by Todd Zuercher
Programming isn't everyone's forte. (It certainly isn't mine.)
If you are having trouble with building a component, I think there are other ways you might be able to make it work. How are you a programing ladder logic? Have you looked at the soft PLC in Linuxcnc called Classicladder?
linuxcnc.org/docs/html/ladder/ladder-intro.html
linuxcnc.org/docs/html/ladder/classic-ladder.html
linuxcnc.org/docs/html/ladder/ladder-examples.html
And here are some examples on the wiki (including an ATC and a Lathe turret)
wiki.linuxcnc.org/cgi-bin/wiki.pl?ClassicLadderExamples

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

More
16 Aug 2016 16:26 #78884 by sxyuklad
No, I am not aware of ClassicLadder.

Is it some sort of graphical interface for coding? Is it easier than programming a language? Will it do what I am trying to do here like take two inputs and drive two inputs accordingly and I also need a counter to count on each pulse opto sends in... Is this all possible with a ladder?

And I hope there is nothing like installing ladder and all that stuff like it is with comps. Like you have to install it and all that stuff. Do you know how to program a ladder, I may try that if you can help me on that?

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

More
16 Aug 2016 17:15 #78893 by sxyuklad
I have just finished going through all the documentation about ladders you shared.

Well, at the start it looked pretty easy but when it came to ATC programming, still not sure about a few things how they will work.

Well, let us hope someone comes by my thread and just fixes my comp file. Hoping soon...

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

More
16 Aug 2016 18:30 #78899 by sxyuklad
I am now about to start pulling my hairs.

Why is linuxcnc so difficult and on top of that no one is up for help yet.

Please ARCEYE or CNCBASHER help me out of this. I now have altered the whole code to suit my needs it compiles now even.

Now the problem is when I start linuxcnc, the component start working with initialization without waiting for an M6 command. It freezes the system, turret starts rotating as if looking for tool. Then after about a minute or so, turret will stop anywhere randomly but linuxcnc will still not start and my keyboard, mouse etc are in frozen state.

Please please please someone just quickly go through my file and point out what I am doing wrong in there? Why it is behaving like that? Why the ATC component start running as soon as I launch linuxcnc. Practically it should not start until an M6 command is issued.

Please help me out. I have tried altering the code with my little knowledge but it is just not working out. This time I converted my VB macro line by line to C language to make sure the coding is right. my comp file is attached please go through it and point out why this weird behavior?

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

More
16 Aug 2016 18:42 #78901 by sxyuklad
I am now about to start pulling my hairs.

Why is linuxcnc so difficult and on top of that no one is up for help yet.

Please ARCEYE or CNCBASHER help me out of this. I now have altered the whole code to suit my needs it compiles now even.

Now the problem is when I start linuxcnc, the component start working with initialization without waiting for an M6 command. It freezes the system, turret starts rotating as if looking for tool. Then after about a minute or so, turret will stop anywhere randomly but linuxcnc will still not start and my keyboard, mouse etc are in frozen state.

Please please please someone just quickly go through my file and point out what I am doing wrong in there? Why it is behaving like that? Why the ATC component start running as soon as I launch linuxcnc. Practically it should not start until an M6 command is issued.

Please help me out. I have tried altering the code with my little knowledge but it is just not working out. This time I converted my VB macro line by line to C language to make sure the coding is right. my comp file is attached please go through it and point out why this weird behavior?
Attachments:

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

More
16 Aug 2016 19:38 #78903 by Todd Zuercher
I am not enough of a programmer to debug your comp file, but maybe there just might not be anything wrong with it. Lets try to go over what might not be right out side of that. Do you have all of your pin connections set up in your hal file for your tool change component? Could you share those files so we can double check them as well.

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

More
16 Aug 2016 21:19 #78906 by sxyuklad
Hello Todd

I have attached before. But here you go again. These are the latest.

OK, let me tell you a good news again. Having no knowledge of coding, I have somehow managed to write a comp which is actually working pretty close to what I want. There are a few things I need to tweak still. But hey, imagine someone installed linux for the first time in life like 4 or 5 days ago and he has actually written an ATC comp. There has been so much studying and working and going through long documents and trying different things and thinking deeper and deeper.

My previous problem was, it compiled without errors but when I launched linuxcnc, it just froze everything and started to run my comp even without an M6 command. Now I have got rid of that problem too. My code is compiling correctly, IT IS STOPPING AT THE RIGHT TOOL NUMBER, isn't it amazing? But the very last two tweaks I require now are:

1. Once I call an M6Tx command for toolchange, turret comes to the right tool but but but, the comp does not seem to end, it slows down my computer so much as if something is running in the background and it cannot be anything else but only comp code which is running again and again. Can you or someone help me to guide to a statement which will stop running the comp once the tool change process has completed. You know what the original comp which I altered had a SWITCH CASE statement and who wrote that code actually stopped the process when tool change is complete with BREAK; statement. Now my problem is I cannot use break statement because I am not using SWITCH CASE or LOOP. If I do use, it gives me an error saying "Break can only be used with loops or switch" which is totally understandable. So I do not know any other coding how to come out of the process, in other word break the whole process once the tool is found. In mach3 VB script, when I have found my tool, I can come out of the whole process with exit command. Very simple and the code will not run again till I issue another M6 command.

One more thing I have noticed it is very different from Mach3. Mach3 has a file called M6Start. When you issue an M6 command, this is the file which is run from top to bottom and it only runs when you issue an M6 command and closes with M6 being completed. More efficient and understandable way of dealing with ATC. But in linuxcnc, the comp file is not like it will only run on M6 command. It will keep running as soon as you launch linuxcnc. It is very strange. So there is no separate file for M6 macro. And I know where my problem is. If you go through my comp file, by the end of the file I have set a label as countpulses: and I call this label from the end of the file again and again to work my counter. Now because comp file always runs so what is happening is even after finding the right tool, this goto command is running again and again. I know where the problem is but I do not know how to break that process so it does not run again. I will really have to think about it more deeply.

2. Second tweaking is simple but because I do not know anything about linuxcnc language so I am not able to do that. I need to add a delay between two outputs. My turret moves forward for finding a tool and once found it moves reverse to lock the turret against pawl / ratchet. I am sure you are familiar with that kind of setup. Now suppose turret has found the right tool, the process is: First one relay will turn off, so forward movement stops and it reverses to lock. Then I NEED A DELAY HERE, so before sucking out the power from the motor, I give it enough time to lock. That is my problem. THAT DELAY I NEED TO ADD TO LET THE MOTOR MOVE REVERSE FOR A FEW SECONDS TO LOCK and then I will turn off second relay to take the power out. THAT delay I do not know how to program. I am sure it is very simple but again I do not know. In Mach3 VB script, I used sleep(5000) and as simple as that it stayed there for 5 seconds while the motor reverses back and then begun to the next line of code which is obviously turn off second relay.

I am sharing my hal and comp file. If anyone can guide me these two things, I will be totally done with this project. So please anyone, just tell me how to add delay between two relay switching off at the end where I find my tool and how to break or stop the code once tool is found. Simple things anyone please help me, I have come so so close now.

Todd, you have been such a help, I cannot thank you enough sir.
Attachments:

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

More
16 Aug 2016 21:36 #78909 by Todd Zuercher
Sounds like you are tantalizingly close to success. You just need a few more hints, that I'm afraid I can't help you with. Sorry

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

More
16 Aug 2016 21:44 #78910 by sxyuklad
OK, I have tried to address both these problems again, playing with coding again. I am going to compile it again in about 2 hours. Wish me luck. I think it should work perfect now. I have tried to add delay and also thought of a way to break the process. I will share my results. In the meantime, if you can come up with something to address these both issues, please let me know.

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

Time to create page: 0.144 seconds
Powered by Kunena Forum