User Tools

Site Tools

한국어

logicpython:cubloc_api:hread

This is an old revision of the document!


HRead

Read data from the simulated SRAM heap.

Syntax

from cubloc import HRead
 
HRead( address: int, byteLength: int, returnType: type[int] | type[float] | type[bytes] | type[bytearray] = int, )

Parameters

  • address: Heap address (0 to 56319).
  • byteLength: Number of bytes to read. Must be positive and remain within the heap bounds.
  • returnType: Use int, float, bytes, or bytearray to control how the heap bytes are decoded. The default is int.

Return Value

Returns the heap data decoded according to returnType as int, float, bytes, or bytearray.

Exceptions

  • TypeError: address, byteLength, or returnType has an invalid type.
  • ValueError: address or byteLength is out of range, the read would extend past the end of heap, or a float read was requested with a byteLength other than 4.

Example

from cubloc import HRead
 
# Example usage
result = HRead(1, 1, int)
print(result)
logicpython/cubloc_api/hread.1775786798.txt.gz · Last modified: by 127.0.0.1