On Sat, Dec 01, 2007 at 06:13:17AM -0800, Klemen Dovrtel wrote:
> The galvanometer is current driven, so i was thinking
> of using a op-amp and R-2R resistor ladder for current
> source. So i need a 10 bit digital output for R-2R
> resistor ladder (instead of pwm used in etch-servo
> sample configuration). How can i archive this? Is this
> a good solution, or should i also use PWM (i didn't
> make the hardware driver yet).
This can easily be accomplished with a custom component which takes one
input and produces a bunch of bit outputs.
Here's a lightly-tested component to do just that. After installing
emc2-dev and build-essential using the package manager, you can install
the new component with 'comp --install tobits.comp' or view the
formatted documentation with 'comp --view-doc tobits.comp':
// ----------------------------------------------------------------------
component tobits "Convert a floating-point value into a binary value";
pin in float in;
pin out bit out-##[10];
param rw float scale=1;
param rw float offset;
function _;
license "GPL";
description """Convert a floating-point value into a 10-bit binary value.
The binary value is given by the equation
.RS
floor((in-offset)/scale * 1023 + 0.5)
.RE
limited to the range 0..1023.
""";
;;
int i, v;
if(scale == 0) scale = 1;
v = (int)((in - offset) / scale * 1023 + 0.5);
if(v<0) v = 0;
if(v>1023) v = 1023;
for(i=0; i<10; i++) out(i) = (v & (1<<i)) != 0;
// ----------------------------------------------------------------------
> My second problem is, that I think the position signal
> from emc should be modified a bit (
> hight_on_the_wall=constant*tangens(emc_output signal
> ), because otherwise the "drawing" on the wall will be
> stretched at the sides. How can i achieve this?
In emc, 'kinematics' can define arbitrary relationships between the
cartesian axes (e.g., xyz) and the "joints" of the machine. The basics
of writing a new kinematics type are described here:
http://linuxcnc.org/docs/2.2/html/motion_kinematics.html
An alternative is to use screw compensation, which you can do by just
writing a table of entries that approximate the tangent or arctangent
function you need.
http://linuxcnc.org/docs/2.2/html/config_ini_config.html#sub:%5BAXIS%5D-Section
(see COMP_FILE and COMP_FILE_TYPE)
Jeff
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users