Home
Application Note # 4414
Contents
1. 18c Goto the Galil vi Block Diagram window Connect the error out terminal of the Automation Open function to the error in terminal of the address Property Node Connect the error out terminal of the address Property Node to the error in terminal of the connection Invoke Node Connect the error out terminal of the connection Invoke Node to the error in terminal of the libraryVersion Invoke Node Connect the error out terminal of the library Version Invoke Node to the error in terminal of the command Invoke Node Connect the error out terminal of the command Invoke Node to the terminal on the error out block Connect the terminal of the Connections String block to the address terminal on the Property Node Connect the terminal of the Connected To block to the connection terminal on the connection Invoke Node Connect the terminal of the Library Version block to the libraryVersion terminal on the libraryVerion Invoke Node Connect the terminal of the MG TIME block to the command output terminal on the command Invoke Node 5 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com Galil Mis TIME Connected Ta l Connection String Library version File Edit view Project Op
2. P elg s ba c or Galil IGalil Automation Open Property Node Invoke Node n s IGalil 5 9 Drop an Invoke Node Functions Palette Connectivity ActiveX onto the Block Diagram to the right of the Invoke Node 9a Connect the reference out terminal of the last Invoke Node top right terminal mouseover will show Galil IGalil to the reference terminal of the Invoke Node The text of the Invoke Node should change to IGalil from Automation Ob Left click on the Method element of the Invoke Node and choose libraryVersion 10 Drop an Invoke Node Functions Palette Connectivity ActiveX onto the Block Diagram to the right of the Invoke Node 10a Connect the reference out terminal of the last Invoke Node top right terminal mouseover will show Galil IGalil to the reference terminal of the Invoke Node The text of the Invoke Node should change to IGalil from Automation 10b Left click on the Method element of the Invoke Node and choose command 10c Drop a String Constant Functions Palette Programming String onto the Block Diagram Em Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com 10d Insert the text MG TIME quotes removed into the String Constant 10e Connect the output of the string constant to the command input on the command Propert Node JA Galil vi Block Diagram File Edi
3. Project Windows Help ew Sg leaf ss kepico rot 5n DDMCShell p DMCCommand M Response 23 To create the above diagram use the Structures toolbar to make a While loop and wire the Run button to the loop Inside of that loop create a True False Case Wire the SEND button to it Under True create another Automation Property block Right Click on the DMCShell Container on the left hand side of the screen and select Create Local Variable Change the variable to Read and wire it into the Automation Property Node Add DMCCommand and DMCResponse properties to it Command is a Write Response is a Read Add a Timer with a 200msec delay this adds a delay to prevent the same command from being sent multiple times on a single click 24 Go to Sequence Block 2 and add another Automation Property block Select the property DMCConnect Wire a Boolean False to it as shown here dis Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com LW activeX Connect v51 vi Diagram File Edit Operate Project Windows Help cm S leat s rot Anplcation Font DmcshellLib DOMCShell A t DDMCshel p Dime connect 25 From the panel window click the Run Arrow to start the program 26 Type a valid Galil command in the Command string control and hit SEND You can change the properties of the send button t
4. Dec 09 GALIL Application Note 4414 Using LabVIEW with Galil Controllers By combining the ease of use of Galil controllers with the simplicity of programming in LabVIEW a professional looking graphical user interface can be created in minutes Galil offers three methods of interfacing to Galil controllers in LabVIEW The first one uses the latest drivers included in the GalilTools and GalilTools Lite software The second method uses the ActiveX toolkit that can be purchased from Galil It takes advantage of the ActiveX support offered in LabVIEW 5 0 or greater This package provides graphical tools to get up and running quickly saving costly programming time The last method uses direct function calls to Galil library files dmc32 dil Note The GalilTools method is the best option for new applications This application note will take the user through the basic setup of a sample VI including connecting to a Galil controller sending commands receiving responses and closing communication Part 1 deals with using the GalilTools API Part 2 1s the ActiveX toolkit while Part 3 uses the old library function calls Before you begin make sure that you have registered and communicated to the controller using the standard Galil software Table of Contents xiu Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com Part 1 Using the Gali
5. VI s through the Functions toolbox in LabVIEW then create a directory called Galil inside the C Program Files National Instruments LabVIEW USER LIB directory Then place all the VI s inside this directory and re start It should now possible to place them on the program by selecting the User Libraries button in the Functions toolbox This eliminates the need to go through the Select a VI procedure in the rest of this document Start LabVIEW and open a new VI Go to the Back Panel by selecting Window gt Show Diagram Create a Sequence located under Structures with three frames by right clicking and selecting Add Frame After Go to the first frame and click on Select a VI from the Functions toolbox Browse to the directory with the Galil VIs and select Open vi place this on the first frame of the sequence Repeat this but this now browse to Globall vi and place in the diagram Put a Digital Control on the Front panel with integer representation I8 and wire this into the Controller Global Variable Globall Leave the Return of DMCOpen vi unwired for now Go to the last 3 frame of the sequence and insert close vi onto the frame This ensures that you close the communication channel before exiting the program No wires need to be attached to this VI In the middle frame insert command vi This sub VI allows commands to be sent to the controller and receive responses On the front panel creat
6. abel This can be done with most LabVIEW blocks functions 7 Drop a Property Node Functions Palette Connectivity ActiveX onto the Block Diagram to the right of the Automation Open function 7a Connect the Automation Refnum terminal of the Automation Open funtion to the reference terminal on the Property Node The text of the Property Node should change to IGalil from Automation 7b _Left click on the Property element of the Property Node and choose address 7c Right clink on the Property element of the Property Node and choose Change to Write Si Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com 38 Galil vi Block Diagram File Edit wiew Project Operate Tools Window Help 15 e u g hoe ot Galil Ill Automation Open Property Node nm Galil 5 8 Drop an Invoke Node Functions Palette Connectivity ActiveX onto the Block Diagram to the right of the Property Node 8a Connect the reference out terminal of the Property Node top right terminal mouseover will show Galil IGalil to the reference terminal of the Invoke Node The text of the Invoke Node should change to IGalil from Automation 8b Left click on the Method element of the Invoke Node and choose connection 133 Galil vi Block Diagram kat File Edit view Project Operate Tools Window Help
7. all e OO Iai 5 n pop adgiess library version Nig TINE Connection String Ed abc Library version 5 Create a Sting Indicator on the Main panel and name it message Goto the Block Diagram right click on the terminal for the string indicator message and choose Create Refrence 6 Connect the string indicator reference to the User Parameter of REC E m Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com T3 Galil vi Block Diagram Jeg File Edit View Project Operate Tools Window Help 9 md PRI B4 Es Galil Galil Automation Open Property Made Invoke Node Invoke Node Invoke Node k B IGall DL e Gall SS Gall BL 1 4 reall P libraryversion rp MG TIME Connection String Connected To ki t bc Library Versian message aes a message 7 Right click on the VI Ref of REC choose Create Callback VI 7a Save the created VI as event onMessage vi 8 Show the Block Diagram of event onMessage vi Right click on Event Data and select Cluster Class amp Variant Palette Unbundle by Name Sa Connect the Event Data terminal to the new Unbundle by name message 13 onMessaze Event Callback event onMessage vi Block Diagram File Edit view Project Operate Tools Window Help ONES ees Event Common Data Control Ref Event Data Unbundle By Name Message a Galil Motio
8. e a String Control and label it Command Also Create a String Indicator and label it Response Create 2 STOP Buttons Label one Disconnect and the other Send cy Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com The Front Panel should look something like this Ex Starti vi m s eki kaw me DS aaa 4 On the diagram window create a while loop inside the second frame encompassing everything Select a boolean Not and wire it in line between the Disconnect button and the conditional terminal This specifies to keep the loop running until the disconnect switch is hit Next create a Case structure and wire the Send Button into the question mark Place the command vi and response inside the True case and put the Command string control outside it Wire the Command and Response strings into the appropriate terminals of the command vi Leave the False case empty Ie Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com The Diagram should look like this E 39 Application Font Text Settings Connect LI LI LC L1 L1 L1 C L1 L1 L1 C LJ L1 EL C LJ L1 ED C LJ L1 LI C LJ EJ LI CI LJ EJ EI CI LJ EI EI CI LJ The program is now ready to run Select the Controller number that corre
9. erate Tools Window Help 248 RIO 102 Rev 1 0c Notel If the Connection String string control is left blank the GalilTools connection dialog will be displayed If a valid connection string is specified ex COMI 19200 the program will attempt this connection directly E Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com Handling Events with LabVIEW and the GalilTools Communication Library There are 3 type of events that can occur in the COM class onMessage onInterrupt onRecord onMessage handles unsolicited messages that are sent from the controller onInterrupt handles interrupts that are sent from the controller Not all Galil Controllers have this functionality see UI and EI in your controllers command reference for more information onRecord handles the DR data record information sent from the controller This example will show how to set the onMessage event handler in LabVIEW l Start with the above example 2 Drop a Register Event Callback REC onto the Block Diagram Connectivity ActiveX 3 Connect the output of the Automation Open to the Event of the REC Left click on Event and choose onMessage T3 Galil vi Block Diagram Ge File Edit view Project Operate Tools Window Help eee ml oI lee bale os Galil Galil Automation Open Property Made Invoke Node Invoke Made Invoke Made k i z 8 ee Pall DL 18 e c
10. gramming Structures 15a Right click on Timeout in the event structure and choose Edit Events Handled by This Case 15b Change the Event Sources to stop vi and the Events to Value Change 16 Place a Unregister For Events Connectivity AvtiveX block a Property Node block Connectivity ActiveX a String Constant Programming String and an Error out Front Panel Classic Classic Array Matrix amp Cluster 16a Connect the event callback refnum terminal output of the REC to the event registration refnum terminal input of the Unregister For Events block 16b Connect the Error output of the REC to the error input of the Unregister For Events block l6c Connect the Property node to the end of the chain for the program download and execution Change the element to write and choose address Connect a string constant of OFFLINE to the address terminal 16d Connect the error chain through Unregister For Events to the error out ile Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com Galil vi Block Diagram File Edit view Project Operate Tools Window Help Pr mlo fale sever Tee 5 1 Galil 1Galil A l Automation Open Property Node Invoke Node Invoke Node Invoke Node Invoke Node cos Ame Galil 5L A IGall 5L 15 9 IGall 5 B IGal Sala IGail 5 o gs connection library Version programDownload La koi com
11. ick on it and choose Select Item Key Focus Wire up a Boolean True to it so it looks like the code below Note You will need to change your Key Navigation so that the ENTER Key is no longer the default as this will interfere with DMCTerminal2 ocx 20 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com le Edit Operate Project Windows Help E i d 13pt Application Font n DDMCShell P DMCCommand DM Response DMCTerminalLib DDIMCTerminal _ Al Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com Part 3 Using Library Function calls dmc32 dll with LabVIEW The other method of programming in the LabVIEW environment is to use sub VI s that allow you to make function calls from your program directly to the dynamic link libraries dlls A common use for this is to create a custom user interface with buttons that send specific code segments to the controller 1e Home Jog Positional Move etc Other features include being able to quickly and easily graph the controller information to the screen or save it for comparison later Here are the basic steps to creating a VI Download or copy the VIs included on the Galil CD to one of your directories If you would like to be able to access the Galil
12. icon by dragging a lower corner so that is shows 2 property boxes as shown below Property j Property j 15 Select the Connect Wire icon from the Tools palette 16 Draw a wire from the DMCShelll icon to the top left corner of the Automation icon show above 17 Click on the Automation icon which now reads DMCShel by placing the mouse pointer over a property box and right click to bring up a menu Select DMCController and DMCConnect from Properties 18 Right mouse click over the DMCConnect box and select Change to Write Do the same for DMCController 19 Draw a line using the Connect Wire tool from the DMCController property to the Numeric Control labeled Set Controller 20 Create a Boolean Constant of True and wire it to the DMCConnect property 21 The diagram should look like this sfs Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com LV activeX Connect v51 vi Diagram File Edit Operate Project Windows Help 1 Spt Application Font DMOSHellLib DOMCShell Be DpmMcshel B et Controller DMCController DWMCLonnect 22 Go to Sequence Block 1 and create the following 16 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com E LV activeX Connect v51 vi Diagram Eile Edit Operate
13. lTools API with LabVIEW Basic Example Working vi s of the below examples as well as other vi s can be found in the LabVIEW Hello Galil example located here http www galilmc com learning hellogalil php l Make sure GalilTools version 1 3 0 0 or later 1s installed on the PC The free version of GalilTools contains the Communication Library so no software purchase is required http www galilmc com support software downloads php 2 Open National Instruments LabVIEW Version 8 6 Versions 8 0 8 2 and 8 5 were also tested Later versions should be compatible as well Select Blank VI 3 From the File menu choose Save As File Save As and name the file Galil 4 Choose Window Show Block Diagram 5 In the Functions Palette View Functions Palette expand Connectivity then ActiveX 5a Drop the Automation Open function onto Galil vi Block Diagram 6 Right clink on the Automation Open function and choose Select ActiveX Class Browse This may take a moment 6a In the drop down box choose Galil Version x x n n is the version number ex Galil Version 0 3 Highlight the Galil Object click OK 13 Galil vi Block Diagram 1 at File Edit view Project Operate Tools Window Help lu e Sl ale or L3 Application Font PS ia Galil IGalil Automation Open og Recommended for beginners to LabVIEW Right click on the Automation Open function choose Visible Items L
14. mand Connection String Connected To Library Version T abc message abc a 0 stop vi Value Change ve Unregister For Events event onMessage vi R 2 Reg Event Callback ur Property Node re 2 message offline error out OFFLIME 2d s Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com The VI should now be ready to run make sure to use the Stop button in the vi to stop the execution of the vi File Edit View Project Operate Tools Window Help 2132 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com Part 2 Using the Active X Tool Kit with Lab VIEW LabVIEW version 5 0 and greater supports ActiveX OCX controls The standard Galil tool kit can be used without modification Please note that while properties and methods are supported events are not This does not effect the operation of the tools but it does prevent writing code to respond to error events The ActiveX tools that you plan to use need to be installed and registered as outlined in the ActiveX User Manual This step by step example demonstrates connecting and communicating to the controller using the DMCShell ocx in a LabVIEW application l BA 3 Start with a new Lab VIEW project Add an ActiveX container found in the controls palette
15. n Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com 9 Drop a Property Node Connectivity ActiveX onto the event onMessage vi Block Diagram 9a Connect the terminal of the message object icon at the bottom to the reference terminal of the property node 13 onMessaze Event Callback event onMessage vi Block Diagram File Edit view Project Operate Tools window Help Pl eln el lee bale as Event Common Cate Control Ref Event Data Unbundle By Name 10 Left click on the Property element on the property node and choose value 10a Right click on that same element and choose Change To Write 10b Connect the output of the message bundle to the value terminal on the property node T Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com 13 onMessage Event Callback event onHessage vi Block Diagram File Edit view Project Operate Tools Window Help eji e OO els flet itk T e 5 15 Event Common Data Control Ref Event Data Unbundle By Mame message E 11 Onthe main panel of event onMessage drop an Error out block Classic Classic Array Matrix amp Cluster lla inthe block diagram connect the error out of the property node to the input of the error out block 13 onMessage Event Callback event onMessage vi Bl
16. o be the default button when you click Enter use the Key Navigation option 27 The response should be displayed in the Response string indicator 28 To stop the program either click on the Stop button or turn the Run switch to Stop Save your project at this point 29 Adding other ActiveX controls 30 Add another ActiveX container to the project and place DMCTerminal2 in it 3 The Front Panel should look something like this 18 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com ke LV activeX Terminal2 v51 vi 32 Add an ActiveX property node to Sequence Frame 0 in the Diagram and wire up the DMCTerminal2 control to it Create three properties DMCController Enabled and FontSize Wire them up as shown below 9 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com kb LV activeX Terminal2 v51 vi Diagram PEE B File Edit Operate Project Windows Help SN E bolet root Application Fo DM ShellLib DOMCShelll UuummuuWmsrn j uuuuuuuuumuuuuuuuuuur n DDMcCTerminal p 132 DMCcontraller Set Contraller i i Enabled 33 Right Click on the DMCTerminalLib ActiveX container in the diagram view and click Create Attribute Node Move this attribute node to Frame 1 inside of the loop Right cl
17. ock Diagram File Edit view Project Operate Tools Window Help Lele amp Ln AE PRE i3 Application Font PS as 65 i5 Event Common Data Control Ref Event Data error out Unbundle By Mame message E z r 12 Save event onMessage vi Create a program that will run in the controller and send out unsolicited messages 210 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com 13 Add an Invoke node after the library version block connect it up and change it to programDownload Change the command block to XQ from MG TIME Adda string constant that has the program A MG TIME WT500 JP A 13 Galil vi Block Diagram EJ File Edit View Project Operate Tools Window Help omae Downloaded Program Galil IGalil Automation Open error out a D programDownload command alue program command Connected To Library Version event onMessage vi tx 2 message When using events in LabVIEW it is a requirement that OFFLINE be sent to address in order to close the connection to the controller and the drivers In this example a stop button is used in a event structure 14 In the Galil vi Front Panel add a retangular stop button Classic Classic Boolean other boolean buttons should work as well Rename it from stop to stop vi 15 Inthe Galil vi Block Diagram add an Event Structure Pro
18. sponds to the number of the controller in the Galil Registry Click on Run and type in Upper Case commands into the command window The responses will be returned to your response window Note the ED command will not work in the LabVIEW environment To download a file use the sub VI downbuff vi or downfile vi Error checking can be achieved by wiring digital indicators up to the Return terminal of each sub vi Error codes as well as all possible function calls can be found in the DMCWIN amp C C programmer s toolkit Although Galil only provides a few function calls that have been converted to VI s the user may create their own by following the same format as those provided 04 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com
19. t view Project Operate Tools Window Help o en bal jot Galil IGalil Automation Open Property Node Invoke Node Invoke Node Invoke Node 3 k 11 Goto the Galil vi Front Panel window In the Controls Palette View Controls Palette expand Modern then String amp Path lla Drop the String Control block onto Front Panel llb Rename String to Connection String llc Leave the string box empty This can later be changed to the connection string of the controller 192 168 1 100 GALILPCII COM 19200 etc See Notel 12 Drop the String Indicator Controls Palette Modern String amp Path onto the Front Panel 12a Rename String to Connected To 12b Increase the size of the string box by double the length and width 13 Drop the String Indicator Controls Palette Modern String amp Path onto the Front Panel 13a Rename String to Library Version 13b Increase the size of the string box by double the length 14 Drop the String Indicator Controls Palette Modern String amp Path onto the Front Panel 14a Rename String to MG TIME 15 Drop an Error Out ctl control Controls Palette Classic Classic Array Matrix amp Cluster onto the Front Panel 4 Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com 17a 17b 17c 17c 18 18a 18b
20. to the project Select the ActiveX container with the right mouse button and select Insert ActiveX Object Select DMCShell from the menu Add one Boolean switch from the controls palette and draw it on the project Add one string control and one string indicator and draw it on the project Right mouse click on the string control to bring up a menu Select Limit to single line Create labels on the controls by right clicking the mouse on the control and selecting Show Label then typing the label text Add a Numeric Control Integer labeled Set Controller Add a Button and label it SEND Right click on it and make sure the Mechanical action is Switch Until Released 10 The project should look something like this Galil Motion Control Inc e 3750 Atherton Road e Rocklin CA 95765 USA e 800 377 6329 e Ph 916 626 0101 e Fax 916 626 0102 e www galilmc com E LV_activeX_Connect_v51 vi a z ES File Edit Operate Project Windows Help ER STI ist Application Font z uil gt a E Controller DMCSHelLib DOMCSHel aoo Eman Send Command D SEND Response SSS 14 11 Show the project diagram by selecting Show Diagram from the Windows Menu 12 Create a Sequence block and create 3 different sequence blocks 0 1 2 13 In Sequence Block 0 add an ActiveX property node by selecting the Communications icon from the Function palette then ActiveX from the sub menu 14 Enlarge the
Download Pdf Manuals
Related Search
Related Contents
Operating Instructions Adesso EasyTouch 625 User Manual eFizz™ User Manual Manuel d'utilisation eFizz™ eFizz Humax IR-ACE M User's Manual Makita 2705 Saw User Manual LX Zeus - Squarespace "user manual" Copyright © All rights reserved.
Failed to retrieve file