News CNCnetPDM About us Support  
       
  

CNC_WRUNSOLICPRM2 | UNSOLIC

TOP

Description

Sets the parameter for unsolicited messaging to CNC. This function is available only for Series 30i/31i/32i, 0i-D/F and PMi-A. This function cannot be used with Visual Basic. Please use Visual C++ for making your application.
Please refer to "Unsolicited Messaging Function" for the detail information of unsolicited messaging function.

After calling the cnc_unsolicstart function, the parameter set by thisfunction becomes effective.

MTConnect Fanuc Adapter

Universal Fanuc Driver

Fanuc Focas Library CD

Declaration

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

FWLIBAPI short WINAPI cnc_wrunsolicprm2( unsigned short FlibHndl, short number, IODBUNSOLIC2 *data2 );

Arguments : Ethernet

FlibHndl   [ in ]

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

number   [ in ]

The parameter number for unsolicited messaging. Reserved argument, so must be set to "1".

data   [ in ]

Pointer to IODBUNSOLIC2 structure which sets the parameters for the unsolicited messaging. The IODBUNSOLIC structure is as follows.


typedef struct iodbunsolic2 {
    char                ipaddr[64];
    unsigned long       port;
    unsigned short      retry;
    unsigned short      timeout;
    unsigned short      alivetime;
    char                dummy1[8];
    UNSOLICMSG_TYPE_PRM cntrl;
    unsigned short      transnum;
    char                dummy2[14];
    UNSOLICMSG_TYPE_PRM trans[3];
} IODBUNSOLIC2;

