Description
Reads the random number parameters. The parameter numbers are specified by the array of long type ("prm_no[]"). And the number of the array is specified by "num".
The information of parameters is stored to the array of IODBPRM structure. If an invalid parameter number is specified, the type field of the IODBPRM structure is -1. In case of non-axis type parameter, the parameter value is stored to the data[0] of the IODBPRM structure. And, in case of axis-type parameter, the parameter value is stored to the data array of the structure.
All parameter values are stored to long type. So your application have to cast them according to the type information.
See the "PARAMETER MANUAL" of CNC for details of each parameter.
The spindle parameters have an axis attribute, and the data for number of spindle are valid.
Universal Fanuc Driver
Fanuc Focas Library CD
Declaration
Arguments
Specify the library handle. See "Library handle" for details.
Specify the pointer to the array of the parameter numbers.
See the "PARAMETER MANUAL" of CNC about available parameter number.
It can be got by cnc_rdparanum function and cnc_rdparainfo function.
Specify the number of the parameters to be read.
Specify the pointer to the array of IODBPRM structure to store the parameters. The number of array must be equal to "num". The IODBPRM structure is as follows.
typedef struct iodbprm {
long datano; /* parameter number */
short type; /* type information */
short axis; /* axis information */
short info; /* attribute */
short unit; /* unit */
struct {
long prm_val; /* parameter value */
long dec_val; /* place of decimal point */
} data[32];
} IODBPRM;
- datano
- Parameter number which was read is stored.
- type
- Type information of parameter which was read is stored.
-
0 : bit type 1 : byte type 2 : word type 3 : 2-word type 4 : real type ( Series 15i, 30i, 0i-D/F, PMi-A ) -1 : invalid parameter - axis
- Axis information of parameter which was read is stored.
bit 0 : axis attribute 0 : without axis 1 : with axis bit 1 : spindle parameter 0 : no spindle 1 : spindle bit 2,..,15 : (reserve) - info
- Attribute of parameter which was read is stored.
bit 0 : sign 0 : with sign 1 : without sign bit 1 : settings input 0 : disable 1 : enable bit 2 : write protection 0 : enable 1 : disable bit 3 : power must be off after writing 0 : not necessary 1 : necessary bit 4 : read protection 0 : enable 1 : disable bit 5,..,15 : (reserve) - unit
- Unit of real type parameter which was read is stored.
bit 0, 1 : attribute 0 : no real type 1 : input unit 2 : output unit bit 2,..,4 : unit 0 : without unit 1 : unit of length 2 : unit of angle 3 : unit of length + angle 4 : unit of velocity bit 5,..,15 : (reserve) - data
- Value of parameter which was read is stored.
prm_val : Value of parameter dec_val : Place of decimal point (only available for real type)
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 parameters (num) is 0 or less. |
(17) |
( Series 16i/18i/21i, 0i-A/B/C ) |
As for the other return codes or the details, see "Return status of Data window function"
CNC option
For HSSB connection,
For Ethernet connection,
The Ethernet function and the extended driver/library function are necessary. However, in case of Series 16i/18i/21i-B, 0i-B/C/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.
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_rdparam cnc_wrparam cnc_rdparar cnc_wrparas cnc_rdparainfo cnc_rdparanum
Example(C Language)
The following program reads the parameter No.20 and No.1020, and displays them.
#include "fwlib32.h"
void example()
{
IODBPRM prm[2];
long prmno[2];
short ret;
prmno[0] = 20;
prmno[1] = 1020;
ret = cnc_rdparam_ext( h, prmno, 2, prm ) ;
if ( !ret ) {
printf( "No.20: = %d\n", prm[0].data[0].prm_val );
printf( "No.1020:\n" );
printf( " 1st axis = %d\n", prm[1].data[0].prm_val );
printf( " 2nd axis = %d\n", prm[1].data[1].prm_val );
printf( " 3rd axis = %d\n", prm[1].data[2].prm_val );
}
}
Example(C#)
The following program reads the parameter No.20 and No.1020, and displays them.
class example
{
public void sample()
{
Focas1.IODBPRM2 prm = new Focas1.IODBPRM2();
int[] prmno = new int[2];
short ret;
byte[] bytes = new byte[Marshal.SizeOf(prm) * 2];
IntPtr ptrWork = Marshal.AllocCoTaskMem(Marshal.SizeOf(prm));
prmno[0] = 20;
prmno[1] = 1020;
ret = Focas1.cnc_rdparam_ext(h, prmno, 2, bytes);
if (ret == Focas1.EW_OK)
{
int pos = 0;
Marshal.Copy(bytes, pos, ptrWork, Marshal.SizeOf(prm));
Marshal.PtrToStructure(ptrWork, prm);
Console.WriteLine("No.20: = {0}", prm.data.data1.prm_val);
pos += Marshal.SizeOf(prm);
Marshal.Copy(bytes, pos, ptrWork, Marshal.SizeOf(prm));
Marshal.PtrToStructure(ptrWork, prm);
Console.WriteLine("No.1020:");
Console.WriteLine(" 1st axis = {0}", prm.data.data1.prm_val);
Console.WriteLine(" 2nd axis = {0}", prm.data.data2.prm_val);
Console.WriteLine(" 3rd axis = {0}", prm.data.data3.prm_val);
}
Marshal.FreeCoTaskMem(ptrWork);
}
}