Another "what do I need" thread. Vmc retrofit
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
I wrote a wiki page on that subject:
wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrient
Please Log in or Create an account to join the conversation.
- thewho
- Offline
- Premium Member
- Posts: 128
- Thank you received: 2
If you can write Arduino C to do the job you can write LinuxCNC .comp C to do the job.Is it a bad idea to use a Arduino in you guys opinion?
I'm not so sure about that as it has taken me like a year to learn basic Arduino programming (I even had a C++ programming class in school, but that is not important..)
The best thing with Arduino (according to me) is that there is an example for almost anything I want to do. So I just have to copy paste pieces of code that I necessarily don't really know how works.
But I'm pretty sure I'd be able to get that working and that's why I'm asking.
If I where to do the communication myself I'd probably use 4 pins (4bit binary) from the 7i77 card to select what tool is requested.
Example:
if tool == 12 then
set output 1 = 1
set output 2 = 1
set output 3 = 0
set output 4 = 0
Then input pins:
1. Lift Z to level with carousel
2. Lift Z to clear carousel
3. Ok to continue machining
There, now I've made a fool out of myself but now you know the level of programming experience i have
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
I taught myself C just to add three-phase motor support to the Mesa drivers, so not being very good at C right now is no handicap.I'm not so sure about that as it has taken me like a year to learn basic Arduino programming
If I where to do the communication myself I'd probably use 4 pins (4bit binary) from the 7i77 card to select what tool is requested.
Example:
if tool == 12 then
set output 1 = 1
set output 2 = 1
set output 3 = 0
set output 4 = 0
No need for that, there is already an existing HAL component for the job:
www.linuxcnc.org/docs/html/man/man9/bitslice.9.html
Or to do it in C-code
output1 = tool & 1;
output2 = tool & 2;
output3 = tool & 4;
output4 = tool & 8;
No need for 12 if/else statements. "&" is bitwise-AND.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
Attached should be a zip containing three files. Unzip them somewhere convenient then on that folder you can issue the following commands at the command line.
comp --view-doc carousel.comp
sudo comp --install
To see it in action without hardware attached make sure Linuxcnc is _not_ running and:
halrun
source carousel_test.hal
Put all the sim_pin boxes into "toggle" mode.
Then set a tool requetst in the pocket-number box.
Then set "enable" true.
You will see that the actuator-0 pin goes true, waiting for you to toggle actuator-1-fb. so do that, then the same for 1,2,3.
At than point you should see the gray-code pins flickering as the "simulated" carousel slowly moves.
It will stop at the right number, then you need to un-toggle the actuators 3,2,1,0 and the carousel state should return to the zero position.
Change the tool number, and repeat.
I actually think that this component can do nearly your whole sequence, except the Z moves. Your G-code might have to sit and wait for the actuator pins to do their thing, and it might well be the case that the feedback pins are driven from G-code outputs.
Early days yet, and rough around the edges.
Please Log in or Create an account to join the conversation.
- thewho
- Offline
- Premium Member
- Posts: 128
- Thank you received: 2
I'll be trying it in a few hours, has to get off work first...
I'm planning on tuning all axis and get the spindle running this weekend.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
Awesome!
I'll be trying it in a few hours, has to get off work first...
I'm planning on tuning all axis and get the spindle running this weekend.
And then we can start a debate on how it ought to work.
I think I want to change the config string from "u5" (in the case of your machine) to something like:
"pins=5 code=gray bidirectional=0 before=01234 after=345"
This would set pins 0,1,2,3,4 in sequence before moving the carousel and 3,4,5 in sequence after.
But this isn't as flexible as I would like. any ideas? Maybe "before=(1TW1F)(2F3TW1T)" as a format might work. That would set pin1-out "True" wait for pin1-fb to go "False" then set pin2 false, pin 3 true and wait for pin1-in to go "True" ?
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
(Though, actually, that version is probably perfectly capable of controlling your changer)
Please Log in or Create an account to join the conversation.
- thewho
- Offline
- Premium Member
- Posts: 128
- Thank you received: 2
I did what you said but it seems it didn't install the component. When I run "halrun" and write "source carousel_test.hal" it says that there is no such file in "usr.." etc
Quick info as it's late and I have quite a long trip home.
Z need to at least Z=8 so that the tool in the carousel clears the spindle face. (8mm above home switch)
Will that be a problem? Limit switches are directly wired to the servo amplifiers. It was done that way from the beginning and I just left it that way.
And home switches goes only to the 7i77 card.
Been having some troubles to get the machine to home Y correctly as the home switch is in the "wrong" direction. Full + travel in other words. But that is a problem I feel confident in fixing myself
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
Sounds good!
I did what you said but it seems it didn't install the component.
What was the on-screen output when you did "sudo comp --install carousel.comp"?
It is possible that the missing component is sim_pin
Please Log in or Create an account to join the conversation.
- thewho
- Offline
- Premium Member
- Posts: 128
- Thank you received: 2
I'll have to get back to you on that one tomorrow.
Please Log in or Create an account to join the conversation.