Re: [Emc-users] Parport questions

2010-10-05 Thread Mike Cinquino
Kirk,

I got the bash script working just in time to move on to using classic
ladder... :) It turned out to be the parport.1.pin-2-out vs
parport.1.pin-02-out 02 fixed it.

I got a ladder program in but not working yet. I am not sure what is going
on. I think it is something I am missing in the hal file. I am able to get
my I/O pins assigned but I am having a weird result. If I go into hal meter
I can locate the pins and in the case of the iocontrol.0.tool-prep-number =
classicladder.0.s32in-00  I am able to view the data change on both when I
issue a T gcode as I expected.  I am not having any luck getting the watch
window to work however in CL. I believe I should be seeing the integer on
%IW0 but when I enter that in the watch window I get nothing... I am
thinking I have something wrong in in my assignment. I had to break away
from it for a while and I won't be able to look at it again until this
evening. I will let you know how I make out.

The wsum method you described looks clean and to the point. I was originally
hoping that was possible but did not see the wsum I will probably give that
a try as well.

Thanks again for all your help,

Mike
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


[Emc-users] Parport questions

2010-10-04 Thread Mike Cinquino
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..

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?

loadrt hal_parport cfg= 0 1 2 . or is it the order seen in the results
of the lspci -v .
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.

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.

What am I missing?

Thanks,
Mike
--
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


Re: [Emc-users] Parport questions

2010-10-04 Thread Stephen Wille Padnos
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, 

Re: [Emc-users] Parport questions

2010-10-04 Thread Mike Cinquino
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 

Re: [Emc-users] Parport questions

2010-10-04 Thread Kirk Wallace
On Mon, 2010-10-04 at 12:18 -0400, Mike Cinquino wrote:
... snip
 Is there a specific link to info on tool changes in HAL?
 
 Thanks,
 
 Mike

Just in case it might be helpful, here is what I have done with my lathe
turret using a custom comp:
http://www.wallacecompany.com/cnc_lathe/HNC/emc2/ 

The comp needs to get a Park sensor feature as well as some time-outs
added for each state, but it there is enough here to make my turret
function.

If you already know the Ladder language, that may be the way to go.
Either way, you end up with HAL pins for invoking your tool changer and
then signaling that your changer finished. Just connect these in
your .hal file.
-- 
Kirk Wallace
http://www.wallacecompany.com/machine_shop/
http://www.wallacecompany.com/E45/index.html
California, USA


--
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


Re: [Emc-users] Parport questions

2010-10-04 Thread Mike Cinquino
Kirk,

Thanks, I a am now leaning toward classic ladder. I know ladder logic
so it should be my quickest path to getting something working. My
understanding is fuzzy on how to get a T? command to cause a bit or
bits to react in classic ladder but once I have that mastered I should
be set. I have been doing a lot of reading and going back and forth
with different options and it's starting to get a little overwhelming.
EMC is very powerful and flexible but there is a lot to learn.

So it looks like I could use halui.tool.number or
iocontrol.0.tool-number to give me the correct tool number.

It also looks like when M6 is run iocontrol.0.tool-change is set high
until iocontrol.0.tool-change is driven high?

My hal file will have this added to it.

net tool-prepare-loopback iocontrol.0.tool-prepare =
iocontrol.0.tool-prepared (not sure what this does exactly)

net tool-change-start iocontrol.0.tool-change = parport.1.pin-?-out
(to send a signal to arduino to start cycle gets turned on when M6 is
executed)

System is paused at M6 untilbelow

net tool-change-done parport.1.pin-?-in = iocontrol.0.tool-changed
(to send signal from arduino to emc that cycle is complete) EMC
continues

net tnum-current iocontrol.0.tool-number = classicladder.0.s32in-00
(Ladder will get tool number from this)

My ladder will look something like this:

--[compare %IWO = 1]---(%Q1)-  N.O. Coil linked to
parport pin

 |-(/%Q2)- N.C. Coil linked to
parport pin

 |-(/%Q3)- N.C. Could linked
to parport pin


--[compare %IWO = 2]---(%/Q1)-  N.C. Coil linked
to parport pin

 |-(%Q2)- N.O. Coil linked to
parport pin

 |-(/%Q3)- N.C. Could linked
to parport pin


etc...


Does this make sense?


Thanks,

Mike


On Mon, 2010-10-04 at 12:18 -0400, Mike Cinquino wrote:
... snip
 Is there a specific link to info on tool changes in HAL?

 Thanks,

 Mike

Just in case it might be helpful, here is what I have done with my lathe
turret using a custom comp:http://www.wallacecompany.com/cnc_lathe/HNC/emc2/

The comp needs to get a Park sensor feature as well as some time-outs
added for each state, but it there is enough here to make my turret
function.

