Previous Topic

Next Topic

Book Contents

Book Index

defBLOCK directive

The defBLOCK directive forces SPLat/PC to reserve a contiguous block of RAM for the subsequent defBYTE, defFLOAT, defLONG, defTIME24 or defWORD memory allocations (but NOT defSEM). It is available in SPLat/PC V8.20.2 and later.

Syntax:

          defBLOCK      Value

Value is a required numeric constant.

The next "Value" bytes worth of automatically allocated RAM will be allocated in an unbroken block.

Example:

When using Xwire or ModBus master you generally need to set aside a contiguous block of RAM for exchanging data with a remote device. The code to do that might look like this:

           defBLOCK       10     ;10 bytes of data sent out on Xwire
XW_Float1  defFLOAT              ;4 bytes
XW_Byte1   defBYTE               ;1 byte
XW_Float2  defFLOAT              ;4 bytes
XW_Sems    defBYTE               ;1 byte   = 10 bytes total

The "defBLOCK 10" guarantees that the next 4 RAM data items (occupying 10 bytes) will be allocated in a single, unbroken block of RAM. In the Xwire control block you would use XW_Float1 to identify the data area.

An error will be raised if SPLat/PC is unable to find enough free RAM.

Note a line label is not allowed on this directive.

Previous Topic

Next Topic