Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: rcaffin on June 05, 2015, 10:58:22 PM

Title: Difference between Enable Pins and Output Pins?
Post by: rcaffin on June 05, 2015, 10:58:22 PM
Hi all

I am trying to put some safety interlocks into my system, which combines lathe and mill. Without some interlocks, eStop in mill mode briefly spins the lathe chuck - that can be a bit too exciting.

So my idea was to use Enable #1 to activate a relay between the spindle PS and the mill spindle, and to use Enable #2 to connect spindle PS and lathe chuck. There is a HARDWARE interlock preventing both from being activated together. That interlock works.

But what has me seriously confused is that it seems that Enable1 - 4 ALL activate when I hit Reset: the red LEDS on the diagnostic panel all turn on in sequence. That happens regardless of whether they are meant to be Active Hi or Lo. I can then DeActivateSignal(Enable1) and so on of course. However, Enable5 and Enable6 do not do this. I have not been able to figure out the difference yet.

Question: are these enables MEANT to go active on Reset? If so, they are obviously not what I want. I will have to use Output#1 etc instead.
I cannot find anything in the manuals about how either the Enable pins or the Output pins work or differ.

The alternative, of using the inversion of the Enable pins, is not good: that would enable things when eStop happens. Oops!

Cheers
Roger
Title: Re: Difference between Enable Pins and Output Pins?
Post by: BR549 on June 05, 2015, 11:31:37 PM
The enables SHOULD be

active on NORMAL
Inactive on Estop

Are you running everything under 1 profile/screenset  or seperate profiles/screensets ?

This aught to be interesting, (;-) TP

I just tested here and they work normal, active on normal and inactive on estop.  Set as active LOW
Title: Re: Difference between Enable Pins and Output Pins?
Post by: rcaffin on June 06, 2015, 12:04:29 AM
Hi Terry
Quote
active on NORMAL
Inactive on Estop
Yes, I was getting around to that realisation.
I would love to know where this is spelled out in the docs though ... :-)

It is essentially a full-on 2-spindle machining centre. To switch from mill to lathe operation I kill and exit from Mach, then restart in the other mode. Given the different labels on the axes and the different spindles, anything else would be just a bit too
'interesting'.

Oh well, yet another small redesign of the interface ... What's a few gates between friends? :-)

Thanks
Roger
Title: Re: Difference between Enable Pins and Output Pins?
Post by: BR549 on June 06, 2015, 12:15:32 AM
Hiya Roger it is on Page 378 3rd paragraph down  in the learn as you go manual.

I would have thought you could do it with a seperate PAGE for each function That way all the configs are held under one roof ??

Couple of flip flop relays to transfer control of the spindles.

HUMMMM,  that gives me something to work on (;-) .

(;-)TP

Title: Re: Difference between Enable Pins and Output Pins?
Post by: rcaffin on June 06, 2015, 12:39:52 AM
Hi Terry
Quote
it is on Page 378 3rd paragraph down  in the learn as you go manual.
Ah so.
Um - I don't seem to have a copy of that manual. Maybe that explains a few things? Help? Pretty please!

Yes, one could do it all under one roof, but the machine was delivered with the standard two versions of Mach (Mill and Lathe) and I have never bothered (like, never had the time) to change that. It works ... I do not want EVER to combine the operations!

From the spindle PS the two wires go to a Reversing relay. From there the two wires go to TWO double-pole Spindle relays. One drives the mill spindle, the other drives the lathe spindle. Only ONE of these two relays can be energised at any time: hardware logic gates do the lockout. If an eStop happens, both spindle relays will drop out.

So, when I fire up one of the systems, the first instruction is a macro call to enable the appropriate spindle relay. At the same time, the Config selects the appropriate input pin for the index pulse.

That's fine, but if I run an old program withoput the macro call, the spindle does not respond to an M3. All sorts of damage can ensue. So I am enhancing the M3 and M4 macros to first check the spindle power supply is ON, then check that the spindle enable relay is ON. If either test fails, the macro does a Pause, Stop, Rewind and ends.

The spindle PS has a mag trip on the input - a touchy beast which can drop out, so I have to check that first.

So I will have to change the pin definitions from Enable to output. Eh - not hard. If there is an eStop other safeties cut in anyhow - PWM stops immediately for instance, and the Enable on the Spindle PS drops out as well.

Cheers
Roger

Title: Re: Difference between Enable Pins and Output Pins?
Post by: Peter Homann on June 06, 2015, 12:41:03 AM
Hi Roger,

Have a look in the General Config Tab. In the bottom left hand corner is a program safety input. This uses input #1. When this goes active Mach3 pauses the translation.

This my help in what you are trying to achieve?

Cheers,

