On Wed, 2011-08-17 at 19:48 -0700, doug metzler wrote:
> Ok, I'm getting back to this and here are the steps I've gone through.
> 
> My lspci -v shows the following addresses for the parallel ports on the card:
> >> I/O ports at a400 [disabled] [size=8]
> >> I/O ports at a000 [disabled] [size=8]
> >> I/O ports at 9800 [disabled] [size=8]
> >> I/O ports at 9400 [disabled] [size=8]
> 
> I did some initial messing around with trying to get the pendant to
> work, but then I decided to go back to basics, so I commented out
> everything about the MPG and simply changed the default parallel port
> that EMC talks to to each of the above addresses in turn.
> 
> So the default was # loadrt hal_parport cfg="0x378 out " which worked great
> 
> I attached the parallel cable (turning the machine off each time) to
> the upper port (interesting note, when attaching the MPG to the upper
> port the LED on the MPG lit up, but on the lower port it did not)
> 
> and went through each iteration of
> # loadrt hal_parport cfg="0xa400 out "
> # loadrt hal_parport cfg="0xa000 out "
> # loadrt hal_parport cfg="0x9800 out "
> # loadrt hal_parport cfg="0x9400 out "
> 
> Each time firing up EMC and trying a manual move via the keyboard.

Did you also add the hal_parport functions to a thread? (I forget this
quite often) If not, to review, when you "loadrt" something, it loads
the something module and makes it available for use, or actually makes
the functions within the module available. A function can be run by
assigning it to a thread.  The command "addf" does this. The hal_parport
has two functions, one to read inputs which usually should be early in
the addf list, and the second writes the parport outputs, so should be
close to the end of the list. Typically the input status is used to
create a solution for the outputs, so the read command line needs to
come before the write. One tricky bit is, if needed, the addf command
can be appended with a 1 or -1. 1 overrides the normal "as written"
command line order and puts the command at the end of the assigned
thread, -1 puts the command at the front. I believe (and I could easily
be wrong) if there is more than one line with 1 or -1, they get stacked
at the end or beginning (nest) in the order that EMC2 sees them as
the .ini and .hal files are loaded and parsed. So, if you see a
sample .hal file with "addf ... -1" you'll know what it means.

Once the read and write functions are running in the proper threads, the
HAL pins can be connected. Remember that the hal_parport ID starts with
0 and not 1.

I think you could loadrt all of the addresses (0x0378, 0xA400,
0xA000...) and set up the five addf's and leave the pins unassigned or
leave them in the default configuration. Actually, I seem to recall that
EMC2 won't load if an address isn't a real base port register, so you my
need to remove two addresses. My guess is that 0xA000 and 0x9400 are the
the base registers, the other two are extended registers. Then use
HALmeter or HALscope to monitor, let's say, the input pin that is
connected to the encoder phase A. For example, if the pin is pin 10,
open a HALmeter for each port on pin 10. When you turn the encoder, one
of the HALmeters should wiggle with 0 and 1.

> no luck.  I then turned off the machine and plugged the parallel cable
> into the lower port and went through the same iterations as above,
> with the same results.
> 
> When I first started this adventure I was following the instructions here:
> 
> http://ubuntuforums.org/showthread.php?t=1233589
> 
> and I issued these commands
> $ sudo modprobe parport_pc io=0xa400

I believe parport_pc is a generic Linux driver that sets up a standard
configuration for parallel drivers, such as for printers, tape drives,
and such. I think newer EMC2 versions can use this module and allows you
to loadrt using lpt0 or lpt1 instead of 0x0378 and such. Earlier EMC2
versions needed to have parport_pc unloaded.

> $ sudo modprobe lp

This is another generic Linux module for running printers. If you don't
have a printer on your PC, don't load it because it will or may assign
one or more parallel ports to printers and make them unavailable to
EMC2. You shouldn't need to modprobe anything to get EMC2 to use
parallel ports using hex register addresses.
> 
> $ sudo /etc/init.d/cups restart

CUPS is a frame work for running printers after parport_pc and lp have
sorted out the lower level stuff and has nothing to do with EMC2.

> so thinking that may have made the parallel port unobtainable I went into
> 
> $ sudo nano /etc/modules
> 
> and commented out the two lines that had been added.
> 
> I then restarted the machine and went through the above iteration of
> port addresses a second time.
> 
> All to no avail.
... snip

If the addf's are missing, the above should get you closer to a fix. I
would start with a copy of the generic stepper configuration when
prompted at EMC2's startup, along with the MPG connected to one of the
add-on ports. EMC2 will copy the example files to a new directory which
is configured to connect some step/dir signals to the 0x0378 port, and
little else. After exiting EMC2, you can add to the new .hal file,
maybe, two addresses 0xA000 and 0x9400 to the 'loadrt hal_parport
cfg="0x0378"' command line, and  lines "addf parport.1.read
thread_name", "addf parport.2.read thread_name", "addf parport.1.write
thread_name", "addf parport.1.write thread_name". Restart EMC2, bring up
HALmeters for pins on parport.1 or parport.2 that could be connected to
the encoder inputs, then see which meter moves with turning the MPG.

If I haven't forgotten something critical, this might actually work.

-- 
Kirk Wallace
http://www.wallacecompany.com/machine_shop/
http://www.wallacecompany.com/E45/index.html
California, USA


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to