10.4.8. B (BUFV)
10.4.8. B (BUFV)
This buffer can store binary data regardless of the data type with a total size of 64 Kbytes. The argument(index) starts with 0 (0-based).
When multitasking is used, each task will have an independent BUFV.
BUFV0 ~ BUFV65535
or
BUFV[0] ~ BUFV[65535]
When the binary at a specific position in the buffer is to be handled as the desired type, the type property can be used.
The type property types for use are as follows.
endian | Property | type |
Big endian | S1 | signed integer (1byte) |
S2 | signed integer (2byte) | |
S4 | signed integer (4byte) | |
U1 | unsigned integer (1byte) | |
U2 | unsigned integer (2byte) | |
U4 | unsigned integer (4byte) | |
F4 | single prec. real (4byte) | |
F8 | double prec. real (8byte) | |
Little endian | s1 | signed integer (1byte) |
s2 | signed integer (2byte) | |
s4 | signed integer (4byte) | |
u1 | unsigned integer (1byte) | |
u2 | unsigned integer (2byte) | |
u4 | unsigned integer (4byte) | |
f4 | single prec. real (4byte) | |
f8 | double prec. real (8byte) |
Example No.1 :
If the 4 bytes starting from the position of offset 24 in BUFV are to be interpreted as integer values in the little-endian format and then assigned to the g_iY variable, the assignment statement shown below must be executed.
g_iY = BUFV[24].s4
“.s4”. represents the type property. “s”r efers to the signed integer, and “4” refers to 4 bytes. Because “s” in in lowercase, it shall be interpreted as little-endian.
Example No. 2 :
If the operation result is to be saved in 8 bytes, starting from the position of offset 1500 in BUFV in the big-endian double precision real number format, the assignment statement shown below must be executed.
BUFV[1500].f8=(V5!+140.8)/2.5