KUKA robot advanced programming CWRITE usage V3.1

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

CWRI

CWRITE writes data to an opened serial interface or to a loaded external module of type LD_EXT_OBJ. In a loaded external module of type LD_EXT_FCT, CWRITE calls a function.

CWRITE Writes a command to the command channel.

CWRITE triggers a premature run stop.

CWRITE (Handle or $CMD, State, Mode, Format, Var1 <, ..., Var10>)

Handle/$CMD

Type: INT

Handle: A variable transferred from COPEN to WRITE that identifies a channel.

$CMD: A predefined variable used to write to the command channel

State: Type: STATE_T

Automatically returns to WRITE state

Mode : Type: INT

Type: MODUS_T

To write mode, the mode must be initialized.

Format: Type: CHAR[]

Converts Var variables before writing them to a string. A format must be specified for each Var variable.

Var:

The variable whose data is written to the string. Each statement can have up to 10 variables.

Write Mode

The writing mode is determined by a variable of type MODUS_T. MODUS_T is a predefined enumeration type:

ENUM MODUS_T SYNC, ASYNC, ABS, COND, SEQ For CWRITE, only SYNC and ASYNC are relevant:

SYNC

The statement is considered executed once the partner controller has fetched the transmitted data from the receive buffer.

ASYNC

When writing external modules of type LD_EXT_FCT, ASYNC mode is not allowed!

The following applies to all other channels: The statement is considered executed as soon as the data arrives in the receive buffer of the partner controller.

  • Better than SYNC: program execution speed is faster.

  • Disadvantages compared to SYNC: Possible data loss.

Other Values

If mode has a value other than SYNC or ASYNC, the write is performed in SYNC mode by default.

For example:

CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()") program executes CELL program

$CMD

Through the command channel $CMD

CWRITE can transfer statements to the program interpreter via the command channel. Example: starting a program with RUN and stopping it with STOP.

Communicate with command channel $CMD

Command channel: start, stop and deselect programs

Program A6.SRC will start, stop and deselect via the command channel. This is done with the following program lines in the SUB file.

DECL STATE_T STAT

DECL MODUS_T MODE

MODE=#SYNC

...

;select prog A6()

;to start the program the START-button or

;an external start-signal is needed

IF $FLAG[1]==TRUE THEN

CWRITE($CMD,STAT,MODE,"RUN/R1/A6()") Run the program

$FLAG[1]=FALSE

ENDIF

;stop program A6()

IF $FLAG[2]==TRUE THEN

CWRITE($CMD,STAT,MODE,"STOP 1") program stops

$FLAG[2]=FALSE

ENDIF

;cel program A6()

IF $FLAG[3]==TRUE THEN

CWRITE($CMD,STAT,MODE,"CANCEL 1") exits the program

$FLAG[3]=FALSE

ENDIF

Conversion example:

Example 1

The value of the integer variable VI is transmitted in decimal and hexadecimal ASCII representation. The first CWRITE statement transmits the characters 123. The second CWRITE statement transmits the characters 7B.

INT VI

VI=123

CWRITE(HANDLE,SW_T,MW_T,"%d",VI)

CWRITE(HANDLE,SW_T,MW_T,"%x",VI)

Example 2

The value of an integer variable VI is transmitted in binary representation:

INT VI

VI=123

CWRITE(HANDLE,SW_T,MW_T,"%r",VI)

Example 3

Transfer all array elements of an array:

REAL [10]

CWRITE(HANDLE,SW_T,MW_T,"%r",VR[])

When using the "%r" format, the system does not check whether the variable or array element has been initialized. Random values ​​are transferred for array elements that have not been initialized.

Example 4

The first five array elements of the array are transmitted in binary representation:

REAL VR[10]

CWRITE(HANDLE,SW_T,MW_T,"%.5r",VR[])

The 20 bytes are transmitted in binary representation.

Example 5

Transfer all array elements up to the first uninitialized element:

CHAR VS[100]

CWRITE(HANDLE,SW_T,MW_T,"%s",VS[])

Example 6

Transfer the first 50 array elements:

CHAR VS[100]

CWRITE(HANDLE,SW_T,MW_T,"%s",VS[])

Example 7

The internal value of ENUM constants is transmitted in ASCII notation. The corresponding number is:

DECL ENUM_TYPE E

CWRITE(HANDLE,SW_T,MW_T,"%d",E)

Example 8

Two REAL values ​​are transferred together with additional text:

REAL V1,V2

V1=3.97

V2=-27.3

CWRITE(...,...,...,"value1=%+#07.3f value2=+#06.2f",V1,V2)

The following data is transmitted:

value1=+03.970

value2=-27.30

CWRITE and the Command Interface

CELL.SRC can be selected from the SPS.SUB program by means of the CWRITE statement and RUN. The call is effective only on a cold start.

CWRITE can transfer statements to the interpreter via the command channel $CMD. In addition to interpreter and system submissions, extended submissions can also be used for this purpose in multi-submission mode.

The meaning of the following commands has changed compared to single commit mode:

  • RUN[interpreter ID]

  • STOP[interpreter ID]

  • Reset [interpreter ID]

  • Cancel [Interpreter ID]

Interpreter ID:

0: all commit interpreters

1: Robot translation

2: System submission interpreter

3: Extended Submission Interpreter 1

4: Extended Submission Interpreter 2

9: Extended Submission Interpreter 7

Additionally, RUN is extended with the optional element [> interpreter ID]. CWRITE ($CMD, STAT, MODE, "RUN/R1/CELL()") Behavior in single submission mode: Starts the program CELL(). Since CELL() is an SRC program, it is started in the robot interpreter. Behavior in multiple submission mode: Same as in single submission mode. This program line can be used for system submissions or extended submissions. CWRITE ($CMD, STAT, MODE, "RUN/R1/SPS()") Behavior in single submission mode: Starts the program SPS(). Since SPS() is a SUB program, it is started in the system submission interpreter (= submission interpreter only in single submission mode). Behavior in multiple submission mode: Starts the program SPS(). Since SPS() is a SUB program, it is started in the system submission interpreter.

CWRITE ($CMD, STAT, MODE, "STOP 0")

This program line is only meaningful in robot programs. Behavior in single-submission mode: Stops the system submission interpreter. Behavior in multi-submission mode: Stops all running submission interpreters.

CWRITE ($CMD, STAT, MODE, "CANCEL 0")

Behavior in single-submission mode: Deselects the system submission interpreter. Behavior in multiple-submission mode: Deselects all submitted interpreters. CWRITE ($CMD, STAT, MODE, "RUN/R1/MySubProg() > 5")

This statement is not allowed in single commit mode.

Behavior in multi-submission mode: If MySubProg() is a SUB program, it will start with extended submit 3. This program line can be used for other submissions to interpreters or robots.


Reviewing Editor: Li Qian


Reference address:KUKA robot advanced programming CWRITE usage V3.1

Previous article:WorkVisual assigns the robot controller to the robot controller of the actual application
Next article:Teacher Zhu has published a new book! ! "ROS Robot Programming Zero Basics"

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号