USB and PNCCONF, retrofit Moho 300P

06 Feb 2012 13:34 #17462 by andypugh
RIM wrote:

The change in axis is electrical done with clutch and breaks on all axis.
The hardware upgrade is later, first I would like to see the EMC2 and the Maho work together, before I start modifying the "working" hardware,

OK, this is a very special configuration, and you are going to have to do some HAL modifications by hand.

Start in pncconf with a normal 3-axis + spindle machine. (4 encoders, 4 pwms, on the 7i43, 4 PIDs in the HAL)
Get it all working and the PID tuned with just the X axis.

To switch axes you need to do two things, change the clutch position and direct the output of the required PID controller to the servo driver.

The clutch change can most easily done with a G-code digital output, and pncconf probably already lets you allocate those to a pin.
You will then have to write your G-code like this

M63 P0 ; turn off pin 0
M62 P1; turn on pin 1 (Y axis)
G1 F20 Y100
M63 P1
M62 P0 ; switch back to X axis
G1 F100 X250

(We can try to think of cleverer ways to do this later)

To direct the PID output to the servo-amp you can use Mux8 in HAL:
You could use Mux4, but Mux8 seems safer as that allows you to have zero output for invalid select bits. ie you will define 100, 010 and 001, but leave 000, 101, 110 and 111 unused and zeroed)

In the Hal you would need the usual loadrt and addf functions for the mux8 (see the HAL manual) and then
net x-sel => mux8.0.sel0 7i43.0.gpio.040.out
net y-sel => mux8.0.sel1 7i43.0.gpio.041.out
net z-sel => mux8.0.sel2 7i43.0.gpio.042.out
net x-pid pid.0.output => mux8.0.in1
net y-pid pid.1.output => mux8.0.in2
net z-pid pid.2.output => mux8.0.in4
setp mux8.0.in0 0
setp mux8.0.in3 0
setp mux8.0.in5 0
setp mux8.0.in6 0
setp mux8.0.in7 0
net pid-selected mux8.0.out => hm2_7i43.0.pwmgen.0.value

(this is just example code, for illustration only, it won't necessarily work as I can't test it here, and there may be many miss-spelled names)

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

Moderators: cncbasher
Time to create page: 1.177 seconds
Powered by Kunena Forum