PLC How to read Cycle Start Bit.

More
13 Oct 2011 02:48 #13878 by Donny_NJ
PLC How to read Cycle Start Bit from the PLC.
The E-Stop Tag was configed with stepconfig, I see it in Hal file, got that part ok.
I found the (task_mode) word (Auto or Manual) in hall scope tester.
do i map it to a bit in the PLC like (b1) to read / wright the state?

When the operator select R from the keyboard to run the program, Im looking for the PLC to send a modbus command out
to a remote device. and if the remote device has completed it task, it will allow the operator to select (R) to Cycle start.

I have the modbus talking with the remote, from a digital input on LPT port. IT set bit B5 High (ON) if it ok) or turns B5 low (off) if not OK.

I would just like to know how to read / wright the state of internal Bit / word

Thanks Donny

Please Log in or Create an account to join the conversation.

More
13 Oct 2011 05:13 #13881 by cmorley
I assume when you say PLC you mean classicladder.
%B1 would be an internal memory bit (so no not that one)
%I1 is an external input bit so that's what you want.

I don't think there is a way to trap the R keystroke.
I again assume your using AXIS ?

Please Log in or Create an account to join the conversation.

More
14 Oct 2011 01:10 #13901 by Donny_NJ
you are correct classicladder & AXIS

real input to classicladder %I1

I used stepconf generated config file as the basic set up file.
& added custom.hal file. loadusr halui -ini /root1/EMC2/mymill/inifile.ini

in classicladder
Symbol Name Section
Variable Symbol name Hal Signal/Comment
%I1 EXT-E =>estop-ext This is the connection / link to Hal ?

I'm thinking something like this. gui_halui
linuxcnc.org/docs/html/gui_halui.html#sec:HaluiIntroduction
1.2.14 Mode

# halui.mode.auto (bit, in) - pin for requesting auto mode
# halui.mode.is-auto (bit, out) - indicates auto mode is on

how can I connect to classicladder to # halui.mode.auto (bit, in) & # halui.mode.is-auto (bit, out)
in My-mill.hal I see the this
# **** Setup for external estop ladder program -START ****
net estop-out => classicladder.0.in-00
net estop-ext => classicladder.0.in-01
net estop-strobe classicladder.0.in-02 <= iocontrol.0.user-request-enable
net estop-outcl classicladder.0.out-00 => iocontrol.0.emc-enable-in

Can I use the Hali interface hooks to connect to classicladder ? and how can i do this?

or is there a global tag_name or master list that I reference, I just can't find it.


thanks for your help Donny.

Please Log in or Create an account to join the conversation.

More
14 Oct 2011 03:21 #13904 by Donny_NJ
I think I found it how to get to pins. www.linuxcnc.org/docs/2.5/html/hal/halui_examples.html

Halui Examples
Table of Contents
1. Remote Start
2. Pause & Resume

For any Halui examples to work you need to add the following line to the \[HAL\] section of the ini file.

HALUI = halui
1. Remote Start

To connect a remote program start button to EMC you use the halui.program.run pin and the halui.mode.auto pin. You have to insure that it is OK to run first by using the halui.mode.is-auto pin. You do this with an and2 component. The following figure shows how this is done. When the Remote Run Button is pressed it is connected to both halui.mode.auto and and2.0.in0. If it is OK for auto mode the pin halui.mode.is-auto will be on. If both the inputs to the and2.0 component are on the and2.0.out will be on and this will start the program.
Remote Start Example

image::images/remote-start.png

The hal commands needed to accomplish the above are:

net program-start-btn halui.mode.auto and2.0.in0 <= <your input pin>
net program-run-ok and2.0.in1 <= halui.mode.is-auto
net remote-program-run halui.program.run <= and2.0.out

Notice on line one that there are two reader pins, this can also be split up to two lines like this:

net program-start-btn halui.mode.auto <= <your input pin>
net program-start-btn and2.0.in0

2. Pause & Resume

This example was developed to allow EMC2 to move a rotary axis on a signal from an external machine. The coordination between the two systems will be provided by two Halui components:

*

halui.program.is-paused
*

halui.program.resume

In your customized hal file, add the following two lines that will be connected to your I/O to turn on the program pause or to resume when the external system wants EMC2 to continue.

net ispaused halui.program.is paused => "your output pin"
net resume halui.program.resume <= "your input pin"

Your input and output pins are connected to the pins wired to the other controller. They may be parallel port pins or any other I/O pins that you have access to.

This system works in the following way. When an M0 is encountered in your G-code, the halui.program.is-paused signal goes true. This turns on your output pin so that the external controller knows that EMC2 is paused.

To resume the EMC2 gcode program, when the external controller is ready it will make its output true. This will signal EMC2 that it should resume executing Gcode.

Difficulties in timing

*

The "resume" input return signal should not be longer than the time required to get the g-code running again.
*

The "is-paused" output should no longer be active by the time the "resume" signal ends.

These timing problems could be avoided by using ClassicLadder to activate the "is-paused" output via a monostable timer to deliver one narrow output pulse. The "resume" pulse could also be received via a monostable timer.

Please Log in or Create an account to join the conversation.

Time to create page: 0.125 seconds
Powered by Kunena Forum