Using CODE in LabView

Navigation:  User guide > OLE automation >

Using CODE in LabView

Previous pageReturn to chapter overviewNext page

You must have object generation 3.60 for the mechanism described below!

 

If you develop automation solutions with LabView you can access CODE in your LabView projects. A typical application would be a scanning spectrometer system, used to obtain one- or two-dimensional thickness profiles. If LabView is used to control the mechanical motion and the data acquisition of the spectrometer hardware, it would be advantageous to control CODE by LabView as well. After a measurement, LabView could pass the recorded spectra to CODE, start the thickness determination, and pick-up the results in order to generate appropriate operator displays.

 

Here is how you get access to CODE within LabView:

 

oGenerate a control of type 'Automation refnum'

oRight-click on the control and select the command 'Select ActiveX class/Browse'

oA dialog for the selection of a type library opens

 

clip0001

 

oSearch for the type library 'CODE library' in the dropdown list

oIf you do not find it click on the 'Browse' button to the right and select the CODE program file code.exe (in order to see the program file you may have to set the file type to 'All files (*.*)' in the file dialog)

oThe dialog should now look like this:

 

clip0002

 

oCheck the ckeckbox 'Show Creatable Objects Only' and select the only remaining line 'scoutole (scout.scoutole)':

 

clip0003

 

oThen press OK to leave this dialog.

oIn the LabView Block diagram, right-click the new object and select the command 'ActiveX palette' to generate a new object of type 'Automation open'. Connect the 2 objects like shown below:

 

clip0004

 

 

oFrom now on you can use all OLE properties and procedures of CODE. In order to check if you can really access CODE commands generate a small test sequence: Show CODE on the screen ('show' command), execute a file selection dialog (by calling the property 'a_filename') and finally call the routine 'prepare_shutdown' to prepare the death of the CODE server.

 

clip0005

 

Before you do any real work in LabView, please test if you can get this sequence to execute properly.