Thanks for the info, Mark. I went with the HALscope option that Andy suggested. It was pretty easy to do that way. I set up a dummy machine with step config and just connected the pic outputs to the par port.
Cheers, Bob On Fri, Mar 11, 2011 at 7:12 PM, Mark <[email protected]> wrote: > Here's a .comp file that uses comedi to access the parallel port. I created > it as a proof of concept. I think this version will work, but I have > multiple versions floating around between several computers. If HAL has > changed since 2008, you'll probably need to make some changes. > > I never tested it thoroughly - all I did was plug a resistor into the pport > and check that the input followed the output. > > As Andy points out, there isn't much point in using comedi if you only need > the parallel port. > > Mark > > component comedi_test_lpt "Test of HAL-Comedi fusion with parport"; > pin out bit lpt_err """Input from parallel port, pin 15, lpt_error."""; > //calling it lpt_error to avoid confusion > pin in bit lpt_data0 """Output to parallel port, pin 2, data0."""; > function _ nofp; > license "GPL"; > option singleton yes; > option extra_setup yes; > option extra_cleanup yes; > ;; > > /******************************************************************* > *** NOTE: > *** You must add a symlink named comedi in emc2/include > *** pointing to wherever the comedi *module headers* are > *** so that the include statement below will work. > *** > *** comedi's headers for modules are one directory deeper > *** than the normal headers, which include things that > *** can't be used in the kernel. > *** > ********************************************************************/ > #include <comedi/comedilib.h> > comedi_t* ComediDev = NULL; > const char* ComediDevPath; > > FUNCTION(_) { > uint lerr = 0; > comedi_dio_write(ComediDev,0,0,lpt_data0); > comedi_dio_read(ComediDev,1,0,&lerr); > lpt_err = lerr; > } > > EXTRA_SETUP() { > ComediDevPath = "/dev/comedi0"; > ComediDev = comedi_open(ComediDevPath); > if (ComediDev == NULL) > { > rtapi_print_msg(RTAPI_MSG_ERR, "COMEDI: error - could not > open device specified."); > rtapi_app_exit(); > return (-1); > } > //TODO: should check subdevice type here... > //TODO: should check that channel number is in range here... > return(0); > } > > EXTRA_CLEANUP() { > if (ComediDev == NULL) { } //avoid an Oops by not doing > comedi_close(NULL) - %$^$@$%#! > else if (comedi_close(ComediDev) < 0) > rtapi_print_msg(RTAPI_MSG_ERR, "COMEDI: error - can't close > comedi device!"); > } > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > Emc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-users > ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
