background image

 

 

 

Manual Part No: 11030574A 

M O D E L  

E M 4 0 5 - 8  

S C R I P T I N G   M A N U A L  

E T H E R N E T  

M - M O D U L E  

C A R R I E R /  

B R I D G E  

Summary of Contents for EM405-8

Page 1: ...Manual Part No 11030574A MO D E L E M4 0 5 8 S C R I P T I N G M A N U A L E TH E R N E T M MO D U L E C AR R IE R B R ID G E...

Page 2: ...orated in new editions of this publication Copyright 2009 2012 by C H Technologies Inc The information and or drawings set forth in this document and all rights in and to inventions disclosed herein w...

Page 3: ...ent Occasionally throughout the life of an instrument changes are deemed necessary to equipment related documentation The latest revision of our documentation is available for download from our web si...

Page 4: ...ine All manufacturing options of the EM405 8 include the scripting features however only options that include an internal mass storage device provide non volatile storage of scripts and autonomous ope...

Page 5: ...eractive Mode 11 3 0 DEVELOPING SCRIPTS 13 3 1 DEVELOPMENT SOFTWARE EM405 8 IVI DRIVER SOFT FRONT PANEL 13 3 2 EM405 8 EXTENSIONS LIBRARY 13 3 3 PASSING DATA 20 3 4 CALLING M MODULE DRIVERS 22 3 4 1 U...

Page 6: ...Figure 8 M Module Driver Example Using Buffers 26 Figure 9 M Module Driver Example Using Arrays 27 Figure 10 Simple Lua Based Web Page 30 Figure 11 Example Adding Link to the Navigation Menu 31 Figure...

Page 7: ...processor This provides significant performance improvements and allows the EM405 8 and associated M modules to be customized and configured It can also act independently for a long period of time wit...

Page 8: ...n interpreted language in that Lua programs are stored as text that is interpreted at run time In reality Lua code is compiled at runtime into an intermediate form however the fact that compilation is...

Page 9: ...of topics not covered or not elaborated on by this manual The most applicable references are EM405 8 User s Manual C H Technologies Inc C H part No 11029384 Programming in Lua 2nd Edition Ierusalimsch...

Page 10: ...unning scripts list list all scripts l script list details script name optional r script list if running script name optional read script read the specified script remove script remove the script retr...

Page 11: ...specified name In addition to running more that one script at a time the same script can be concurrently run multiple times each in its own thread The system maintains a sequence list indicating the...

Page 12: ...hat the VXI 11 interface has a 16 kilobyte limit therefore any script greater than 16 kilobytes will not be returned properly An alternative to the read command is the retrieve command detailed in sec...

Page 13: ...nd so that the user may launch more that one script In reality the run command is optional Scripts can be run by simply sending the name of the script to the EM405 8 as a command itself Further if the...

Page 14: ...1 10 Upload The upload command is used to upload a script from a host computer to the EM405 8 An upload port must be specified upload options script port options x execute the script after upload o ov...

Page 15: ...rt of the EM405 8 firmware These files include EM405 8 utility scripts User files are those uploaded by the user Using the l argument of the list command the sys versus user type of each file can be d...

Page 16: ...e interface implements an interactive mode that allows the user to input script commands line by line 2 3 1 Configuring the Scripting Socket Interface The scripting socket interface provided by the EM...

Page 17: ...ination of commands The user can directly input commands as detailed in section 2 1 at the command prompt In addition the scripting socket interface forwards the standard output console stdout and std...

Page 18: ...e local variables are not carried over to the next statement The following example illustrates this bold indicates the output local b 10 print b nil c 10 print c 10 Another notable limitation is the i...

Page 19: ...he script output in a standard command prompt Further the panel allows the user to open a command prompt to the scripting socket interface where he she can directly input use and management commands F...

Page 20: ...tants are 7 7 893 756 87e 6 0 784e1 0x76 The detailed descriptions below follow the same conventions Table II Functions in the EM405 8 Extensions Library Function Description clock Returns the number...

