Reads the setting data specified by "s_number","e_number","axis"(only
for the setting data with axis). The data format depends on each
setting data. The format of Byte/Word/2-Word setting data is generally
signed binary.
Reads the setting data for all axes specified range by specifying
'ALL_AXES' in 'axis'.
The attribute of setting data depends on the type and axis, and it is
different for each setting data. It is as follows, and can be got by cnc_rdsetinfo function.
Setting data type
Meaning
Byte size
Bit setting data
Every bits have each definition.
1
Bit setting data with axis
Every bits have each definition. (each axis)
1
Byte setting data
1-byte data is stored.
1
Byte setting data with axis
1-byte data is stored. (each axis)
1
Word setting data
2-byte data is stored.
2
Word setting data with axis
2-byte data is stored. (each axis)
2
2-Word setting data
4-byte data is stored.
4
2-Word setting data with axis
4-byte data is stored. (each axis)
4
Real setting data (only Series 15i, 30i, 0i-D/F, PMi-A)
4-byte data which indicates value of variable and 4-byte data which indicates number of places of decimals are stored.
8
Real setting data with axis (only Series 15i, 30i, 0i-D/F, PMi-A)
4-byte data which indicates value of variable and 4-byte data which indicates number of places of decimals are stored. (each axis)
8
It is impossible to read any bit setting data bit by bit. 8 bits(i.e. 1 byte) which belong to the same setting data number are read at the same time.
This function is the same as cnc_rdparar function except that it cannot read the parameter without setting attribute.
See the "PARAMETER MANUAL" of CNC for details of each setting data.
#include "fwlib32.h" or "fwlib64.h"FWLIBAPI short WINAPI cnc_rdsetr(unsigned short FlibHndl, short *s_number, short axis, short *e_number, short *length, void *set);
Arguments
FlibHndl
[ in ]
Specify the library handle. See "Library handle" for details.
s_number
[ in/out ]
Specify the start setting data number.
The setting data number which was read first is returned.
See the "PARAMETER MANUAL" of CNC about available setting data
number.
It can be got by cnc_rdsetnum function and cnc_rdsetinfo function.
e_number
[ in/out ]
Specify the end setting data number.
The setting data number which was read last is returned.
The new setting data may be added according to updating CNC
software, addition of the new function, etc. If the new
setting data is added within reading range, the error(Return:
EW_LENGTH) may be returned or the application program may not
work correctly. In order to avoid these problems, specify the
continuous numbers of existing setting data as the reading
range.
axis
[ in ]
Specify the axis number.
0
:
assigns no axis
1,..,m
:
assigns 1 axis(m=max. controlled axes)
ALL_AXES
:
assigns all axes(ALL_AXES=-1)
None axis type setting data can be read even if any value is
specified in "axis". In case that an axis type setting data
exists in the specified range, the error(Return:EW_ATTRIB) is
returned by specifying "axis=0".
length
[ in/out ]
Specify the data block length which is enough to store the
specified setting data.
The structure per 1 setting data is as follows, and each
setting data is lined up in order of number.
[= Sum of (4+(byte size of each setting data)
*(number of axis))]
Because the size which was read actually is returned, it is
possible to specify the length more than the actual size.
In case that the size of setting data is 2 byte, the IODBPSD
structure is as follows.
In case that the size of setting data is 1 or 2 byte and the
length per 1 setting data is not a multiple of 4, 'dummy' is
necessary at the end of structure. In case that its size is 4
or 8 byte, the size of data part per 1 setting data or 1 axis
is 4 or 8 byte, and so 'dummy' is not necessary.
IODBPSD
no axis/1 axis
all axes
n = Maximum controlled axes
In case of Series 15i, 16/18/21, 16i/18i/21i, 0i, 30i, Power Mate i and PMi-A, the spindle setting data has an axis attribute, and the data for number of spindle are valid.
set
[ out ]
Pointer to the area to store the setting data. Each setting data can be referred by using the IODBPSD structure.
Series 15, 16/18/21, 16i/18i/21i, 0i-A/B and Power Mate i
typedef struct iodbpsd {
short datano; /* setting data number */
short type; /* upper byte:type */
/* lower byte:axis */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
char cdatas[MAX_AXIS]; /* bit/byte set. data with axis*/
short idatas[MAX_AXIS]; /* word setting data with axis*/
long ldatas[MAX_AXIS]; /* 2-word set. data with axis */
} u ;
} IODBPSD ; /* MAX_AXIS : max. controlled axes */
Series 15i, 30i, 0i-D/F, PMi-A and Ethernet connection
typedef struct realprm { /* real setting data */
long prm_val; /* value of variable */
long dec_val; /* number of places of decimals */
} REALPRM;
typedef struct iodbpsd {
short datano; /* setting data number */
short type; /* upper byte:type */
/* lower byte:axis */
union {
char cdata; /* bit/byte setting data */
short idata; /* word setting data */
long ldata; /* 2-word setting data */
REALPRM rdata; /* real setting data */
char cdatas[MAX_AXIS];/*bit/byte set. data with axis*/
short idatas[MAX_AXIS];/* word set. data with axis */
long ldatas[MAX_AXIS];/* 2-word set. data with axis */
REALPRM rdatas[MAX_AXIS];/* real set. data with axis */
} u;
} IODBPSD ; /* MAX_AXIS : max. controlled axes */
datano
Setting data number which was read is stored.
type
Attribute of setting data which was read is stored.
Upper byte:type
0
:
bit type
1
:
byte type
2
:
word type
3
:
2-word type
4
:
real type (only Series 15i, 30i, 0i-D/F, PMi-A)
Lower byte:axis
0
:
no axis
1,..,m
:
1 axis(m=max. controlled axes)
ALL_AXES
:
all axes(ALL_AXES=-1)
rdata, rdatas ( Series 15i, 30i, 0i-D/F, PMi-A )
Real setting data is stored. The value of variable is stored in prm_val, and the number of places of decimals is stored in dec_val.
Real setting data = prm_val * 10 ** (-dec_val)
(Example) When the value of real setting data is 12.345, prm_val and dec_val are read as follows.
prm_val = 12345 dec_val = 3
Return
EW_OK is returned on successful completion, otherwise any value except EW_OK is returned.
The major error codes are as follows.
Return code
Meaning/Error handling
EW_LENGTH (2)
Data block length error Size of area to store setting data(length) is wrong.
EW_NUMBER (3)
Data number error Setting data number(s_number, e_number) is wrong.