4.4 RAM [T-Series Datasheet] | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


4.4 RAM [T-Series Datasheet]


T-Series devices use shared memory. The shared memory allows users to allocate resources to optimize the feature set of the device.

Many features will allocate memory when they are enabled, and hold that memory until disabled. Others will only use memory while they are active. Here is a list of features which require shared memory:

  • AIN_EF - Some memory is allocated when enabled, more can be allocated during operation.
  • Lua Scripting Engine - Memory usage depends on the size of the script and the memory usage of the script.
  • Stream buffers - Allocated when stream is enabled.
  • StreamOut buffers - Allocated when a StreamOut channel is enabled. 
  • USER_RAM FIFOs - Allocated when enabled.
  • Asynchronous Serial - Allocated when enabled
  • File IO - Allocated to store specified paths.

Memory sizes:

  • T4: 64 kB 
  • T7: 64 kB


When there is insufficient memory available, a SYSTEM_MEMORY_BEREFT error will be thrown. Some ideas to free up memory:

  • To free allocated stream RAM, stop stream. To use less stream RAM, use a smaller STREAM_BUFFER_SIZE_BYTES and/or smaller STREAM_OUT#(0:3)_BUFFER_ALLOCATE_NUM_BYTES
  • To free other allocated RAM:
    • Write 0 LUA_RUN
    • Write 0 AIN#(0:149)_EF_INDEX

RAM-Allocating Registers

The below registers allocate system RAM (and may return SYSTEM_MEMORY_BEREFT):

Name Start Address Type Access

STREAM_ENABLE             Write 1 to start stream. Write 0 to stop stream. Reading this register returns 1 when stream is enabled. When using a triggered stream the stream is considered enabled while waiting for the trigger.

4990 UINT32 R/W

STREAM_OUT#(0:2)_ENABLE             When STREAM_OUT#_ENABLE is enabled, the stream out target is generally updated by one value from the stream out buffer per stream scan. For example, there will generally be one instance of e.g. STREAM_OUT0 in the stream scan list, which will cause one STREAM_OUT0_BUFFER value to be consumed and written to STREAM_OUT0_TARGET for every stream scan. The stream scan list could also contain two instances of STREAM_OUT0, in which case two values from STREAM_OUT0_BUFFER value would be consumed and written for every stream scan.

4090 UINT32 R/W

STREAM_BUFFER_SIZE_BYTES does not allocate RAM, but it does set the amount of RAM allocated by STREAM_ENABLE. LJM_eStreamStart writes to STREAM_ENABLE.

Similarly, STREAM_OUT#(0:3)_BUFFER_ALLOCATE_NUM_BYTES does not allocate RAM, but sets the amount of RAM allocated by STREAM_OUT#(0:3)_ENABLE.

Name Start Address Type Access

LUA_RUN             Writing 1 compiles and runs the Lua script that is loaded in RAM. Writing zero stops the script and begins cleaning up memory. Users may poll the register after writing a value of 0 to verify that the VM is unloaded, and garbage collection is complete.<br>0 = VM fully unloaded.<br>1 = Running/in-progress

6000 UINT32 R/W

LUA_SOURCE_SIZE             Allocates RAM for the source code.

6012 UINT32 R/W

LUA_DEBUG_ENABLE             Write 1 to this register to enable debugging.

6020 UINT32 R/W

Lua scripts dynamically allocate RAM.

Name Start Address Type Access

USER_RAM_FIFO#(0:2)_ALLOCATE_NUM_BYTES             Allocate memory for a FIFO buffer. Number of bytes should be sufficient to store users max transfer array size. Note that FLOAT32, INT32, and UINT32 require 4 bytes per value, and UINT16 require 2 bytes per value. Maximum size is limited by available memory. Care should be taken to conserve enough memory for other operations such as AIN_EF, Lua, Stream etc.

47900 UINT32 R/W

AIN Extended Features
Name Start Address Type Access

AIN#(0:148)_EF_INDEX             Specify the desired extended feature for this analog input with the index value. List of index values:<br>0=None(disabled);<br>1=Offset and Slope;<br>3=Max/Min/Avg;<br>4=Resistance;<br>5=Average and Threshold;<br>10=RMS Flex;<br>11=FlexRMS;<br>20=Thermocouple type E;<br>21=Thermocouple type J;<br>22=Thermocouple type K;<br>23=Thermocouple type R;<br>24=Thermocouple type T;<br>25=Thermocouple type S;<br>30=Thermocouple type C;<br>40=RTD model PT100;<br>41=RTD model PT500;<br>42=RTD model PT1000.

9000 UINT32 R/W

AIN#(0:148)_EF_READ_A             Function dependent on selected feature index.

7000 FLOAT32 R

File I/O
Name Start Address Type Access

FILE_IO_PATH_WRITE_LEN_BYTES             Write the length (in bytes) of the file path or directory to access.

60640 UINT32 W

Name Start Address Type Access

SPI_GO             Write 1 to begin the configured SPI transaction.

5007 UINT16 W

Name Start Address Type Access

ASYNCH_NUM_BYTES_TX             The number of bytes to be transmitted after writing to GO. Max is 256.

5440 UINT16 R/W

ASYNCH_ENABLE             1 = Turn on Asynch. Configures timing hardware, DIO lines and allocates the receiving buffer.

5400 UINT16 R/W


Pre-Allocated User RAM Registers

User RAM consists of a list of volatile Modbus addresses where data can be sent to, and read from, a Lua script. Lua writes to the Modbus registers, and then a host device can read that information. 

There are a total of 200 registers of pre-allocated RAM, which is split into several groups so that users may access it conveniently with different data types.

Use the following USER_RAM registers to store information:

User RAM Registers
Name Start Address Type Access

USER_RAM#(0:39)_F32             Generic RAM registers. Useful for passing data between a host computer and a Lua script. Will not return an error if alternate data types are used.

46000 FLOAT32 R/W

USER_RAM#(0:9)_I32             Generic RAM registers. Useful for passing data between a host computer and a Lua script. Will not return an error if alternate data types are used.

46080 INT32 R/W

USER_RAM#(0:39)_U32             Generic RAM registers. Useful for passing data between a host computer and a Lua script. Will not return an error if alternate data types are used.

46100 UINT32 R/W

USER_RAM#(0:19)_U16             Generic RAM registers. Useful for passing data between a host computer and a Lua script. Will not return an error if alternate data types are used.

46180 UINT16 R/W