Page 21: ...r clocks clockspersec Description Returns the number of processor clock in one second This value can be used to convert the result of clock into seconds The function returns the ANSI C value CLOCKS_PE...

Page 22: ...Description Writes an EM405 8 control register These registers are shared between all M Modules and control the carrier utilities such as triggers and fans Refer to the EM405 8 User s Manual for regis...

Page 23: ...adblock module width offset length Description Read a block of M Module registers from a specified M Module position The function will read length words incrementing the address between each read Para...

Page 24: ...s value mreadid module word Description Reads one 16 bit word of the specified M Module s ID PROM Parameters module Integer indicating the M Module position to read 0 7 word Integer specifying the 16...

Page 25: ...odule registers repeatedly to a specified M Module position The function will write length words from the specified offset without incrementing the address between each write Parameters module Integer...

Page 26: ...discussed in section 3 1 provides both input and output utilities that allow for data passing between the script and the host computer using the VXI 11 interface For the purpose of this discussion the...

Page 27: ...script can output data to the VXI 11 interface however there is no built in indication as to which script a piece of data is from nor is there a defined delimiter to separate data from one script wit...

Page 28: ...easy to crash Lua from within a library thus to avoid frustration care must be taken when calling drivers using Alien Crashes due to a misbehaving C library typically only occur during development Onc...

Page 29: ...llback generic function pointer short short byte signed char long long float float The following example code illustrates how to define the function prototype of the M228 driver initialize function wh...

Page 30: ...8_Init m228_GetIdentWord and m228_Close Note that these examples use the m228_GetIdentWord function not the EM405 8 Extensions Library function mreadid This same example can be performed using just th...

Page 31: ...plete list of utilities 3 4 2 1 Buffers Alien buffers allow the script to allocate a block of memory that can then be passed to a function in place of any string or pointer type A buffer is allocated...

Page 32: ...perform the same exact function as the example in Figure 8 but with arrays instead of buffers require alien local libm228 alien load usr scripts user libm228 so Function Prototypes local m228_Init lib...

Page 33: ...a certain task This is known as a callback function Alien provides the require alien local libm228 alien load usr scripts user libm228 so Function Prototypes local m228_Init libm228 m228_Init m228_Ini...

Page 34: ...d libraries and the EM405 8 s Linux kernel upon which the Lua interpreter is running contains all the common utilities such as a file system messaging utilities including pipes and FIFO s and sockets...

Page 35: ...store and retrieve data to from the mass storage device using the standard file I O functions found in the Lua I O Library The mass storage device is mapped to the directory media A single subdirector...

Page 36: ...square brackets denote a literal string where there are no special characters or escape sequences This is especially useful when using Lua to create a webpage as it allows the developer to input the...

Page 37: ...passed within the URL by adding a name value pair within the URL Details on passing arguments to the script can be found in section 4 4 4 2 ADDING A LINK TO THE C H NAVIGATION MENU The user can add li...

Page 38: ...y adding name value pairs to the URL For example cgi bin script cgi script myscript lua arg1 val1 arg2 val2 In the above example the script receives the arguments val1 and val2 The labels arg1 and arg...

Page 39: ...loper needs only to concentrate on the added content of the custom page The library l_em405web lua includes four functions as summarized in Table IV Details of each function follow the table Table IV...

Page 40: ...s complete This allows the page to redirect to a different URL Pass an empty string to this parameter to refresh to the same URL Bottom Description This function display the bottom banner and closes t...

Page 41: ...our script load the page in a web browser then view the source using the browsers utility to view source Figure 14 shows an example web page using the l_em405web lua library This example performs the...

Page 42: ......

Page 43: ...N O T E S...

Page 44: ......

Page 45: ...iate without incurring any obligation whatsoever You may of course continue to use the information which you supply Please refrain from using this form for technical questions or for requests for addi...

Page 46: ...n acknowledgment mailed to you stating whether or not your comments were being incorporated NOTE This form may not be used to request copies of documents or to request waivers deviations or clarificat...

Reviews: