Description
Writes 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 "pmacror" 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 pointer to the number of P code macro variable.
The number which was written actually is returned.
0 | : | conversation |
1 | : | auxiliary |
2 | : | execution |
Specify the array for written P code macro variables.
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_rdpmacror2 cnc_rdpmacroinfo cnc_rdpmacroinfo2 cnc_getpmactype cnc_setpmactype
Example(C Language)
The method of writing "vacant" data.
#include "fwlib32.h"
void example( void )
{
unsigned long s_no = 20000;
unsigned long num;
unsigned short type = 0;
double mcval;
long *wval;
short ret;
num = 1;
wval = (long*)&mcval;
*wval++ = (long)0xffffffff;
*wval = (long)0xffffffff;
ret = cnc_wrpmacror2( Hndl, s_no, &num, type, &mcval );
}
Example(C#)
The method of writing "vacant" data.
class example
{
public void sample()
{
uint s_no = 20000;
uint num;
ushort type = 0;
double mcval;
byte[] byteArray = new byte[8];
short ret;
num = 1;
for (int idx = 0; idx < 8; idx++)
{
byteArray[idx] = 0xff;
}
mcval = BitConverter.ToDouble(byteArray, 0);
ret = Focas1.cnc_wrpmacror2(h, s_no, ref num, type, mcval);
}
}