Peter
Title: Re: Difference between Enable Pins and Output Pins?
Post by: rcaffin on June 06, 2015, 01:27:57 AM
Hi Peter

Yes, I knew about that use for Input #1, and had disabled it. It used to be linked to the front door ... right pain in practice, but good idea for school kids.

What I need is rather more complex. However, I can get most of what i want by changing the pin definitions. Instead of calling a pin 'Enable #1' I call it 'Output #5' (and Enable #2 => Output #6), and I don't need to even move a wire! I just have to put an opto-coupler from the spindle PS back to a BoB input.

I just need that huge 'learn as you go' manual Terry referred to. Um - I hope it exists ...

Cheers
Roger
Title: Re: Difference between Enable Pins and Output Pins?
Post by: BR549 on June 06, 2015, 12:31:23 PM
HIYA ROGER the Manual does exist but it is NOT on printed or digital form. It is the SBF format (Standard Brainwave Format). You would need a universal crainial translator implant to be able to READ it. Then a 4 year degree in my crazy thinking methods to be able to understand it.

I was not advocating running a combined machine mill/turn even though it is done that way as well by a few users.

Hiya Peter, Do you still have all the parts for the hand pendant ? Can I buy them from you ? I would REALLY love to get it finished up and on the machine. I have an new extra MODIO board here I can use if needed. I have triesd to email you in the past but no luck. I think your PC doesn't like me and dumps me in the trash can.

(;-) TP
Title: Re: Difference between Enable Pins and Output Pins?
Post by: rcaffin on June 07, 2015, 05:16:33 AM
Hi Terry

Now just lie down here while I put this totally harmless little skull cap on your head and hook it up to my data logger, and we shall see what a 1kV sinewave can elicit from all this ...

Cheers
Roger
Title: Re: Difference between Enable Pins and Output Pins?
Post by: BR549 on June 07, 2015, 12:20:17 PM
 ;D , (;-) TP
Title: Re: Difference between Enable Pins and Output Pins?
Post by: Peter Homann on June 07, 2015, 10:58:14 PM
Hiya Peter, Do you still have all the parts for the hand pendant ? Can I buy them from you ? I would REALLY love to get it finished up and on the machine. I have an new extra MODIO board here I can use if needed. I have triesd to email you in the past but no luck. I think your PC doesn't like me and dumps me in the trash can.

(;-) TP

Hi Terry,

I still have this one for you. I just can't seem to find the time to finish it. I can send it off to you if you like?

 I'll even dust it down. :)

Cheers,

Peter
Title: Re: Difference between Enable Pins and Output Pins?
Post by: BR549 on June 08, 2015, 01:18:16 AM
That would be the one (;-).

(;-) TP
Title: Re: Difference between Enable Pins and Output Pins?
Post by: Peter Homann on June 08, 2015, 01:29:21 AM
OK, I'll send it off.

Cheers,

Peter
Title: Frustration: how to read outputs?
Post by: rcaffin on June 08, 2015, 02:39:30 AM
OK, some progress. Forgive me if much of this is either obvious or well-known (or in SBF format).

The Enable#n signals are of no use to me, as they all start 'off', are all set 'on' when Mach powers up, and all go off when Mach stops. The 'all set on' bit when Mach starts is the opposite of what I want. But the Output#n signals will serve well.

I can jiggle the defined Output#n pins with ActivateSignal(Output1) and DeactivateSignal(Output1) very easily. That's good.

I can read the Input#n pins with If getOEMLED(821) then ... (for Input#1) quite happily. I haven't actually tested getOEMLED(Input1), but it does not matter. The value returned is either 0 for not-asserted or -1 for asserted, but I think these are actually Boolean values, not numeric. Again, no matter.

But what I want to do is to read IN an OUTPUT pin, to check that it has already been set. I cannot, so far.
I can issue the VB command getOEMLED(Output1) and it executes, but I really do not think it is reading the state of the Output1 pin.

Does anyone know how to read IN the state of an OUTPUT pin?
and
If I execute getOEMLED(Output1), what does it read?

Yes, of course i could jumper the Output pin to an Input pin and read it that way, but you don't get many Input pins ...

Cheers
Title: Re: Difference between Enable Pins and Output Pins?
Post by: rcaffin on June 08, 2015, 07:33:46 AM
RTFM   :D

if IsOutputActive(Output1) then
  message("Outout #1 is active")
else
  message("Output #1 is not active")
end if

Looking in the wrong place.

Cheers
Roger
Title: Re: Difference between Enable Pins and Output Pins?
Post by: BR549 on June 08, 2015, 01:57:46 PM
 :o I see you are building your OWN user manual now.  ;D

(;-) TP
Title: Re: Difference between Enable Pins and Output Pins?
Post by: rcaffin on June 08, 2015, 05:29:20 PM
Old (computing) proverb:
'By the time the documention is complete, the hardware is obsolete.'
Sigh.

Cheers
Roger

Title: Re: Difference between Enable Pins and Output Pins?
Post by: rcaffin on June 10, 2015, 07:45:59 AM
OK, time to give something back.
I was trying to make the M3 and M4 commands 'safe'. Obviously, trying to drive a not-rotating drill bit (or milling cutter) into a solid block of metal is not going to work, but might prove expensive and destructive. So first check that the system is 'live'.

What that means is that I wanted to first check the the spindle supply was active, and then to check that the spindle relay was active, before issuing the basic DoSpinCW command and expecting the spindle to spin.

The check on the spindle power supply is needed because the mains supply to it goes through a magnetic circuit breaker which can drop out during power-up. Yes, I could omit the breaker, but I don't want to. The 'spindle relay' connects the spindle supply to either the mill spindle motor or to the lathe chuck motor. Actually, there are two separate relays there: M90 actives the mill spindle, M91 activates the lathe chuck, and if you try to do both a hardware lockout prevents you. Those relays take a separate commands. It's all about safety.

So, after much hassle, my M3 command now looks like this. Note that M90 is the command which energises the mill spindle relay, via Output#5.

' First check whether Spindle PS is on - this uses optical feedback from spindle PS to Input #3
do while true
  If IsActive(Input3) Then
    exit do
  else
    Ret=MachMsg("Hit CR when powered","Spindle supply alert",1)
    If ret=2 Then
      DoOEMButton(1001)   ' Pause
      DoOEMButton(1003)   ' Stop
      DoOEMButton(1002)   ' Rewind
      end          ' Cancel pressed, so get out of here
    else
' Has hit Retry, so try again assuming PS is now powered up
    End If
  End If
Loop

' Now check whether Output5 from M90 is active
If IsOutputActive(output5) Then
  DoSpinCW
  message("Spinning")
else
  MachMsg("Aborting","M90 is Missing!   ",0)
  DoOEMButton(1001)  ' Pause
  DoOEMButton(1003)    ' Stop
  DoOEMButton(1002)    ' Rewind
end if

The first test, of the power supply, allows me to go back, switch the PS on, and retry.
The second test does kill the program if the spindle relay is not on. That means something went wrong somewhere.

The M90 macro is included in the Mill startup command string issued by the Reset button.

Hope this helps
Cheers
Roger

Title: Re: Difference between Enable Pins and Output Pins?
Post by: rcaffin on February 02, 2016, 10:42:46 PM
Unfortunately, the hardware behind macros I posted has one deficiency (that I know of), which I now have to rectify.

The selection of Mill or Lathe operation uses TWO off DPDT relays for safety reasons, instead of the original one DPDT relay. Why?
Because I had found with just one relay that an eStop while in Mill mode would drop out the Mill-select relay, which meant power was transferred to the Lathe spindle. This had been a bit too exciting for me. There are also some logic gates which should prevent both Mill and Lathe being asserted at the same time.

The reversing operation was done with a DPDT reversing relay, driven off the M4 line. That seemed fine at the time. However, if the program executed M5 while the spindle was in reverse mode, the reversing relay would drop back to FWDs, and the spindle would do an extremely fast stop as the remains of the power supply output were applied in the other direction. This seemed a bit too exciting as well.

So I have had to use the same two-off double-throw relay system for direction. M3 will activate one relay, M4 will activate the other relay, and M5 will deactivate both relays. A power resistor across the NC terminals brings the spindle to a halt, but is NOT in circuit the rest of the time.

Ah, but what if both M3 and M4 are issued? The short simple answer is a dead short across the spindle power supply, followed by a repair bill. So the macros will be expanded to check to see whether the system is in the 'other' state, and to kill that first with a short time delay to allow the mechanical world to catch up with the electric world. I will also use a logic gate lockout as was done for the Mill/Lathe selection.

But what about a wiring error? Powering both mill and lathe at once is not a calamity: one hits eStop and fixes the electronics. But the reversing section is another matter.
Instead of using a DPDT relay for each direction, I will use a 3PDT relay. The 3rd pole for the M3 relay will be in the coil circuit for the M4 relay, and vice versa. So if M3 is asserted, you can NOT assert the M4 relay as well, and vice versa.

What if you try to assert both M3 and M4 simultaneously? The system could chatter. However, the logic gates should prevent that from happening, and part of that circuit will detect a simultaneous M3+M4 assertion - and activate the eStop. Short of really gross wiring errors, that should suffice.

M5 will drop both outputs regardless of course, but it will do it in sequence. If M3 is asserted, it will first make sure M4 is NOT asserted, before it clears M3, and vice versa.

Cheers
Roger