Hi Description of problem :
Mach3 program has standard of 6-12 kHz charge pump frequency, and many devices are compatibile with it. If you have a good computer, you can set base_thread=20000 and get 25 kHz on charge-pump.out, this is too fast. The servo_thread gives only 0,5 kHz and is unusable too. Solution : Simply add second output to charge-pump, with frequency divided by two. Now you can use charge-pump.out or charge-pump.out-div2 in hal config file, what the better. Changes in code : diff -Naur old/charge_pump.comp new/charge_pump.comp --- old/charge_pump.comp 2013-10-27 02:28:28.000000000 +0100 +++ new/charge_pump.comp 2013-11-11 10:52:14.797788272 +0100 @@ -1,5 +1,6 @@ // This is a 'charge-pump' component for EMC2 HAL // Copyright 2006 Jeff Epler <[email protected]> +// Modified by tuxcnc (div2 output) 2013 // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -18,6 +19,7 @@ component charge_pump "Create a square-wave for the 'charge pump' input of some controller boards"; option singleton yes; pin out bit out "Square wave if 'enable' is TRUE or unconnected, low if 'enable' is FALSE"; +pin out bit out_div2 "Slow square wave, frequency divided by two"; pin in bit enable = TRUE "If FALSE, forces 'out' to be low"; function _ nofp "Toggle the output bit (if enabled)"; description """ @@ -25,13 +27,19 @@ When enabled the output is on for one period and off for one period. To calculate the frequency of the output 1/(period time in seconds x 2) = hz. For example if you have a base period of 100,000ns that is 0.0001 seconds and the formula would be -1/(0.0001 x 2) = 5,000 hz or 5 Khz """; +1/(0.0001 x 2) = 5,000 hz or 5 Khz. Pin out-div2 gives frequency divided by two."""; license "GPL"; ;; FUNCTION(_) { if ( enable ) { - out = !out; + if ( out == 0 ) { + out_div2 = !out_div2; + out = !out; + } else { + out = !out; + } } else { out = 0; + out_div2 = 0; } } Regards. ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