typedef struct unsolicmsg_type_prm {
    unsigned short      type;
    char                dummy1[2];
    union {
        typedef {
            unsigned short  path;
            short           addr;
            unsigned long   no;
            unsigned long   size;
        } pmc;
        typedef {
            unsigned short  path;
            char            dummy2[2];
            unsigned long   no; 
            unsigned long   num;
        } macro;
    } prm
} UNSOLICMSG_TYPE_PRM;
ipaddr
IP address or host name of destination PC.
ex.) "192.168.0.1"
port
TCP/UDP port number of destination PC.
The unsolicited messaging function uses TCP and UDP of the same port number.
If you set the firewall by this port number, you have to open the port for this port number.
Range) 5001 - 65535
retry
Retry count
Number of transmission retry to observe communication board transmits data. Set the retry count that is used when there is no answer for the data transmission.
Range) 1 - 32767
timeout
Timeout times(sec)
Timeout(sec) to observe communication board transmits data. Set the time(sec) of timeout until answering to the data transmission.
Range) 1 - 32767
alivetime
Alive signal time(sec)
The interval time(sec)of the existence signals which are transmitted while communication board operates. Set the value less than the value of the above "timeout".
Range) 1 - 32767
cntrl.type
Kind of control parameter
This data is the kind of control parameter for the ladder program or the NC program to demand the message transmission.
0 : Control parameter is invalid.
1 : PMC address(Response Notice method)
2 : PMC address(Simple method)
3 : Custom macro variable(Simple method)
4 : Temporary RTM variable(Simple method)(0i-F,30i/31i/32i only)
cntrl.prm.pmc.path
PMC unit type for control parameter
This data is PMC unit type number for control parameter for the ladder program to demand the message transmission.
When the value of "Kind of control parameter" is "1" and "2", this value is effective.
Range) 1 - 3 (The range depends on an effective PMC unit type number.) When this value is 65535, the control parameter is invalid.
cntrl.prm.pmc.addr
PMC address for control parameter
This data is PMC address for control parameter for the ladder program to demand the message transmission.
When the value of "Kind of control parameter" is "1" and "2", this value is effective.
5 : R (Internal relay)
12 : E (Extended relay)
cntrl.prm.pmc.no
PMC address number for control parameter
This data is PMC address number for control parameter for the ladder program to demand the message transmission.
When the value of "Kind of control parameter" is "1" and "2", this value is effective.
Range) (The range depends on an effective PMC area)
cntrl.prm.pmc.size
unused
cntrl.prm.macro.path
CNC path number for control parameter
This data is CNC path number for control parameter for the NC program to demand the message transmission.
When the value of "Kind of control parameter" is "3" and "4", this value is effective.
Range) 1 - 10(The range depends on an effective PMC area) When this value is 65535, the control parameter is invalid.
cntrl.prm.macro.no
Macro variable number for control parameter
This data is Macro variable number for control parameter for the NC program to demand the message transmission.
When the value of "Kind of control parameter" is "3" and "4", this value is effective.
Range) (The range depends on an effective Macro variable)
cntrl.prm.macro.num
unused
transnum
Transmission number
Number of transmitted messages.
Range) 1 - 3
trans[n].type
Kind of transmission parameter : range of n (0-2).
0 : Transmission parameter is invalid.
1 : PMC address
3 : Custom macro variable
4 : Temporary RTM variable
5 : Permanent RTM variable(0i-F,30i/31i/32i only)
trans[n].prm.pmc.path
PMC unit type number for transmission parameter : range of n (0-2).
When the value of "Kind of transmission parameter" is "1", this value is effective.
Range) 1 - 3 (The range depends on an effective PMC unit type number.) When this value is 65535, the transmission parameter is invalid.
trans[n].prm.pmc.addr
PMC address for transmission parameter : range of n (0-2).
When the value of "Kind of transmission parameter" is "1", this value is effective.
0 : G (Signal to PMC->CNC)
1 : F (Signal to CNC->PMC)
2 : Y (Signal to PMC->machine)
3 : X (Signal to machine->PMC)
4 : A (Message demand)
5 : R (Internal relay)
6 : T (Changeable timer)
7 : K (Keep relay)
8 : C (Counter)
9 : D (Data table)
10 : M (Input signal from other devices)(0i-F,30i/31i/32i only)
11 : N (Output signal to other devices)(0i-F,30i/31i/32i only)
12 : E (Extended relay)
13 : Z (System relay)(0i-F,30i/31i/32i only)
trans[n].prm.pmc.no
PMC address number for transmission parameter : range of n (0-2).
When the value of "Kind of transmission parameter" is "1", this value is effective.
Range) 1 - 10(The range depends on an effective PMC area)
trans[n].prm.pmc.size
PMC data size for transmission parameter (bytes) : range of n (0-2).
When the value of "Kind of transmission parameter" is "3", "4" and "5", this value is effective.
Range) (The range depends on an effective PMC data area and transmission number.)
In case of transmission number is "1" : Max.2890 bytes
In case of transmission number is "2" : Max.2874 bytes(total)
In case of transmission number is "3" : Max.2858 bytes(total)
When the macro variable is used to the transmission parameter, the size of one macro variable is eight bytes.
trans[n].prm.macro.path
CNC path number of transmission parameter : range of n (0-2).
When the value of "Kind of transmission parameter" is "3", "4" and "5", this value is effective.
Range) 1 - 10 (The range depends on an effective CNC path number) When this value is 65535, the transmission parameter is invalid.
trans[n].prm.macro.no
Macro variable number for transmission parameter : range of n (0-2).
When the value of "Kind of transmission parameter" is "3", "4" and "5", this value is effective.
Range) (The range depends on an effective Macro variable data )
trans[n].prm.macro.num
Number of macro variable for transmission parameter : range of n (0-2).
When the value of "Kind of transmission parameter" is "3", "4" and "5", this value is effective.
In case of transmission number is "1" : Max.2890 bytes
In case of transmission number is "2" : Max.2874 bytes(total)
In case of transmission number is "3" : Max.2858 bytes(total)
When the macro variable is used to the transmission parameter, the size of one macro variable is eight bytes.
When "Kind of transmission parameter" is "3" and "Macro variable number" is 1000 or more(system variavles), this parameter can set only "1".
Setting example)
IP address : 192.168.0.1
Port number : 8196
Control method : Simple method
Control parameter : PMC address"1:R2000"
Retry count : 3
Timeout time : 10
Transmission number : 3
Transmission parameter[0] : PMC data area"1:R2100-1:R2149"
Transmission parameter[1] : Custom macro"1:3011"
Transmission parameter[2] : Temporary RTM variable"1:0-1:4"

