Hello all,
I am returning to this forum whenever I couldn't find right thinking myself.
My situation is this.
Build a new CNC gantry router using 6 servo packs
servo pack 1 = axis X
servo pack 2 = axis Y1
servo pack 3 = axis Y2, slaved to Y1
servo pack 4 = axis Z
servo pack 5 = axis A
servo pack 6 = belt driven milling spindle, swap to water-cooled VFD spindle(inverter driven) when needed
So far, my progress is that I have finished fabricating all necessary mechanical joints, bushing, bearing support and control box having KFLOP, 6 servo packs, all kinds of terminals, VFD inverter, noise filter, circuit breaker, blah blah.
I tried to configure software setting to verify everything is functionally working and I could see with my oscilloscope that pulse trains were successfully generated without problem for all axis, spindle pwm failed, trying to sort out this atm - I mean from KFLOP.
My remaining task is to hookup other peripherals and let them acknowledged by mach3/kflop so that they watch those input pins all the time.
I have been reading so many things in dynomotion webpage but many parts are still vague to me.
Webpages are very descriptive for pros, but it is not kind to a new comer like me, just my thinking.
Peripherals currently involved in this task are:
1. Limit switches used for homing but also act as limit switches all the time, 1 for each axis and soft-limit will be active. I seperated 3 limit switches and they will be put into 3 different IO pins of KFLOP. Why seperated? Well... There were just bunch of IOs that I could use...
2. probe that will always be monitored by kflop all the time whether the pin is active or not
3. E-stop switch that will also be monitored all the time.
Looks very simple.... but not to me....
I know there are various sample c-codes bundled with the software.
My problem is that they are all seperated, spreaded and there are too many codes with similar names..
Below image, I assume, is what I can make use of.
Attachment 326974
Attachment 326958
KFLOP seems to have total 7 user memory slots that can run simultaneously when initialized.
Number 1 has no thread indication but I assume this will be the fixed thread No.1 because this is the most important core process, axis control.
No. 2 has spindle speed which can be allocated to thread 2 - or whatever available.
No. 3 is for homing process, thread 3 in this case. Whole code is unbelievably long for a homing sequence but it does seem like it is a homing. However, it does not look like it look at 3 limit switches all the time after homing sequence.
No. 4 is for communication between mach3 and KMotion and I think it looks one of vital process that can not be skipped or omitted. Thread 4 here.
4 threads are occupied up to now and I have 3 threads empty as available for other use.
Okay, here comes my curiosity and request for wisemen's opinion.
- Should I put each process of <watch limit pin>, <watch probe pin> and <watch estop pin> routines into thread 5 & thread 6 & thread 7 for example?
- Or can I put these monitoring processes as one package at the bottom of initialize.c(let's call this whatever..) code and leave empty threads free?
- To let several threads active at Launch, what action exactly is required? Power-up KFLOP board? Launch KMOTION.exe and Mach3? Or launch Mach3 alone?
- When c-code is launched, do I still have to configure MACH3's input/output as enabled for spindle PWM, limit, ptobe, estop, etc? If yes, do I have to match port/pin in Mach3 config to KFLOP IO?
I know these questions are basic things, still all vague to me.
I have not yet looked inside rigid tapping code so I haven't grab an idea how they work or what I would need to do this yet, probably later.
Except that, I think all functions I really need will be settled by solving this puzzle.
My understanding is for { } loop is necessary to monitor any input.
What I do not exactly know is whether I can put several for{ } loop in one c-program, i.e. initialize.c here or a seperate c-code having all these routines. <Several> means monitoring limit#1, limit#2, limit#3, probe , estop all the time.
Can anybody tell me an ideal way to accomplish what I want to do please?
regards
Kevin