On 06/27/2011 07:57 AM, andy pugh wrote: > On 27 June 2011 15:34, Karl Cunningham<[email protected]> wrote: >> If I have a program that gets executed via a user-defined M100 command, >> can that program get the INI file data somehow? > > There might be an elegant way, but you you could: > 1) Create constants in the HAL file, and use setp to store data from > the INI file in it. > http://www.linuxcnc.org/docview/html/man/man9/constant.9.html > eg > loadrt constant names=ratio1,ratio2,ratio3 > setp ratio1.value [GEAR_RATIOS]ratio1 > > > Then in the shell script > halcmd getp ratio1.out > > should return the value (but I have not tested this) > > Wait for a better way to do it to be suggested before trying this though. > > I am not sure why you need the gear ratios, does this HAL component > for up to 16 gears help? > http://thread.gmane.org/gmane.linux.distributions.emc.devel/4043/focus=4235
Thanks Andy. Setting HAL constants is certainly more elegant than what I came up with. I had not seen spindle.comp, and it might do a lot of what I want. I misspoke when I said I wanted to get INI data from an Mnnn program (forgive me, it's Monday morning). Actually it's an emc2 filter program, filtering ngc files, that needs the gear ratios. I really want to avoid hard-coding the gear ratios into the program, and I think your solution of the HAL constants would still work there. The filter program selects the gear based on available ratios and motor operating speed range. Gear changes on this mill are manual, and the motor is driven from a VFD. The program selects the gear so the motor speed will be closest to its nameplate speed, but tries to avoid unnecessary gear changes by giving preference to the current gear if the motor speed would be within allowable range. When it sees an Snnn spindle speed command it decides on a gear and inserts M100 Pnn into the code (nn is the gear). M100 is small python program which puts up a dialog based on the Pnn argument, containing a graphic telling the operator to change the gear. It also sets the scale factors for the 0-10V output to the VFD and the encoder on the motor, to scale them to motor speed instead of spindle speed. Your suggestion of using the constant HAL component should work there too, to communicate from the M100 program to the scale factors. None of this is tested yet. Karl ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
