Description
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 diagnosis data numbers.
See the "MAINTENANCE MANUAL" of CNC about available diagnosis number. It can be got by cnc_rddiagnum function and cnc_rddiaginfo function.
Specify the number of the diagnosis data to be read.
Specify the pointer to the array of IODBPRM structure to store the diagnosis data. The number of array must be equal to "num".
The IODBPRM structure is as follows.
typedef struct iodbprm {
long datano; /* diagnosis data number */
short type; /* type information */
short axis; /* axis information */
short info; /* attribute */
short unit; /* unit */
struct {
long prm_val; /* diagnosis data value */
long dec_val; /* place of decimal point */
} data[32];
} IODBPRM;
0 | : | byte type |
1 | : | word type |
2 | : | 2-word type |
3 | : | bit type (8 bit) |
4 | : | bit type (1 bit : except Series 15i) |
5 | : | real type (only Series 15i, 30i, 0i-D/F, PMi-A) |
-1 | : | invalid diagnosis data |
bit 0 | : | axis attribute |
0 | : | without axis |
1 | : | with axis |
0 | : | no spindle |
1 | : | spindle |
bit 0 | : | sign |
0 | : | with sign |
1 | : | without sign |
bit 0, 1 | : | unit |
0 | : | without unit |
1 | : | % |
2 | : | RPM |
prm_val | : | Value of diagnosis data |
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 diagnosis data (num) is 0 or less. |
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_diagnoss cnc_diagnosr cnc_rddiaginfo cnc_rddiagnum
Example(C Language)
The following program reads the diagnosis data No.300 and No.410, and displays them.
(Series 16i/18i/21i, 0i, Power Mate i)
#include "fwlib32.h"
void example()
{
IODBPRM prm[2];
long prmno[2];
short ret;
prmno[0] = 300;
prmno[1] = 410;
ret = cnc_rddiag_ext( h, prmno, 2, prm ) ;
if ( !ret ) {
printf( "No.300:\n" );
printf( " 1st axis = %d\n", prm[0].data[0].prm_val );
printf( " 2nd axis = %d\n", prm[0].data[1].prm_val );
printf( " 3rd axis = %d\n", prm[0].data[2].prm_val );
printf( "No.410: = %d\n", prm[1].data[0].prm_val );
}
}
Example(C#)
The following program reads the diagnosis data No.300 and No.410, and displays them.
(Series 16i/18i/21i, 0i, Power Mate i)
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] = 300;
prmno[1] = 410;
ret = Focas1.cnc_rddiag_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.300:");
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);
pos += Marshal.SizeOf(prm);
Marshal.Copy(bytes, pos, ptrWork, Marshal.SizeOf(prm));
Marshal.PtrToStructure(ptrWork, prm);
Console.WriteLine("No.410: = {0}", prm.data.data1.prm_val);
}
Marshal.FreeCoTaskMem(ptrWork);
}
}