Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: HillBilly on January 05, 2007, 04:32:33 PM
-
I am trying to interface some panel indicators. I thought I had it with this line running in the macropump:
If GetLED (4) Then ActivateSignal (OUTPUT10) Else DeActivateSignal (OUTPUT10) 'Cycle Start
So I added more like this:
If GetLED (4) Then ActivateSignal (OUTPUT10) Else DeActivateSignal (OUTPUT10) 'Cycle Start
If GetLED (5) Then ActivateSignal (OUTPUT11) Else DeActivateSignal (OUTPUT11) 'Feed Hold
If GetLED (57) Then ActivateSignal (OUTPUT12) Else DeActivateSignal(OUTPUT12) 'MPG
The fist line is the only one that works. I must be missing something, or is there a better way of doing this?
Darek
-
I think you may need some End IF statements. Try
If GetLED (4) Then 'Cycle Start
ActivateSignal (OUTPUT10)
Else
DeActivateSignal (OUTPUT10)
End If
If GetLED (5) Then 'Feed Hold
ActivateSignal (OUTPUT11)
Else
DeActivateSignal (OUTPUT11)
End If
As you have it your second line only gets executed if the first ELSE is true.
-
I thought the format was: GetOEMLed()
not GetLed()
-
You are right, I was looking at the IF...THEN.... END IF problem, I didnt look at the GetLED
-
Thanks neighbor (poppabear),
GetOEMLED(57) took care of the MPG indicator. Still working on getting feedhold to output.
Darek
-
'Hey Hillbilly,
'No, problem.
'On your feedhold, I did something like this with my macro pump (signal coming in off of a PLC),
'I dropped a UserLED on the screen also a counter DRO on a back screen:
'Macropump
x=GetUserDRO(1002) 'x starts at 0
If IsActive(INPUT4) Then 'your trigger input
SetUserLED(1002,1) 'turns on your panel feed hold active led
SetUserDRO(1002,1) 'sets DRO 1002 to 1
Else
SetUserLED(1002,0) 'when input off resets LED, and DRO to 0
SetUserDRO(1002,0)
End If
'BOTH these conditions (below), need to be true for your feed hold to push.
'This is so the Macro pump will not continue to "Push" the feed hold button each time it runs (10/sec).
If GetUserLED(1002) And X=0 Then
DoOEMButton(1001) 'Feed hold
End If
'It is kinda indirect, but it keep the macro pump from continuing to mash the feed hold.
-
I will have to digest that through the single stepper ( VB script editor.). I am still working on getting my VB legs. So far I have basically been borrowing code.
After looking over the default screens I noticed there is not a feedhold LED implimented.
Darek