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.
Command |
|
Byte # | Description |
0 | XXXXXXXX |
1 | XXXXXXXX |
2 | XXXXXXXX |
3 | XXXXXXXX |
4 | XXXXXXXX |
5 | 01X1XX00 (Read RAM) |
6 | Most Significant Address Byte |
7 | Least Significant Address Byte |
|
|
|
|
Response |
|
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 |
5 | XXXXXXXX |
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]
100043690