VTSGetAddr
This subroutine is not a part of the VTScada API. You must write it as part of your communications driver.
Address | ||||||||||||||||||||||||||||||
The raw address from the I/O tag's Address field. This is often a text string, but may be a numeric value. The contents of this parameter are driver-specific. It is the job of this module to interpret the address. The data type to read from or write to is usually implied by the address. If it is not, the strings shown in the following table may be appended to the address (without spaces) to force the data to be interpreted as a specific type (e.g. "40001/UDWord"). If you intend the address to be numeric, you should ensure this by casting it to a numeric value.
|
||||||||||||||||||||||||||||||
MemAddr | ||||||||||||||||||||||||||||||
Assists the VTScada code in creating efficient driver read and write calls. PLC I/O locations with different MemAddr values and the same values for the Info1, Info2, and Info3 parameters are coalesced into the same read block, provided they are within VTSMaxBlock, or the return of VTSMaxBlock(Info1, Info2, Info3, DataType) values of each other. The MemAddr variable should be one of two data types:
VTScada driver code behaves differently, depending on the data type of the variable's contents. This variable is usually a pointer to an integer. If the value is to be a number, make sure a text string is not returned if the value was extracted from the Address string. If a driver does not use integers to denote an address, return the text string in the MemAddr parameter. The VTSRead module and the VTSWrite module are passed an array of strings rather than a memory starting address. This means, if you set MemAddr to a text value, such as "100" the VTScada code interprets this as a text address rather than a numeric one. This means that the coalescing will not pay any heed to the actual value of the address, but will simply pass an array of text strings to the VTSRead or VTSWrite in the MemAddr parameter. |
||||||||||||||||||||||||||||||
BitNumber | ||||||||||||||||||||||||||||||
A pointer to the integer bit number within the memory address specified by MemAddr. This value may be set to invalid if there is no bit value. | ||||||||||||||||||||||||||||||
Info1, Info2, Info3 | ||||||||||||||||||||||||||||||
Pointers to values that are used by the VTScada code to determine which addresses can be coalesced into a larger read block. These parameters are also passed to the VTSRead and VTSWrite subroutines. Any values that are not required should be set to "0" (i.e. they must be a valid value). These values are typically set to such things as file type or data area. Any differences between the values of the three Info parameters and those of another Address will prevent those addresses from being coalesced (i.e. grouped into the same read request). Info1 must be a number. A string value will not work. If your code sets Info1 to a string value, the SetData module in VTSDrvr.web will not work correctly, and client computers will not display the results of the driver server computer's read commands. For example, an analog input that is drawn on the screen will always have invalid contents if the Info parameters are set to strings (such as "abc"), rather than a number. |
||||||||||||||||||||||||||||||
DataType | ||||||||||||||||||||||||||||||
A pointer to a value that holds the data type preferred for the specified address. If left invalid the default data type will be 2 (16-bit unsigned integer). This value will be overridden by the explicit data type specified as an appended string to the address. The MemAddr, BitNum, Info1, Info2, Info3, and DataType parameters are pointer values, and must be set by dereferencing them before assigning the values (i.e. using an asterisk "*" before the variable name (please refer to "Pointers" for further details on pointers and dereferencing). |
||||||||||||||||||||||||||||||
Read | ||||||||||||||||||||||||||||||
Specifies whether the address will be used for a Read or a Write command. If true, the address is used for reading data, otherwise it is used for writing data. Most drivers ignore this parameter since there is usually no difference in the returned values for reads and writes. | ||||||||||||||||||||||||||||||
Rate | ||||||||||||||||||||||||||||||
A pointer to the scan rate of the I/O device. This may be an Invalid pointer. |
Comments:
The VTSGetAddr subroutine must return an error code. If the return value is not 0, the VTScada code assumes that there is an error in the address and it will not include that tag when coalescing the block.
You are advised to use unsigned data over signed data for the default data type as it is much easier to work with via ArrayToBuff and BuffToArray