background image

 

 

Arguments of the list command are optional.  If no arguments are provided, all  scripts will be 
listed without details.   Use the 

–l

 option to show the details of the scripts.  Details  include the 

file size, date, the system/user designation and a run/idle status indication.  The 

–r

 option shows 

only  those  scripts  that  are  currently  running.    Both  options  may  be  included  in  a  single 

list

 

command.  If the optional 

[script]

 argument is passed only scripts of the specified name will 

be listed. 
 
In the output of the 

list

 command, each script listing is terminated with a “new line” character 

(‘\n’ or 0xA).  The entire list is terminated with a carriage return (‘\r’ or 0xD). 

 
2.1.5

 

Read 

 
The 

read

  command  will  return  the  source  code  of  the  specified  script  via  the  interface  from 

which the command was  sent.  For example,  if  in the scripting socket interface you type 

read 

myscript.lua

  the  source  code  of 

myscript.lua

  will  appear  in  the  terminal  window.    If  you 

send the same command via the VXI-11 interface, the next VXI-11 read will return the source 
code  of the  script.    Note  that 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 section 2.1.7

 

 

 

read <script> 

 

2.1.6

 

Remove 

 
The 

remove

  command  will  delete  the  specified  script  from  both  volatile  and  non-volatile 

memory.  A removed script is not recoverable therefore care must be taken to ensure a script is 
saved on a host computer before sending the 

remove

 command. 

 
 

remove <script> 

 

2.1.7

 

Retrieve 

 
The 

retrieve

 command is used to download a script from the EM405-8 to the host computer.  

A download port must be specified.   
 

 

retrieve [options] <script> <port> 

 

 

options: 

 

-d 

delete the file upon retrieval 

 
Upon receiving the 

retrieve 

command, the EM405-8 will search for the specified script and 

return  a  4-byte acknowledge  (“ack\n”  if  found  or “nck\n”  if  not  found)  via the  same  interface 
from  which  the  command  was  received.    If  the  script  was  found,  the  EM405-8  will  launch  a 
small TCP/IP server at the specified port.  The host application must then connect to this server 
to  download  the  script.    The  TCP/IP  server  will  automatically  exit  once  the  script  has  been 
downloaded.    Therefore,  a  new 

retrieve

  command  must  be  used  for  each  script  to  be 

downloaded.  
       

Содержание EM405-8

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 42: ......

Страница 43: ...N O T E S...

Страница 44: ......

Страница 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...

Страница 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...

Отзывы: