News CNCnetPDM About us Support  
         
  

CNC_RDDIAG_EXT | MISC

Description

Reads the random number diagnosis data. The diagnosis data numbers are specified by the array of long type ("prm_no[]"). And the number of the array is specified by "num".

The information of diagnosis data is stored to the array of IODBPRM structure. If an invalid diagnosis data number is specified, the type field of the IODBPRM structure is -1. In case of non-axis type diagnosis data, the diagnosis data value is stored to the data[0] of the IODBPRM structure. And, in case of axis-type diagnosis data, the diagnosis data value is stored to the data array of the structure.

All diagnosis data values are stored to long type. So your application have to cast them according to the type information.

See the "MAINTENANCE MANUAL" of CNC for details of each diagnosis data.

MTConnect Fanuc Adapter

Universal Fanuc Driver

Fanuc Focas Library CD

Declaration

#include "fwlib32.h" or "fwlib64.h"

FWLIBAPI short WINAPI cnc_rddiag_ext(unsigned short FlibHndl, long *prm_no, short num, IODBPRM *param);

Arguments

FlibHndl   [ in ]

Specify the library handle. See "Library handle" for details.

prm_no   [ in ]

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.

num   [ in ]

Specify the number of the diagnosis data to be read.

param   [ out ]

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;
datano
diagnosis data number which was read is stored.
type
Type information of diagnosis data which was read is stored.
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
axis
Axis information of diagnosis data which was read is stored.
bit 0
: axis attribute
0
: without axis
1
: with axis
bit 1
: spindle data
0
: no spindle
1
: spindle
bit 2,..,15
: (reserve)
info
Axis information of diagnosis data which was read is stored.
bit 0
: sign
0
: with sign
1
: without sign
bit 1,..,15 : (reserve)
unit
Unit of diagnosis data which was read is stored.
bit 0, 1
: unit
0
: without unit
1
: %
2
: RPM
bit 2,..,15 : (reserve)
data
Value of diagnosis data which was read is stored.
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
EW_LENGTH
(2)
Data block length error
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,

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)X E O O X E X X X E E E E E E O O
T (Turning) X E O O X - X X X E E E E E E O O
LC (Loader) - - - - - - X X X X X X X X X - -

0i-D0i-F16i18i30i-A30i-B
P (Punch press)O O E E - O
L (Laser) - - E - - O
W (Wire) - - X X O O


Power Mate i-DE
Power Mate i-HE
Power Motion i-AO

"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);
    }
}

Privacy notice

This website uses cookies. By continuing to use it you agree to our privacy policy. 

