5.11 - Read RAM [U12 Datasheet] | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


5.11 - Read RAM [U12 Datasheet]

Reads 4 bytes out of the U12's internal memory.

Note: Bytes are read down from the starting address. For example, if you read at address 0x203, then byte 0 comes from 0x203, byte 1 comes from 0x202, byte 2 comes from 0x201, and byte 0 comes from 0x200.

Table 5.11-1.

Byte # Description
5 01X1XX00 (Read RAM)
6 Most Significant Address Byte
7 Least Significant Address Byte
Byte # Description
0 01010000
1 Readback of data byte 3
2 Readback of data byte 2
3 Readback of data byte 1
4 Readback of data byte 0
6 Most Significant Address Byte
7 Least Significant Address Byte


Table 5.11-2.

Non-Volatile RAM Map  
Address Range Description
0x00 A copy of the serial # which is stored in ROM
0x08 - 0x0A Always 0
0x0B LocalID
0x0C wdoglj (Watchdog Variable)
0x0D wdogtoh (Watchdog Variable)
0x0E wdogtol (Watchdog Variable)
0x070 fullA (Asynch Variable)
0x071 fullB (Asynch Variable)
0x072 fullC (Asynch Variable)
0x073 halfA (Asynch Variable)
0x074 halfB (Asynch Variable)
0x075 halfC (Asynch Variable)
0x076 tomult (Asynch Variable)
0x080 - 0x0BF Serial data send buffer (64 bytes, 28 used)
0x0C0 - 0x0FF Serial data receive buffer (64 bytes, 28 used)
0x1C0 - 0x1DF Serial data buffer (32 bytes)
0x200 - 0x3FF User area
0x400 - 0x1FFF Circular RAM buffer.

LabJackPython Example

>>> import u12
>>> d = u12.U12(debug=True)
open called
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0]
>>> r = d.rawReadRAM()
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x50, 0x0, 0x0]
Received: [0x50, 0x5, 0xf6, 0x8b, 0xaa, 0x0, 0x0, 0x0]
>>> print r
{'DataByte3': 5, 'DataByte2': 246, 'DataByte1': 139, 'DataByte0': 170}
>>> bytes = [ r['DataByte3'], r['DataByte2'], r['DataByte1'], r['DataByte0'] ]
>>> import struct
>>> print struct.unpack(">I", struct.pack("BBBB", *bytes))[0]


Samingnoi's picture

Hi There,

i'm new for labjack u12, i'm using python27 with labjack U12 and try to issue command rawReadRAM but there is error "TypeError: 'NoneType' ", i have no idea for this error. would you help to advise? thanks.

below terminal command:

Python 2.7.16 (v2.7.16:413a49145e, Mar  4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)] on win32

>>> import u12
>>> d = u12.U12()
>>> d
<u12.U12 object at 0x00000000037C4358>
>>> d.rawReadRAM()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\u12.py", line 1514, in rawReadRAM
    if results[0] != int(bf):
TypeError: 'NoneType' object has no attribute '__getitem__'




LabJack Support's picture

The "raw" functions are only compatible on Linux/macOS, and are low-level versions of functions. On Windows, instead use the readMem method, which is the Python version of the ReadMem function in the Windows API. The top of the u12.py module doc mentions what functions are supported for what driver/OS: