DEF EthernetKRL file settings in robot program

Publisher:素心静听Latest update time:2023-07-03 Source: 机器人及PLC自动化应用Author: Lemontree Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Settings in DEF KRL() file program:

EKI_Check(Ret:IN,Type:IN,strChannelName[]:IN) – Checks if there are any errors in the function

Ethernet KRL outputs a message on the smartHMI in the event of any error. The automatic output of the message can be disabled.

Check if there are any errors when running the function:

 The error number will be read and the corresponding information will be output on the smartHMI.

 Optional: If a channel name is given, an error parameter will be asked when receiving data.

Parameter 1 EKI_STATUS

The return value of the function being checked

Parameter 2 Type: ENUM

Type of information output on smartHMI:

 #NOFY: Prompt message

 #STATE: Status information

 #QUIT: Confirm information

 #WTING: Waiting for information

Parameter 3 (Optional) Type: CHAR Name of the open channel that should be checked

Example: EKI_CHECK(RET,#QUIT)

If automatic message output has been disabled, it is recommended to use EKI_CHECK() to check if there are any errors while running the function:

 The error number will be read and the corresponding information will be output on the smartHMI.

 If a channel name is given in EKI_CHECK(), it is asked whether there are errors when receiving data.

Each time EKI_CHECK() is called, the routine KRC:R1TPEthernetKRLEthernetKRL_USER.SRC is called. User-specific error responses can be set in this routine.

EKI_Open RET = EKI_Open(CHAR[]) Open the initialized channel

When the external system is configured as a server, EKI_Open() interrupts program execution until the connection to the external system is active.

The connection can only be restored using the EKI_OPEN() function.

When EKI is configured as a client, EKI connects with an external system (= server).

When EKI is configured as a server, EKI waits for connection requests from external systems (= clients).

RET = EKI_Open(channel name)

RET Feedback value, type: EKI_STATUS

Example RET = EKI_Open("Channel_1")

Program Structure:

GLOBALDEFFCKI_STATUS EKI_Open(strChannelName[]:IN)

DECLCHAR strChannelName[] Channel name variable declaration

DECLSTATE_T Stat

DECLMODUS_T Mode

DECLEKI_STATUS Ret

Mode = #SYNC Operating mode: The CWRITE statement is considered to have been executed as soon as the partner has taken the transmitted data from the receive buffer.

Ret = EKI_NULL_STATUS

CONTINUE

CWRITE($FCT_CALL,Stat,Mode,"EFC_eki_Open",strChannelName[])

Use "EFC_eki_Open" to open the channel name of the EthernetKRL file

Ret.Msg_No = Stat.Msg_No

IF(Ret.Msg_No == 0) THEN If the feedback status message number is 0, the connection is considered successful.

Ret.Connected = true

ENDIF

RETURN Ret

ENDFCT

Through the command channel $FCT_CALL

CWRITE

CWRITE calls cannot be made in triggers. Instead, CWRITE can be used in trigger subroutines.

CWRITE writes data to a loaded external module of type LD_EXT_OBJ. In the loaded external module of type LD_EXT_FCT, CWRITE calls a function.

CWRITE writes commands to command channel $CMD.

CWRITE calls a function via the command channel $FCT_CALL.

CWRITE triggers a premature run stop.

CWRITE ( HandleΙ$CMDΙ$FCT_CALL, State, Mode, Fmat, Var1 < ,

…, Var10 >)

HandleΙ type: INT

Processes the variable passed by COPEN to CWRITE to identify the channel to the external module.

$CMD predefined handle variable, used to write command channel $CMD

$FCT_CALL predefined handle variable, used to write command channel $FCT_CALL

State type: STATE_T; automatically returns to the CWRITE state

Mode type: MODUS_T; write mode must be initialized.

Format type: CHAR array

The variables Var1…Var10 must be converted to text strings before they can be written to the channel. The format defines the format of the text to be generated. A format must be specified for each variable.

Var1 … Var10

Variables whose data are written to the channel. Each statement can have up to 10 variables.

For external module of type LD_EXT_FCT and command channel $FCT_CALL: Variables Var1…Var10 contain the passed parameters of the function called with Format.

Format : read/write "format" variable

$FCT_CALL

Management number (handle) of command channel $FCT_CALL

The CWRITE() function can be used to call a function via the $FCT_CALL command channel. The variable itself is write-protected.

Function of command channel $FCT_CALL

Use CWRITE to call the file system functions of the command channel $FCT_CALL. When making the call, the function parameters must be transferred to CWRITE as Var1 ... Var10. In addition, the write mode transmitted by CWRITE must be #SYNC.

File system functions can be called from either the robot interpreter or the submission interpreter. Opening a file from one interpreter and then accessing it from another, such as writing to it or closing it again, is not allowed.

-

Editor: Huang Fei

Reference address:DEF EthernetKRL file settings in robot program

Previous article:Coherent and TriEye collaborate on shortwave infrared imaging
Next article:How to pause a running GRAPH program?

Latest robot Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号