Must have been a copy and paste issue with windblows... however I did find your missing the ; after the license
JT On 6/27/2013 11:14 AM, andy pugh wrote: > On 27 June 2013 14:03, john mcintyre <johnan...@live.com.au> wrote: > >> The gear box has 6 magnetic clutches in the gearboxand 2 magnetic clutches >> in the headstock ( high and low range)The gear changes only take place,when >> there is no load.I have the truth tables to select the magnetic clutches >> required for each spindle speed . > I think you can build the logic using existing HAL components. > One LUT5 per clutch can be used to set the mode of that clutch for each speed. > LUT5 takes individual input bits, however, so you need some way of > converting a gear-number into 5 separate bits. > The matrix_kb component (in Master) can do this, but would need to be > installed by hand in a non-master config (not too difficult) > > Alternatively, you could use mux16, which is also fairly close to what > is required. > > I think the closest component to what is needed is mux_generic, but > you would need 8 of those. It has the advantage that it can take an > integer gear number, and output individual bits. It has the > disadvantage that it only exists in master, so you would have to > "comp" it into your system. > > So, if you are going to need to comp it anyway, perhaps a custom > component is called for? (Actually, this seems like a fairly useful > component in general, so perhaps could be added to the distribution). > > Also, bear in mind that my knowledge of HAL components is not > exhaustive, there might already be one that does this. > > http://www.linuxcnc.org/docs/devel/html/hal/comp.html > > component gearchange "drive up to 32 gearbox solenoids"; > > pin in u32 gear "the selected gear"; > pin out bit out-## [10] "solenoid driver bits"; > param rw u32 table-## [32:personality] "logic table. personality == > number of gears"; > > function _; > license "Any prime-numbered GPL version :-)" > > ;; > > FUNCTION(_){ > int i; > if (gear > 0 && gear <= personality){ > for (i = 0; i < 10; i++){ > out(i) = (( table(gear) & (1 << i)) != 0); > } > } > > This code was written on-the-fly on a Windows PC, and is utterly untested. > Save in a text file, install according to the hyperlink. Then populate > the "table" parameters with the bit-patterns corresponding to the > solenoids for each gear. > > This could probably usefully handle different VFD velocity scaling > factors too. And have a mode where the bits are inputs, corresponding > to physical lever positions, to do the same calculation backwards. > ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users