' Macropump developed for Peach Hill MPG Set/Now Pickmere' Revised 1-7-2017	/2/11/17'Rewritted & modified for Pickmere lane Flat bed Router' Based on Hofmann MODIO Panel' Objective to give Remote Pendant based, Axis, Step, Feed Over ride, Via Analogue inputs 1,2 &3' Step and Direction from Mechanical MPG Using I/P 6 &7' In addition Digital I/Ps for E-Stop,Digital Dig 0 normally closed push button' Digital 1 & 2 via center off 3 pos switch  Jog On/Off, and Shuttle Off/On' Jog mode thru Analog In 1' Jog step val thru Analog In 2' Jog speed over ride thru Analog In 3' E-Stop via Port 0 Pin 0 no Software required' Jog On/Off using Dig 1'	If IsActive ( 19 ) Then '		DoOEMButton ( 103 ) 'Set Jog to On'Else	'	DoOEMButton (103 ) 'Set Jog to Off'	End If' Shuttle On/Off Using Dig 2'	If IsActive ( 20 ) Then '		DoOEMButton ( 284 ) 'Set Shuttle to Off'Else	'	DoOEMButton ( 284 ) 'Set Shuttle to On '		'	End If'	Anal 1 off/ X / Y / Z / A'  Sw DC Volt   0 / 1 / 2 / 3 / 4 '	        0 /255/512/767/1024'		   127/382/512/767/>850Option ExplicitDim Display As StringDim SVal As StringDim iCount As IntegerDim iBase As IntegerDim strMode (6) As StringDim SwR1 As IntegerDim Swr2 As IntegerDim MPGAxis As IntegerDim State As IntegerDim JOGInc As IntegerDim fro As Integer'Set MPGAxis		MPGAxis = Getinput ( 64 ) 'analog input 1 on ModIO		setUserDRO 1241, MPGAxisSelect Case MPGAxisCase <127	DoOEMButton (103 ) 'Set Jog to Off	'Do Nothing	'End If	State = 0	SwR1 = 0		Case <382'	DoOEMButton ( 284 ) 'Set Shuttle to On	If GetOEMLED ( 57 ) = 0 Then 'If not set to MPG Jog Mode		DoOEMButton ( 327 ) 'Set jog to MPG	End If	If GetOEMLED ( 59 ) = 0 Then'If not set to MPG Jog Mode		DoOEMButton ( 185 ) 'Set MPG to Jog X	End If	State = 3	SwR1 = 3	Case <512	If GetOEMLED ( 57 ) = 0 Then 'If not set to MPG Jog Mode		DoOEMButton ( 327 ) 'Set jog to MPG	End If	If GetOEMLED ( 60 ) = 0 Then'If not set to MPG Jog Mode		DoOEMButton ( 186 ) 'Set MPG to Jog Y	End If	State = 4	SwR1 = 4Case <767	If GetOEMLED ( 57 ) = 0 Then 'If not set to MPG Jog Mode		DoOEMButton ( 327 ) 'Set jog to MPG	End If	If GetOEMLED ( 61 ) = 0 Then		DoOEMButton ( 187 ) 'Set MPG to Jog Z	End If	State = 5Case <1024	If GetOEMLED ( 57 ) = 0 Then 'If not set to MPG Jog Mode		DoOEMButton ( 327 ) 'Set jog to MPG	End If	If GetOEMLED ( 62 ) = 0 Then		DoOEMButton ( 188 ) 'Set MPG to Jog A	End If	State = 6End Select  '' Logic for setting Jog Ammounts thru Analog In 2'	Anal 2  0 /  0.01 / 0.1 / 1.0 / 10'  Sw DC Volt   0 /  0.5  / 0.9 / 1.3 / 1.8 '	            0 /  102  / 184 / 266 / 369'		          51/   143  / 225  /327 JOGInc = Getinput ( 65 ) 'analog input 2 on ModIO	setUserDRO 1242, JOGIncSelect Case JOGIncCase <55	If GetOEMLED ( 57 ) <> 0 Then 'If is set Jog Step SW1		DoOEMButton ( 265 ) 'Set Step to 10mm		Swr2 = 10	End IfCase <150	If GetOEMLED ( 57 ) <> 0 Then 'If is set Jog Step SW2		DoOEMButton ( 266 ) 'Set Step to 1mm		Swr2 = 1	End IfCase <220	If GetOEMLED ( 57 ) <> 0 Then 'If is set Jog Step SW3		DoOEMButton ( 267 ) 'Set Step to 0.1mm		Swr2 = 0.1	End IfCase <320	If GetOEMLED ( 57 ) <> 0 Then 'If is set Jog Step SW4		DoOEMButton ( 268 ) 'Set Step to 0.01mm		Swr2 = 0.01	End IfCase >340	If GetOEMLED ( 57 ) <> 0 Then 'If is set Jog Step SW5		DoOEMButton ( 269 ) 'Set Step to 0.01mm		Swr2 = 0.001	End IfEnd Select  ' Setting Feedrate Over rate from Analogue 3Const Input3Sig = 18fro = GetInput ( 66 )fro = (fro * 195.0)/1024.0SetDRO 21 , FRO+5'Rem DRO display On ModIO'Const slave = 6 ' Default configConst NoAxesToDisplay = 4If GetLED (1) Then strMode (0) = " inch" Else strMode (0) = "    mm" 'Added extra space              If getOEMLED (16) Then strMode (1) ="  Program " Else strMode (1)  =" SwR1 " 'coord sys Extra SpaceIf GetOEMLED (83) Then strMode (2) ="   		   " Else strMode (2) = " SwR2  "If GetLED (0) Then strMode (3) = " EStoP  " Else strMode (3) = " RUN  "strMode (4) = "     "strMode (5) = "     " Display =""For iCount = 0 To NoAxesToDisplay - 1	SVal = Right ("    " & Format (GetDro (iCount), "+0.0000;-0.0000"), 11)	If iCount < 3 Then 'X, Y, D		iBase = Asc ("X")	Else 'A, B, C		iBase = Asc ("A") -3	End If	Display = Display & " " & Chr (iBase + iCount) & SVal & " " & StrMode (iCount)Next iCountSetModIOString (slave, 0, 0, Display)                     