VR10AscToSWr
V = Variables
R = Reading functions
ASCII —→ SIGNED WORD
The VR10AscToSWr function converts an Ascii variable type in an signed Word type (word with sign).
IMPLEMENTATION
VR10AscToSWr (array, index, return, errcode)
Parameters:
IN/OUT | VARIABLE TYPE | EXAMPLE NAME | DIM | |
---|---|---|---|---|
IN | ARRGBL | array | B | Array containing the data to be converted (must be declared with at least “index + 4” items) |
IN | GLOBAL | index | L | Index of the array element at the beginning of the data |
OUT | GLOBAL | return | W | Data value converted |
OUT | GLOBAL | errcode | F | Variable that indicates a possible error on the function |
Errcode
After calling the function, 'errcode' can take certain values, the meaning of these values is summarized below:
0: No error
1: Error: ASCII value is not within 48÷57 or 65÷70
Example
Transforms the Ascii value 005Ah in an signed word value
index = 1 array[1] = 48 array[2] = 48 array[3] = 53 array[4] = 65 VR10AscToSWr (array, index, return, errcode) ;On the return data you will find : ; return = 90