14
To use the Lua libraries simply
require
the library in the script as follows:
require “lua_em405”
Once the library is loaded any of the library functions are available for use in the script with the
following syntax:
lua_em405.
function
()
To further enhance readability, the library can be assigned to a local or global variable and the
library functions can be called with this variable as the prefix as in the following example. This
method will be used throughout this manual.
em405 = require “lua_em405”
em405.
function
()
Table II summarizes the functions that are in the EM405-8 Extensions Library. Details of each
function including a function description, valid parameter ranges and return types follow the
table.
Numerical constants in the Lua language are written much like they are in ANSI-C. Examples of
numerical constants 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 of clocks used by the process
clockspersec
Returns the number of clocks per second
emclose
Free resources allocated during library load
emfans
Control the speed of the fans
emread
Read an EM405-8 carrier control register
emtemp
Read an EM405-8 on-board temperature sensor
emwrite
Write an EM405-8 carrier control register
input
Input data to the script from the VXI-11 interface
mread
Read an M-Module register
mreadblock
Read a block of M-Module registers
mreadfifo
Repeatedly read an M-Module register
mreadid
Read the ID PROM of an M-Module
mwrite
Write an M-Module register
mwriteblock
Write a block of M-Module registers
mwritefifo
Repeatedly write an M-Module register
output
Output data to VXI-11 interface
usleep
Sleep for specified microseconds
version
Get the version of the EM405-8 Extension Library