IODBUNSOLIC2 data2;
strcpy(data2.ipaddr,"192.168.0.1"); // IP address
data2.port = 8196; // Port number
data2.retry = 3; // Retry count
data2.timeout = 10; // Timeout time(sec)
data2.alivetime = 5; // Alive signal time(sec)
// Control parameter
data2.cntrl.type = 2; // - Kind(simple method)
data2.cntrl.prm.pmc.path = 1; // - PMC unit type
data2.cntrl.prm.pmc.addr = 1; // - PMC address
data2.cntrl.prm.pmc.no = 1; // - PMC address number
data2.transnum = 3; // Transmission number
// Transmission parameter[0]
data2.trans[0].type = 1; // - Kind
data2.trans[0].prm.pmc.path = 1; // - PMC unit type
data2.trans[0].prm.pmc.addr = 5; // - PMC address
data2.trans[0].prm.pmc.no = 2100; // - PMC address number
data2.trans[0].prm.pmc.size = 50; // - PMC data size
// Transmission parameter[1]
data2.trans[1].type = 3; // - Kind
data2.trans[1].prm.macro.path = 1; // - CNC path number
data2.trans[1].prm.macro.no = 3011; // - Custon macro variable
data2.trans[1].prm.macro.num = 1; // - Number of macro variable
// Transmission parameter[2]
data2.trans[2].type = 4; // - Kind
data2.trans[2].prm.macro.path = 1; // - CNC path number
data2.trans[2].prm.macro.no = 0; // - Temporary RTM variable
data2.trans[2].prm.macro.num = 5; // - Number of macro variable

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_BUSY
(-1)
The unsolicited message is being transmitted.
The state of the unsolicited messaging function is not "Stop"
EW_FUNC
(1)
Unavailable
In order to get more information for this err_no return value, execute cnc_getdtailerr function.
Member of ODBERR : err_no
5 : Data was rejected.
Member of ODBERR : err_dtno
2 : The mode of the unsolicited messaging function is not "PC mode".
3 : The status of the unsolicited messaging function is not "Stop"
4 : Trouble of communication board
EW_NUMBER
(3)
The parameter number(number) for unsolicited messaging is wrong.
EW_DATA
(5)
The contents of parameter for unsolicited messaging function is wrong.
In order to get more information for this err_no return value, execute cnc_getdtailerr function. The following details status will be set onto the member, err_no and err_dtno of OBDERR structure.
Member of ODBERR : err_no
2 : Out of range
3 : Format error
Member of ODBERR : errdt_no
11 : IP address(ipaddr) or host name of destination PC is wrong.
12 : Port number(port) of destination PC is wrong.
13 : Retry number(retry) is wrong.
14 : Timeout time(timeouit) is wrong.
15 : Alive signal time(alive) is wrong.
16 : Control parameter(cntrl.prm.type) is wrong.
17 : PMC unit type for control parameter(cntrl.prm.pmc.path) is wrong.
18 : PMC address for control parameter(cntrl.prm.pmc.addr) is wrong.
19 : PMC address number for control parameter(cntrl.prm.pmc.no) is wrong.
20 : (unused)
21 : CNC path number for control parameter(cntrl.prm.macro.path) is wrong.
22 : Macro variable number for control parameter(cntrl.prm.macro.no)is wrong.
23 : (unused)
24 : Transmission number(transnum) is wrong.
30+(i*10) : Kind of transmission parameter(trans[n].prm.type) is wrong. (Same i=0,1,2)
31+(i*10) : PMC unit type number for transmission parameter(trans[n].prm.pmc.path) is wrong.
32+(i*10) : PMC address for transmission parameter(trans[n].prm.pmc.addr) is wrong.
33+(i*10) : PMC address number for transmission parameter(trans[n].prm.pmc.no) is wrong.
34+(i*10) : PMC data size for transmission parameter(trans[n].prm.pmc.size) is wrong.
35+(i*10) : CNC path number of transmission parameter(trans[n].prm.macro.path) is wrong.
36+(i*10) : Macro variable number for transmission parameter(trans[n].prm.macro.no) is wrong.
37+(i*10) : Number of macro variable for transmission parameter(trans[n].prm.macro.num) is wrong.
EW_PROT
(7)
Write protect
Parameter writing is failed.
In order to get more information for this err_no return value, execute cnc_getdtailerr function. The following details status will be set onto the member, err_no of OBDERR structure.
Member of ODBERR : err_no
11 : Writing to File SRAM was failed.
EW_REJECT
(13)
The message transmission is being executed with other destination PC.