If you already know the Ladder language, that may be the way to go.
Either way, you end up with HAL pins for invoking your tool changer and
then signaling that your changer finished. Just connect these in
your .hal file.
-- 
Kirk 
Wallacehttp://www.wallacecompany.com/machine_shop/http://www.wallacecompany.com/E45/index.html
California, USA
--
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


Re: [Emc-users] Parport questions

2010-10-04 Thread Kirk Wallace
On Mon, 2010-10-04 at 17:11 -0400, Mike Cinquino wrote:
 Kirk,
 
 Thanks, I a am now leaning toward classic ladder. I know ladder logic
 so it should be my quickest path to getting something working. My
 understanding is fuzzy on how to get a T? command to cause a bit or
 bits to react in classic ladder but once I have that mastered I should
 be set. I have been doing a lot of reading and going back and forth
 with different options and it's starting to get a little overwhelming.
 EMC is very powerful and flexible but there is a lot to learn.

(My memory is a little foggy, so verify what follows)
The T g-code word invokes a tool-prepare signal. The default setup just
loops that back to tool-prepared in the .hal file:

net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared


If you need to do something before the tool change, just break this loop
and insert connections to the Classic Ladder pins you created for your
tool changer. This allows you to prep your carousel or similar device
while still doing some machining.  My lathe turret cannot change
position during machining, so I leave the prepare loop connected. My
mill carousel needs to stay in position because the old tool needs to go
back into the empty pocket it came from, so again I left the prepare
loop connected. So if you need to prepare a tool before the change, do
it in this loop and when a T word shows up in your g-code the carousel
or whatever you have will shift to the new tool. More than one T word
may do more than one prepare.

When EMC2 gets to an M6, then the change loop comes into play:

net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed


For my lathe turret, I break this loop and connect my turret.comp pins

linkpp iocontrol.0.tool-change turret.0.position-change
linkpp turret.0.position-changed iocontrol.0.tool-changed


turret.0.position-change tells my turret to start doing its thing. EMC2
will be in a tool change state with axes motion and spindle stopped
until iocontrol.0.tool-changed goes high. In my turret comp, I don't set
turret.0.position-changed until the tool pocket encoder and the
requested tool match. If I forget to connect compressed air to the lathe
(for the turret and the collet closer) the turret won't rotate so the
pocket never matches so EMC2 stays in this state until I intervene (hook
up the air line or e-stop). That is why I need to add some time-outs
and a turret park check to my .comp file.

This passes EMC2's tool requested to my comp:

newsig TurretRequestedPosition s32
linksp TurretRequestedPosition iocontrol.0.tool-prep-number
linksp TurretRequestedPosition turret.0.position-requested


This is the old .hal form, I should probably use:

net TurretRequestedPosition iocontrol.0.tool-prep-number
turret.0.position-requested


 So it looks like I could use halui.tool.number or
 iocontrol.0.tool-number to give me the correct tool number.

Something like:

net MyChangerPocketRequested iocontrol.0.tool-prep-number
MyClassicLadderChangeMacro.0.MyPocketRequestedInput


Your Ladder routine will then have the requested tool number on the
MyClassicLadderChangeMacro.0.MyPocketRequestedInput pin.

 It also looks like when M6 is run iocontrol.0.tool-change is set high
 until iocontrol.0.tool-change is driven high?

Correction: iocontrol.0.tool-changed (note the ed), which is
supplied by your Ladder macro.

 My hal file will have this added to it.
 
 net tool-prepare-loopback iocontrol.0.tool-prepare =
 iocontrol.0.tool-prepared (not sure what this does exactly)

Basically bypasses the T word by setting prepared equal to prepare,
but you still have the pocket number on iocontrol.0.tool-prep-number
for later when M6 comes along.

 net tool-change-start iocontrol.0.tool-change = parport.1.pin-?-out
 (to send a signal to arduino to start cycle gets turned on when M6 is
 executed)
 
 System is paused at M6 untilbelow
 
 net tool-change-done parport.1.pin-?-in = iocontrol.0.tool-changed
 (to send signal from arduino to emc that cycle is complete) EMC
 continues

Seems reasonable, but if the Arduino is going to handle the change
logic, you don't need a .comp or ClassicLadder, just the two lines above
and pass the pocket number.

 net tnum-current iocontrol.0.tool-number = classicladder.0.s32in-00
 (Ladder will get tool number from this)
 
 My ladder will look something like this:
 
 --[compare %IWO = 1]---(%Q1)-  N.O. Coil linked to
 parport pin
 
  |-(/%Q2)- N.C. Coil linked to
 parport pin
 
  |-(/%Q3)- N.C. Could linked
 to parport pin
 
 
 --[compare %IWO = 2]---(%/Q1)-  N.C. Coil linked
 to parport pin
 
  |-(%Q2)- N.O. Coil linked to
 parport pin
 
  |-(/%Q3)- N.C. Could linked
 to parport pin
 
 
 etc...
 
 
 Does this make sense?
 
 
 Thanks,
 
 Mike

I don't think you need CL