14.08.2013 Views

snap ethernet-based i/o units protocols and programming guide

snap ethernet-based i/o units protocols and programming guide

snap ethernet-based i/o units protocols and programming guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 3: USING THE SNAP ETHERNET I/O DRIVER TOOLKIT<br />

Memory Map Read/Write Methods<br />

If you need to read or write to areas of the memory map that are not yet supported by the driver<br />

toolkit, for example to configure timers or event messages, use the following methods. For more<br />

information on the memory map, see Appendix A.<br />

For the address offset, ignore the first four F’s in the memory map address (for example, use<br />

F03FFFD0, not FFFFF03FFFD0).<br />

Read Methods Description<br />

ReadLong V<br />

[in] long nOffset<br />

[out] long pnValue<br />

ReadFloat V<br />

[in] long nOffset<br />

[out] float fValue<br />

ReadBlock<br />

[in] long nOffset<br />

[out] by_array byBlock<br />

[in] short nLength<br />

Reads a long integer value from a memory address offset in the<br />

brain.<br />

Reads a float value from a memory address offset in the brain.<br />

Reads a block of bytes from a memory address offset in the brain.<br />

Use the GetLongAtBlockIndex() <strong>and</strong> GetFloatAtBlockIndex()<br />

methods below to help read data from the block of bytes.<br />

v The OptoSnapIoMemMapX ActiveX component has a variant-only version of this method.<br />

Write Methods Description<br />

WriteLong V<br />

[in] long nOffset<br />

[in] long nValue<br />

WriteFloat V<br />

[in] long nOffset<br />

[in] float fValue<br />

WriteBlock<br />

[in] long nOffset<br />

[in] by_block byBlock<br />

[in] short nLength<br />

Writes a long integer value to a memory address offset in the brain.<br />

Writes a float value to a memory address offset in the brain.<br />

Writes a block of bytes to a memory address offset in the brain.<br />

Use the SetLongAtBlockIndex() <strong>and</strong> SetFloatAtBlockIndex()<br />

methods below to help fill in the block of bytes with data.<br />

v The OptoSnapIoMemMapX ActiveX component has a variant-only version of this method.<br />

The following methods help to get <strong>and</strong> set integer <strong>and</strong> float values in byte blocks. They are<br />

helpful when using the WriteBlock <strong>and</strong> ReadBlock methods described in the previous table.<br />

Block Helper Methods Description<br />

GetLongAtBlockIndex<br />

[in] by_array byBlock<br />

[in] short nIndex<br />

[out] long pnValue<br />

GetFloatAtBlockIndex<br />

[in] by_array byBlock<br />

[in] short nIndex<br />

[out] float pfValue<br />

Retrieves a long value at the given index in the given byte array.<br />

Retrieves a float value at the given index in the given byte array.<br />

SNAP Ethernet-Based I/O Units Protocols <strong>and</strong> Programming Guide 75

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!