As for the other return codes or the details, see "Return status of Data window function"

CNC option

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.

This function is related to the following CNC parameter.
See the manual of FAST Ethernet for details.

    No.904#4=1 : Unsilocited messaging function(must be set)
    No.904#5 : If you use the DNS function, set "1".
    No.14880#4=1 : Unsilocited messaging function(Embedded Ethernet(Built-in port))
    No.14880#5 : If you use the DNS function, set "1".(Embedded Ethernet(Built-in port))

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

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


Power Mate i-DX
Power Mate i-HX
Power Motion i-AE

"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_wrunsolicprm   cnc_rdunsolicprm   cnc_rdunsolicprm2   cnc_unsolicstart   cnc_unsolicstop   cnc_rdunsolicmsg   cnc_rdunsolicmsg2  

Privacy notice

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

https://www.inventcom.net/fanuc-focas-library/unsolic/cnc_wrunsolicprm2

Fanuc Focas Library | Unsolic | cnc_rdunsolicmsg

Reads the unsolicited messaging data. This function is available only for Series 16i/18i/21i, 0i and Power Mate i. This function cannot be used with Visual Basic.... [read more]
Fanuc Focas Library | Unsolic | cnc_rdunsolicmsg

Fanuc Focas Library | Unsolic | cnc_rdunsolicmsg2

Reads the unsolicited messaging data. This function is available only for Series Series 30i/31i/32i, 0i-D/F and PMi-A. This function cannot be used with... [read more]
Fanuc Focas Library | Unsolic | cnc_rdunsolicmsg2

Fanuc Focas Library | Unsolic | cnc_rdunsolicprm

Reads the parameter for unsolicited messaging from CNC. This function is available only for Series 16i/18i/21i, 0i and Power Mate i. This function cannot be used... [read more]
Fanuc Focas Library | Unsolic | cnc_rdunsolicprm

Fanuc Focas Library | Unsolic | cnc_rdunsolicprm2

Reads the parameter for unsolicited messaging from CNC. This function is available only for Series Series 30i/31i/32i, 0i-D/F and PMi-A. This function cannot be... [read more]
Fanuc Focas Library | Unsolic | cnc_rdunsolicprm2

Fanuc Focas Library | Unsolic | cnc_unsolicstart

Directs the starting of reception of the unsolicited messaging. The starting of reception directs by the PC that receives the unsolicited messaging. This... [read more]
Fanuc Focas Library | Unsolic | cnc_unsolicstart

Fanuc Focas Library | Unsolic | cnc_unsolicstop

Directs the termination of reception of the unsolicited messaging. When the CNC parameter No.905#4 is 1, this function can be... [read more]
Fanuc Focas Library | Unsolic | cnc_unsolicstop

Fanuc Focas Library | Unsolic | cnc_wrunsolicprm

Sets the parameter for unsolicited messaging to CNC. This function is available only for Series 16i/18i/21i, 0i and Power Mate i. This function cannot be used with... [read more]
Fanuc Focas Library | Unsolic | cnc_wrunsolicprm

Fanuc Focas Library | Unsolic | flist_UnSolic

CNC: Function related to Unsolicited messaging function... [read more]
Fanuc Focas Library | Unsolic | flist_UnSolic
Modified: 2023-12-05