Steve,

Thanks for your response. I am not getting copies of my posts or the
responses in my email so I cut and pasted into a new email. I made
some changes to my settings so hopefully I will start to get reply's.

I was not aware of comp! I just took a look at it and it looks good. I
will give that a try. I would love for the system to work from a T?
command. Also good point on the 02 vs the 2. I will try that as soon
as I get in front of my machine.

Is there a specific link to info on tool changes in HAL?

Thanks,

Mike


Mike Cinquino wrote:
> Hello,
>
> I have had no luck getting a C executable to run from a M101 - M199 command
> so I have decided to take a different approach. I think that approach will
> be problematic with the need for root to get access to the port anyway and
> that may be causing the problem I am having. My goal is to apply a signal to
> pins 2, 3, and 4 of an additional parallel port. I am thinking a bash script
> with the appropriate pins turned high or low would do it..
>
Why not use the parallel port in HAL, and just output the bits as HAL pins?

I don't think there's a binary->BCD converter component, but it should
be very easy to write one (use comp, it's a lot easier).  It may also be
possible to do it entirely with classicladder.  If you need a strobe
signal to the Arduino, that can also be done with classicladder or HAL
components.

That would also eliminate the need to make custom G-code that has the
M1xx commands for every tool change - T6M1 would "just work".

Take a look at how tool changes are done in HAL, you may find it a lot
easier to use than custom M codes.
> So I found the parallel port tester .hal file from the wiki
> http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Parallel_Port_Tester
>
> I installed it and picked the appropriate port. (I actually have 3 ports
> total, 1 port is controlling the milling machine 0x0B800, and the other 2
> ports are 0x378 and 0x0B000)
>
> I have verified that each of these ports work with the Parallel Port Tester
> program and I get the expected results.
>
> I can not get my bash script to execute correctly from calling a M102 as an
> example.
>
> This is my bash script:
>
> #!/bin/sh
>
> # M101 in your G code program will run the Linux commands in this
> # shell script "batch" file, passing the P and Q variables as command
> # line arguments.
>
> # give the command line arguments descriptive names
> P=$1
> Q=$2
>
> halcmd setp parport.1.pin-2-out True
>
> echo "M101 P$P Q$Q: put your code here"
>
> exit 0
> ******************************************************************************************************************************************************
> I have modified my .hal file to this:
>
> # Generated by stepconf at Sat Sep 11 14:26:27 2010
> # If you make changes to this file, they will be
> # overwritten when you run stepconf again
> loadrt trivkins
> loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD
> servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
> loadrt probe_parport
> loadrt hal_parport cfg="0x0B800 0x0B000"
> setp parport.0.reset-time 3500
> loadrt stepgen step_type=0,0,0
> loadrt abs count=1
> addf parport.1.read base-thread
> addf parport.1.write base-thread
>
> setp parport.1.pin-2-out TRUE
>
> addf parport.0.read base-thread
> addf stepgen.make-pulses base-thread
> addf parport.0.write base-thread
> addf parport.0.reset base-thread
> ***********************************************************************************************************************************************************************************************
>
> I have played with the order of my port placement in line : loadrt
> hal_parport cfg="0x0B800 0x0B000" changing the order of the port call out?
>
> So one question I have that I could not find in any of the reading I did is
> does the the order of the port in this command dictate the parport number?
>
> So is this the case?
>
Yes.  Parport.0 will be the first one you give the address (or number)
for, parport.1 will be next, etc.
> loadrt hal_parport cfg=" 0 1 2 ....." or is it the order seen in the results
> of the lspci -v .
>
Using numbers below 16 will depend on the order the kernel finds the
ports.  You should be able to do cfg="2 0 1" to make the third Linux
port parport.0, the first parport.1, and the second parport.2.  I
haven't tried this though.
> I think I know the answer to this because my original configuration used
> port 0x0B800 and it was set to parport.0.
> So I am assuming that based on my .hal file parport.0 is 0x0B800 and
> parport.1 is 0x0B000. I am also assuming these ports are "out" type because
> that is said to be the default.
>
> You will note that I have added a line "setp parport.1.pin-2-out TRUE" to my
> .hal file. This is basically the same command I am trying to run from the
> M102 code. I figured adding it here would require less steps in testing. I
> get the same error in either case.
>
> This is my error:
>
> parameter or pin 'parport.1.pin-2-out' not found.
>
Try parport.1.pin-02-out instead.  Looking at the driver source, it
appears to always format the numbers with two digits.

You could have seen this by using halcmd or halshow to see what pins are
available.  (like "halcmd show pin parport.1")
> I get this error when I attempt to start EMC with the "setp
> parport.1.pin-2-out TRUE" in my .hal file as shown above or when I remove
> the line from the .hal file, launch EMC, then go to a terminal and execute
> the bash script manually. When I attempt to run the bash file from the M101
> I get no error and no result.
>
You get no error because there is no place for you to see an error
generated by an M1xx command.  You get no result because the name of the
pin is wrong, as detailed above.

- Steve
------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to