On Monday 11 November 2013 02:18:24 Juergen Gnoss did opine: > I need a suggestion from LCNC developers point of view. > > I like to read ADC values, transform that values into Temperature values > and make that values available on a hal pin. ADC values I get from a > user-space file inside the device tree. > > Since there is a lot of Thermometers who can be connected to the ADC and > most of them are not linear, I need a Look Up Table (LUT) provided by > the integrator who's setting up LCNC. > > Idea is, providing the LUT in a .csv file in config directory. > > I know, there are several way's, like python script, external c > programm, .comp to do that. I like to write a component using the comp > compiler, (also to get familiar with it) > > Now the question: Is there any draw back doing that using a component? > I ask, because > 1. I'm not totally clear right now about the LCNC internals but try to > understand it. 2. I didn't see a component in the source code that uses > user space file-I/O. > > My idea is: > -Create a component that can have several instances (one for each ADC > channel for example) -on loading the component parameters are channel > number and a LUTxx.csv for each instance -each instance read it's LUT > at load-time once and keeps it in memory -conversion and output happens > on a signal on an update pin. > > I'm open for pros and contras. > > Ju
While I don't have any advice as to how to get the data into linuxcnc, Something I haven't tried due to a lack of IO pins without setting up a 2nd parport card. But once you get it there, have a look at "man lincurve". I am using it to linearize the spindle rpms obtained in my lathe, natively a very non-linear process as I'm using PWMGEN to drive one of Arturo's (CNC4PC) spindle controller pwm to analog convertors and a 25 amp motor driver into a 1.5HP motor turning the spindle. With a bit of fine tuning of the breakpoints in lincurve, my spindle now turns within 20 or so rpm of the requested speed via the S### command from about 30 rpm to 1500. A very desirable side effect was that since I also use a spindle encoder output to stabilize the speed vs load, by sequencing the data path so the correction of the error also went thru this module, the speed servo became much more stable in the high gain regions, allowing much more gain and FF0/FF1 corrections to be used in the PID module, which stiffened the control by quite a bit in the lower sensitivity speed ranges. Overall, a win-win for me. Side comment, most of the semiconductor temp sensors today are some modification of the basic LM34, which has a fixed offset, with a sensitivity that doesn't vary by more than a percent over its rated range of x millivolts per degree. So what you need to do for quite a few of that style is subtract the offset, then gain adjust. A sum2 module can probably handle that with lots fewer tweaks to its gain and offset settings. Thermocouple are of course a different horse, and most will also need a "cold" junction as a way to get back to the copper hookup wires. Cold is relative however, no reason that it couldn't be put at a stable temp with a temp regulated heater. Again, a sum2 could adjust the offset and calibrate it. Lots of ways to skin this cat. :) Nearly all the stuff you can see in the man9 directory is available for use as hal modules, and there may be enough stuff there that you could cobble up a 1 parport pin serial data input port. Personally, I would choose to trigger a external hardware timer like an LM555C whose period was controlled by the sensor, then use the "counter" hal module to detect the length of the pulse in terms of base_thread increments. Let your imagination out to play & see what it comes up with. ;-) > ------------------------------------------------------------------------ > ------ 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.cl > ktrk _______________________________________________ > Emc-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-developers Cheers, Gene -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Getting the job done is no excuse for not following the rules. Corollary: Following the rules will not get the job done. A pen in the hand of this president is far more dangerous than 200 million guns in the hands of law-abiding citizens. ------------------------------------------------------------------------------ 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