https://www.inventcom.net/fanuc-focas-library/misc/cnc_rddiag_extFanuc Focas Library | Misc | cnc_adcnv
Description Reads the A/D conversion data. The A/D conversion data is stored in "data" of "ODBAD".... [read more]cnc_adcnvFanuc Focas Library | Misc | cnc_alarm
Description Reads the alarm status of CNC. Various information is stored in "data" of ODBALM. This function is used for watching CNC's alarm... [read more]cnc_alarmFanuc Focas Library | Misc | cnc_alarm2
Description Reads the alarm status of CNC. This function is the improved version of the... [read more]cnc_alarm2Fanuc Focas Library | Misc | cnc_cexesramsize
Description Reads the maximum size of the SRAM variable area for C language executor. The maximum size is read by the unit of byte.... [read more]cnc_cexesramsizeFanuc Focas Library | Misc | cnc_chgprotbit
Description Sets the state of various NC data protection (protection pattern data). The protection pattern data is bit pattern data which collects flags corresponding to... [read more]cnc_chgprotbitFanuc Focas Library | Misc | cnc_clralm
Description Clears the CNC alarm state specified by "id".... [read more]cnc_clralmFanuc Focas Library | Misc | cnc_diagnosr
Description Reads the diagnosis data specified by "s_number","e_number","axis"(only for the diagnosis data with axis). The data format depends on each diagnosis data. The... [read more]cnc_diagnosrFanuc Focas Library | Misc | cnc_diagnoss
Description Reads the diagnosis specified by "number","axis" (only for the diagnosis with axis). The data format depends on each diagnosis. The format of Byte/Word/2-Word... [read more]cnc_diagnossFanuc Focas Library | Misc | cnc_fromget
Description Reads the F-ROM data from CNC. After F-ROM data reading, execute... [read more]cnc_fromgetFanuc Focas Library | Misc | cnc_fromgetend
Description Indicates the termination of reading the F-ROM data from CNC.... [read more]cnc_fromgetendFanuc Focas Library | Misc | cnc_fromgetstart
Description Indicates the start of reading the F-ROM data from CNC. However, the system control software cannot be... [read more]cnc_fromgetstartFanuc Focas Library | Misc | cnc_fromput
Description Writes the F-ROM data to CNC. After F-ROM data writing, execute... [read more]cnc_fromputFanuc Focas Library | Misc | cnc_fromputend
Description Indicates the termination of writing the F-ROM data to CNC. This function waits until the termination of writing process of the F-ROM data on CNC.... [read more]cnc_fromputendFanuc Focas Library | Misc | cnc_fromputstart
Description Indicates the start of writing the F-ROM data to CNC. The data which can be written in F-ROM is system data (CNC Control software... [read more]cnc_fromputstartFanuc Focas Library | Misc | cnc_fromremove
Description Deletes the System data from F-ROM on CNC. However, the system control software cannot be deleted in the Ethernet version.... [read more]cnc_fromremoveFanuc Focas Library | Misc | cnc_getdtailerr
Description Gets the detailed error information after the function has been executed. The detailed error information is stored in "err_no", "err_dtno" of... [read more]cnc_getdtailerrFanuc Focas Library | Misc | cnc_getfigure
Description Reads the maximum valid figures and the number of decimal places under the input/output unit, which is related to various data of CNC. The... [read more]cnc_getfigureFanuc Focas Library | Misc | cnc_getfrominfo
Description Reads the various information of F-ROM on CNC. The various information is stored in each member of "ODBFINFORM".... [read more]cnc_getfrominfoFanuc Focas Library | Misc | cnc_getlanguage
Description The display language of NC is acquired.... [read more]cnc_getlanguageFanuc Focas Library | Misc | cnc_getlockstat
Description Gets the present state of various NC data protection.... [read more]cnc_getlockstatFanuc Focas Library | Misc | cnc_getpath
Description Reads the current selected path number which is the target path of the Data window functions.... [read more]cnc_getpathFanuc Focas Library | Misc | cnc_getsraminfo
Description Reads the various information of S-RAM on CNC. The various information is stored in each member of "ODBSINFO".... [read more]cnc_getsraminfoFanuc Focas Library | Misc | cnc_gettimer
Description Gets the date or time data from the calendar timer device of the CNC unit.... [read more]cnc_gettimerFanuc Focas Library | Misc | cnc_modal
Description Reads the modal information of CNC. Various information is stored in each member of ODBMDL. The readable modal data are modal G code or commanded data... [read more]cnc_modalFanuc Focas Library | Misc | cnc_rd3dcdcnv
Description Reads the mode and data of the 3-dimensional coordinate conversion. These are stored in each member of ODB3DCD structure. The... [read more]cnc_rd3dcdcnvFanuc Focas Library | Misc | cnc_rd3dtofs
Description Reads the mode and vector of the 3-dimensional tool compensation. These are stored in each member of ODB3DTO structure. The places of decimal... [read more]cnc_rd3dtofsFanuc Focas Library | Misc | cnc_rdalminfo
Description Reads the detailed information of currently arising CNC alarms. Various information is stored in "data" of ALMINFO. This function is... [read more]cnc_rdalminfoFanuc Focas Library | Misc | cnc_rdalmmsg
Description Reads the currently arising CNC alarm messages. All alarm messages can be read at once. Differing from... [read more]cnc_rdalmmsgFanuc Focas Library | Misc | cnc_rdalmmsg2
Description Reads the currently arising CNC alarm messages. All alarm messages can be read at once. Differing from... [read more]cnc_rdalmmsg2Fanuc Focas Library | Misc | cnc_rdbrstrinfo
Description Reads the data of block restart. These are stored in each member of ODBBRS structure. The destination and the distance to go of block restart are valid... [read more]cnc_rdbrstrinfoFanuc Focas Library | Misc | cnc_rdcdrotate
Description Reads the mode and data of the coordinate rotation. These are stored in each member of ODBROT structure. The places of decimal points can be got by... [read more]cnc_rdcdrotateFanuc Focas Library | Misc | cnc_rdcexesram
Description Reads the SRAM variable area for C language executor specified by "offset", "length". When this function accesses this area, exclusive control with the C... [read more]cnc_rdcexesramFanuc Focas Library | Misc | cnc_rdcncid
Description Reads the CNC ID number. The CNC ID numbers are stored in "cncid" with unsigned binary format.... [read more]cnc_rdcncidFanuc Focas Library | Misc | cnc_rdcommand
Description Reads the commanded data of CNC. Various information is stored in each member of ODBCMD. The readable data are the modal data except G code, and the... [read more]cnc_rdcommandFanuc Focas Library | Misc | cnc_rdcoordnum
Description Reads the number of the additional workpiece coordinate systems of the workpiece coordinate systems.... [read more]cnc_rdcoordnumFanuc Focas Library | Misc | cnc_rddiaginfo
Description Reads the CNC diagnosis data information specified by "s_number" and "read_no". The CNC diagnosis data is basically non-continuous, and the attribute like... [read more]cnc_rddiaginfoFanuc Focas Library | Misc | cnc_rddiagnum
Description Reads minimum, maximum, total number of the CNC diagnosis data. The distribution of the diagnosis data is different in each CNC model, and the new diagnosis... [read more]cnc_rddiagnumFanuc Focas Library | Misc | cnc_rdetherinfo
Description Reads the Ethernet board inforamtion in CNC.... [read more]cnc_rdetherinfoFanuc Focas Library | Misc | cnc_rdfixcycle
Description Reads the mode and data of the canned cycle. These are stored in each member of ODBFIX structure. The places of decimal points can be got by... [read more]cnc_rdfixcycleFanuc Focas Library | Misc | cnc_rdgcode
Description Reads the information of CNC about the commanded G code. Various information is stored in each member of ODBGCD. The readable data are modal G code and one... [read more]cnc_rdgcodeFanuc Focas Library | Misc | cnc_rdlenofs
Description Reads the mode and vector of the tool length compensation. These are stored in each member of ODBLOFS structure. The places of decimal... [read more]cnc_rdlenofsFanuc Focas Library | Misc | cnc_rdmdlconfig
Description Reads the module configuration of CNC system. These information are stored in each member of ODBMDLC. Reading the data which depends on the path... [read more]cnc_rdmdlconfigFanuc Focas Library | Misc | cnc_rdmdlconfig2
Description Reads the module configuration of CNC system.... [read more]cnc_rdmdlconfig2Fanuc Focas Library | Misc | cnc_rdmenuswitch
Description Reads the menu switch signals.... [read more]cnc_rdmenuswitchFanuc Focas Library | Misc | cnc_rdmirimage
Description Reads the mode of the programmable mirror image and the absolute position of center of mirror image. These are stored in each member of ODBMIR... [read more]cnc_rdmirimageFanuc Focas Library | Misc | cnc_rdopmsg
Description Reads the contents of the operator's message in CNC. The operator's message is stored in "data" of "OPMSG".... [read more]cnc_rdopmsgFanuc Focas Library | Misc | cnc_rdopmsg2
Description Reads the contents of the operator's message in CNC. The operator's message is stored in "data" of "OPMSG2". This function can be used in... [read more]cnc_rdopmsg2Fanuc Focas Library | Misc | cnc_rdopmsg3
Description Reads the contents of the operator's message in CNC. The operator's message is stored in "data" of "opmsg".... [read more]cnc_rdopmsg3Fanuc Focas Library | Misc | cnc_rdopnlgnrl
Description Reads the general output signal image of software operator's panel.... [read more]cnc_rdopnlgnrlFanuc Focas Library | Misc | cnc_rdopnlgsname
Description Reads the general signal name of software operator's panel.... [read more]cnc_rdopnlgsnameFanuc Focas Library | Misc | cnc_rdopnlsgnl
Description Reads the output signal image of software operator's panel.... [read more]cnc_rdopnlsgnlFanuc Focas Library | Misc | cnc_rdpm_cncitem
Description Reads the item name relating the cnc specified by the item index.... [read more]cnc_rdpm_cncitemFanuc Focas Library | Misc | cnc_rdpm_item
Description Reads all data specified by the item index. The acquired data is as follows. - Name - Life count... [read more]cnc_rdpm_itemFanuc Focas Library | Misc | cnc_rdpm_mcnitem
Description Reads the item name relating the machine specified by the item index.... [read more]cnc_rdpm_mcnitemFanuc Focas Library | Misc | cnc_rdposofs
Description Reads the mode and vector of the tool position compensation. These are stored in each member of ODBPOFS structure. The... [read more]cnc_rdposofsFanuc Focas Library | Misc | cnc_rdprstrinfo
Description Reads the program restart information. The program restart information is stored in each member of "ODBPRS".... [read more]cnc_rdprstrinfoFanuc Focas Library | Misc | cnc_rdradofs
Description Reads the mode and vector of the cutter compensation(tool nose radius compensation). These are stored in each member of... [read more]cnc_rdradofsFanuc Focas Library | Misc | cnc_rdrepeatval
Description Get the counter of the subprogram call and the repeat for fixed cycle. In case of subprogram call, the remainder counter is acquired.... [read more]cnc_rdrepeatvalFanuc Focas Library | Misc | cnc_rdrepeatval_ext
Description Get the counter of the subprogram call and the repeat for fixed cycle. The total repetition number and the remainder counter are... [read more]cnc_rdrepeatval_extFanuc Focas Library | Misc | cnc_rdscaling
Description Reads the mode and data of the scaling. These are stored in each member of ODBSCL structure. The places of... [read more]cnc_rdscalingFanuc Focas Library | Misc | cnc_rdsyshard
Description Reads the hardware configuration of CNC. These information are stored in each member of ODBSYSH. The 25... [read more]cnc_rdsyshardFanuc Focas Library | Misc | cnc_rdsyssoft
Description Reads the series/version of CNC system software. These information are stored in each member of ODBSYSS. Reading the data which depends on the path needs... [read more]cnc_rdsyssoftFanuc Focas Library | Misc | cnc_rdsyssoft2
Description Reads the series/version of CNC system software. These information are stored in each member of ODBSYSS2. This function can read data which... [read more]cnc_rdsyssoft2Fanuc Focas Library | Misc | cnc_rdsyssoft3
Description Reads the series/version of CNC system software. These information are stored in each member of ODBSYSS3. This function can read the series/version... [read more]cnc_rdsyssoft3Fanuc Focas Library | Misc | cnc_rdtimer
Description Gets cutting time, cycle time, and other timer data of CNC.... [read more]cnc_rdtimerFanuc Focas Library | Misc | cnc_reset
Description Executes the external reset of CNC.... [read more]cnc_resetFanuc Focas Library | Misc | cnc_reset2
Description CNC is reset. When this function is executed, reset is executed to all paths or the path selected bt CNC... [read more]cnc_reset2Fanuc Focas Library | Misc | cnc_rstrseqsrch
Description Searches the sequence number for program restart.... [read more]cnc_rstrseqsrchFanuc Focas Library | Misc | cnc_rstrseqsrch2
Description Searches the sequence number for program restart.... [read more]cnc_rstrseqsrch2Fanuc Focas Library | Misc | cnc_setpath
Description Selects the path number which is the target path in the multi-path system or system with loader control. All Data window library functions input... [read more]cnc_setpathFanuc Focas Library | Misc | cnc_settimer
Description Sets the date or time data to the calendar timer device of the CNC unit.... [read more]cnc_settimerFanuc Focas Library | Misc | cnc_sramget
Description Reads the S-RAM data from CNC. The SRAM data which was read by this function should be restored by using the Boot function.(The SRAM... [read more]cnc_sramgetFanuc Focas Library | Misc | cnc_sramgetend
Description Indicates the termination of reading the S-RAM data from CNC.... [read more]cnc_sramgetendFanuc Focas Library | Misc | cnc_sramgetstart
Description Indicates the start of reading the S-RAM data from CNC.... [read more]cnc_sramgetstartFanuc Focas Library | Misc | cnc_statinfo
Description Reads the status information of CNC. The various information is stored in each member of "ODBST".... [read more]cnc_statinfoFanuc Focas Library | Misc | cnc_statinfo2
Description Reads the status information of CNC. The various information is stored in each member of "ODBST2".... [read more]cnc_statinfo2Fanuc Focas Library | Misc | cnc_sysconfig
Description Reads the CNC system configuration information. Various information is stored in each member of ODBSYSC. This function cannot be... [read more]cnc_sysconfigFanuc Focas Library | Misc | cnc_sysinfo
Description Reads system information such as kind of CNC system, Machining(M) or Turning(T), series and version of CNC system software and number of the controlled axes.... [read more]cnc_sysinfoFanuc Focas Library | Misc | cnc_sysinfo_ex
Description Reads system information such as distinction of Machining(M) or Turning(T), number of path and number of the controlled axes.... [read more]cnc_sysinfo_exFanuc Focas Library | Misc | cnc_wrcexesram
Description Writes the SRAM variable area for C language executor specified by "offset", "length". When this function accesses this area, exclusive control with the... [read more]cnc_wrcexesramFanuc Focas Library | Misc | cnc_wrmenuswitch
Description Writes the menu switch signals.... [read more]cnc_wrmenuswitchFanuc Focas Library | Misc | cnc_wropnlgnrl
Description Writes the general output signal of software operator's panel.... [read more]cnc_wropnlgnrlFanuc Focas Library | Misc | cnc_wropnlgsname
Description Writes the general signal name of software operator's panel.... [read more]cnc_wropnlgsnameFanuc Focas Library | Misc | cnc_wropnlsgnl
Description Writes the output signal of software operator's panel.... [read more]cnc_wropnlsgnlFanuc Focas Library | Misc | cnc_wrpm_item
Description Writes all data specified by the item index. The acquired data is as follows. - Name - Life count... [read more]cnc_wrpm_itemFanuc Focas Library | Misc | cnc_wrpm_mcnitem
Description Writes the item name relating the machine specified by the item index.... [read more]cnc_wrpm_mcnitemFanuc Focas Library | Misc | cnc_wrtimer
Description Sets cutting time, cycle time, and other timer data of CNC.... [read more]cnc_wrtimerFanuc Focas Library | Misc | flist_Misc
CNC: Function related to others... [read more]flist_MiscModified: 2018-06-11