[D
	/LoadSW [P
		[A LoadFlag ]	% LoadFlag = False -> Check only if Files are existing 	
		
		/Result #1 def
		/MissingFile '' def	
		
		/SWFile FilePath IntfSel.IntfDir add '\' add IntfSel.IntfSWFileName add IntftypeExt add def
		/SWFile SWFile '_V' add IntfSel.IntfSWVersion cvs add 'S' add IntfSel.IntfSWSubVersion cvs add def 
		IntfSel.IntfSWBetaInfo '' ne [B
			/SWFile SWFile '_' add IntfSel.IntfSWBetaInfo add def
		] if
		/SWFile SWFile '.HX3' add def
		
		
		/TreeFile FilePath IntfSel.IntfDir add '\' add IntfSel.IntfTreeFileName add IntftypeExt add def
		/TreeFile TreeFile '_V' add IntfSel.IntfTreeVersion cvs add 'S' add IntfSel.IntfTreeSubVersion cvs add def 
		MCTreeBetaInfo '' ne [B
			/TreeFile TreeFile '_' add IntfSel.IntfTreeBetaInfo add def
		] if
		/TreeFile TreeFile '.HX2' add def
		
		/DefaultParFile FilePath IntfSel.IntfDir add '\' add IntfSel.IntfTreeFileName add IntftypeExt add def
		/DefaultParFile DefaultParFile '_V' add IntfSel.IntfTreeVersion cvs add 'S' add IntfSel.IntfTreeSubVersion cvs add def 
		IntfSel.IntfTreeBetaInfo '' ne [B
			/DefaultParFile DefaultParFile '_' add IntfSel.IntfTreeBetaInfo add def
		] if
		/DefaultParFile DefaultParFile '.GR3' add def
		
		% check if files are existing
		Result [B
			SWFile FileExist not [B
				/Result #0 def 
				/MissingFile SWFile def
			] if
		] if
		Result [B
			TreeFile FileExist not [B
				/Result #0 def 
				/MissingFile TreeFile def
			] if
		] if
		Result [B
			DefaultParFile FileExist not [B
				/Result #0 def 
				/MissingFile DefaultParFile def
			] if
		] if
		Result [B
			IntfSel /IntfSpecificSetup known [B
				/ECSetupName IntfSel.IntfSpecificSetup def		    
				#0 'IntfLoader:' ECSetupName add cvn exec			    
				/MissingFile exch def
				/Result exch def
			] if
		] if
		
		
		Result LoadFlag and [B
			'Erasing interface firmware sector...' log     
			3 TalkIntf.ClearInstanceAll
			'Downloading interface software...' log
			SWFile dup loadobj exch PackInst:DownloadHX3File
			'Downloading interface parameter tree...' log     		
			TreeFile dup loadobj exch PackInst:DownloadHX2File		
			'Updating UPID list...' log
			TalkIntf.UpdateUPIDList       
			'Downloading interface default parameters...' log
			DefaultParFile dup loadobj exch PackInst:DownloadGR3File
			IntfSel /IntfSpecificSetup known [B				
				'Interface specific setup...' log
				LoadFlag 'IntfLoader:' ECSetupName add cvn exec
			] if
		] if
		[A /MissingFile /Result]
	]
	
	/EtherCATSetup [P
		[A /LoadFlag ]
		/Result #1 def
		/MissingFile '' def
		/ModuleParFile FilePath IntfSel.IntfDir add IntfSel.IntfModulePar add def
		ModuleParFile FileExist not [B
			/Result #0 def 
			/MissingFile ModuleParFile def			    
		] if 
		LoadFlag [B
			/ModuleType  $A3000000 ReadMemory def            
			ModuleType $10 eq [B
				'Downloading module parameter...' log     		
				ModuleParFile dup loadobj exch PackInst:DownloadHX2File	
				/Value $A200068E ReadMemory def
				$A400001C Value WriteWordToElo
				/Value $A200068C ReadMemory def
				$A400001E Value WriteWordToElo			
			]
			[B
				'Warning: EtherCAT module is not connected!' log
			] ifelse  
		] if
		[A /Result /MissingFile] 
	]
	
	/POWERLINKSetup [P
		[A /LoadFlag ]
		  /Result #1 def
		  /MissingFile '' def
		  /ModuleParFile FilePath IntfSel.IntfDir add IntfSel.IntfModulePar add def
				ModuleParFile FileExist not [B
			  /Result #0 def 
				/MissingFile ModuleParFile def			    
				] if 
				LoadFlag [B
					/ModuleType  $A3000000 ReadMemory def            
					ModuleType $40 eq [B
						'Programming FPGA...' log     	
						/JTAG_START_EXECUTION $A5A5 def
						/JTAG_Execute $C0000200 def
						JTAG_Execute JTAG_START_EXECUTION WriteWordToElo						
						ModuleParFile dup loadobj exch PackInst:DownloadHX2File	
					]
					[B
					  'Warning: POWERLINK module is not connected!' log
					] ifelse  
				] if
		[A /Result /MissingFile] 
  ]
	
	
	
]