Description
Reads the P code macro variables(variables for the macro-executor) specified by the starting number, "stnum", and number of variables, "*num". The data is stored in "mcval" with double format. It is not influenced by setting of cnc_setpmactype function.
The value of an undefined variable is called "vacant", and it is expressed as follows.
0xFFFFFFFFFFFFFFFF
See the "PROGRAMING MANUAL" of the macro-executor for details of the P code macro variable.
Universal Fanuc Driver
Fanuc Focas Library CD
Declaration
Arguments
Specify the library handle. See "Library handle" for details.
Specify the starting P code macro variable number.
Please refer to the document of the cnc_rdpmacroinfo2 for the range of variable.
Specify the number of P code macro variables to be read.
This function returns the total number of variables that was actually read.
0 | : | conversation |
1 | : | auxiliary |
2 | : | execution |
Specify the array for read P code macro variables.
When the variable is "vacant", the 0xFFFFFFFFFFFFFFFF is set.
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 |
---|---|
(2) |
The number of P code macro variables(*num) is 0 or less. |
(3) |
P code macro variable number(stnum) is wrong. |
(4) |
Type of P code macro variables(type) is wrong. |
(6) |
This function needs the macro-executor option. |
As for the other return codes or the details, see "Return status of Data window function"
CNC option
This function need the following CNC option.
For HSSB connection,
For Ethernet connection,
The Ethernet function and the extended driver/library function are necessary. However, in case of Series 0i-D/F, Series 30i and PMi-A, the required CNC option is as follows. When Embedded Ethernet is used,above two optional functions are not required.
When Ethernet board is used,
- only Ethernet function is required.
CNC parameter
This function is not related to CNC parameter.
But, this function is related to the compile parameter of the macro-executor. See the "PROGRAMING MANUAL" of the macro-executor for details of the compile parameter.
CNC mode
This function can be used in any CNC mode.
Available CNC
0i-A | 0i-B/C(Note) | 0i-D | 0i-F | 15 | 15i | 16 | 18 | 21 | 16i-A | 18i-A | 21i-A | 16i-B | 18i-B | 21i-B | 30i-A | 30i-B | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
M (Machining) | |||||||||||||||||
T (Turning) | - | ||||||||||||||||
LC (Loader) | - | - | - | - | - | - | - | - |
0i-D | 0i-F | 16i | 18i | 30i-A | 30i-B | |
---|---|---|---|---|---|---|
P (Punch press) | - | |||||
L (Laser) | - | - | - | - | ||
W (Wire) | - | - |
Power Mate i-D | |
Power Mate i-H | |
Power Motion i-A | O |
"O" | : | Both Ethernet and HSSB | |
"E" | : | Ethernet | |
"H" | : | HSSB | |
"X" | : | Cannot be used | |
"-" | : | None |
Note) 0i-C does not support the HSSB function.
See Also
cnc_rdpmacro cnc_wrpmacro cnc_rdpmacror cnc_wrpmacror cnc_wrpmacror2 cnc_rdpmacroinfo cnc_rdpmacroinfo2 cnc_getpmactype cnc_setpmactype
Example(C Language)
The method of judging "vacant" data.
#include "fwlib32.h"
void example( void )
{
short ret;
unsigned long s_no = 20000;
unsigned long num;
unsigned short type = 0;
double mcval;
long *rval;
long lval;
long hval;
num = 1;
ret = cnc_rdpmacror2( Hndl, s_no, &num, type, &mcval );
rval = (long*)&mcval;
lval = (long)(*rval++);
hval = (long)(*rval);
if (( lval == (long)0xffffffff ) && ( hval == (long)0xffffffff )) {
; // "vacant"
}
}
Example(C#)
The method of judging "vacant" data.
class example
{
public void sample()
{
short ret;
uint s_no = 20000;
uint num;
ushort type = 0;
byte[] mcval = new byte[8];
uint lval;
uint hval;
num = 1;
ret = Focas1.cnc_rdpmacror2(h, s_no, ref num, type, mcval);
lval = (uint)((mcval[3] << 24) | (mcval[2] << 16) | (mcval[1] << 8) | mcval[0]);
hval = (uint)((mcval[7] << 24) | (mcval[6] << 16) | (mcval[5] << 8) | mcval[4]);
if ((lval == 0xffffffff) && (hval == 0xffffffff))
{
; // "vacant"
}
}
}