1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. KUKA Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

how diagnose serial program?communicate kuka robot and PC via COM

  • namkocao
  • February 23, 2009 at 7:06 AM
  • Thread is Resolved
  • namkocao
    Guest
    • February 23, 2009 at 7:06 AM
    • #1

    hi everyone!
    I wrote small program in order to communicate kuka robot with PC via Com
    I press NEW.I choice EXPERT SUBMIT
    My program

    DECL STATE_T SR_T, SW_T, SC_T
    DECL MODUS_T MR_T, MW_T
    CHANNEL :SER_3 :SER_3 $PSER_3

    REAL TIMEOUT
    INT HANDLE,OFFSET
    INT I,J

    MW_T=#SYNC
    MR_T=#ABS
    TIMEOUT=3.0
    OFFSET=0
    I=123


    COPEN(:SER_3,HANDLE)

    CWRITE(HANDLE,SW_T,MW_T,“%d”,I)

    CREAD(HANDLE,SR_T,MR_T,TIMEOUT,OFFSET,”%d”,J)

    CCLOSE(HANDLE,SC_T)

    Then,I press "select" button.
    A line present "Submit interpreter is alredy running"
    Next,I check my program.
    Diagnosis!

    I press the Windows Start button and calling the command “Run”.
    Enter the string “telnet 192.0.1.1” in the selection box “Open” and press OK:
    the following Telnet window is opened.
    then,I type SER_OPEN.On the Telnet window,it present UNDEFINED SYMBOL:SER_OPEN
    I do not know whether my program transmitted and received

    So,could everyone tell me how diagnose?
    help me! :help:
    thanks in avandce!

    PS:pin 2(TX) and pin 3(RX) of COM ,I connected them

    Edited once, last by namkocao (February 23, 2009 at 7:08 AM).

  • Online
    SkyeFire
    Reactions Received
    1,052
    Trophies
    12
    Posts
    9,429
    • February 23, 2009 at 12:56 PM
    • #2

    Wrong module type. You should not have chosen "Expert Submit" unless you are planning to completely replace the current SPS.SUB program. You cannot Select a new .SUB program without explicitly deselecting the current SPS first. You should try putting this code into a standard .SRC file module and run it from there.

    As for the Telnet window, you cannot type in direct serial commands there. The way that the Telnet window assists serial diagnostics is to leave it open in the background. If your KRL program successfully opens a serial port and transmits and/or receives anything through it, the raw data (with non-alphanumeric ASCII values displayed in hex) will be shown in the Telnet window, along with the buffer purges. But you cannot type in serial commands in the Telnet window.

  • namkocao
    Guest
    • February 24, 2009 at 4:03 AM
    • #3

    SkyeFire
    I use EXPERT MODULE
    I also write old program
    But when I press START (green button) ,a message present "INVALID HANDLE"
    then,I check “HW_INF.INI” (in the directory “C:\KRC\Roboter\INIT”).
    [SERIAL]
    ;ENABLE: COM is accessible by vxWorks
    ;DISABLE: COM is accessible by Win95
    COM1=DISABLE ;[ENABLE, DISABLE]
    COM2=DISABLE ;[ENABLE, DISABLE]
    COM3=ENABLE ;[ENABLE, DISABLE] useable only for VxWorks
    So,what is my problem here?

  • Online
    SkyeFire
    Reactions Received
    1,052
    Trophies
    12
    Posts
    9,429
    • February 24, 2009 at 1:38 PM
    • #4

    Check the value of HANDLE after your COPEN command. If HANDLE is 0, then the COPEN command failed for some reason.

    Check the file $CUSTOM.DAT. There should be a line like this:

    CHANNEL :SER_3 :SER_3 $PSER_3

    This assigns the SER_3 name to the physical serial channel so that COPEN and CCLOSE can work with it.

  • namkocao
    Guest
    • February 24, 2009 at 2:54 PM
    • #5

    thanks SkyeFire
    I read the manual,it write

    If a Handle that does not come from a “COPEN” statement of the process is transferred
    in the “CREAD” statement or if the channel has already been closed again, the
    acknowledgement message “INVALID HANDLE” is displayed

    Thus ,I need to use COPEN statement before CREAD statement
    But in the manual,it write

    Input/output channels that have previously been declared with the CHANNEL statement can
    be opened using the “COPEN” statement – which may be included in programs at control
    or robot levels.

    So,we must use CHANNEL statement???!
    And,I have a problem which I do not undestand

    The structure variables “$PSER_X” in the system file $CUSTOM.DAT are not evaluated.

    what does it mean?
    sorry for my idiotic questions! :biggrins:

  • namkocao
    Guest
    • February 24, 2009 at 4:00 PM
    • #6

    hi martinH moderator!
    could you help me about my problem,please?
    emergency :bawling:
    thanks

  • Online
    SkyeFire
    Reactions Received
    1,052
    Trophies
    12
    Posts
    9,429
    • February 24, 2009 at 7:02 PM
    • #7

    Where does it say that the $PSER variables in $CUSTOM.DAT are not evaluated? Any of the KUKA robots I've used serial on in recent years, the CHANNEL statements are always in $CUSTOM.DAT and work from there.

    What version of KSS are you running? On which controller? What version of the manual are you getting your information from?

    The only thing I can think of offhand would be to try putting the CHANNEL line that should evaluated in $CUSTOM.DAT into either $CONFIG.DAT, or the .dat file of your program module, and see if that does any good.

  • namkocao
    Guest
    • February 25, 2009 at 2:36 AM
    • #8

    I am using KSS 4.1 (9 jan 2004 version 6) ,KR C2,and I am reading Serial_Read_Write_manual.pdf(4.1)

    I put CHANNEl statement in my .dat file but a message present INVALID HANDLE :bawling:
    i check the value of HANDLE,handle =0???!

    Do SkyeFire have simple code program?
    Could you share it for me,please?
    thanks

    Edited once, last by namkocao (February 25, 2009 at 4:15 AM).

  • lindepauli
    Guest
    • February 25, 2009 at 11:25 AM
    • #9

    Hi namkocao

    - don't touch the CHANNEL statement in the $custom.dat and delete
    it in your program, realy not necessary
    - a change of the files hw_inf.ini and serial.ini require a cold start of
    the controler !!!!

  • Online
    SkyeFire
    Reactions Received
    1,052
    Trophies
    12
    Posts
    9,429
    • February 25, 2009 at 1:17 PM
    • #10

    Lindepauli is correct, and I should have thought of the Cold Boot thing myself.

    Still, I would like to know where you read that the CHANNEL command is not evaluated in $CUSTOM.DAT. That's not anyplace in the 4.1 manual that I have, and it is very confusing.

    Your program, as shown here, looks entirely correct.

    HANDLE is assigned a number by the COPEN command. If HANDLE is 0 after the COPEN command executes, then the serial port failed to open for some reason. Checking HANDLE before COPEN is pointless.

  • lindepauli
    Guest
    • February 25, 2009 at 2:53 PM
    • #11

    Hi SkyeFire,

    the channel command ist an old remnant from the RCM/KRC32 controler.
    For the new software versions, the channel command is predefined and shouldn't touch by the customer.
    In the documentation, the command ist only mentioned for a better understanding the serial communication. I guess the aim was missed - the capter is very confusing.
    :sorry: about it

  • namkocao
    Guest
    • February 25, 2009 at 4:32 PM
    • #12

    SkyeFire
    I read the CHANNEL command is not evaluated in $CUSTOM.DAT in the Serial_Read_Write_manual.pdf (page :smiling_face_with_sunglasses:

    I deleted CHANNEL Statement in my program,but still INVALID HANLDE

    SkyeFire,How to Check the value of HANDLE before COPEN is pointless?

    DECL STATE_T SR_T, SW_T, SC_T
    DECL MODUS_T MR_T, MW_T

    REAL TIMEOUT
    INT HANDLE,OFFSET
    INT I,J

    MW_T=#SYNC
    MR_T=#ABS
    TIMEOUT=3.0
    OFFSET=0
    I=123


    COPEN(:SER_3,HANDLE)

    CWRITE(HANDLE,SW_T,MW_T,“%d”,I)//at this line,a message present INVALID HANLDE

    CREAD(HANDLE,SR_T,MR_T,TIMEOUT,OFFSET,”%d”,J)

    CCLOSE(HANDLE,SC_T)

    @lindepauli
    in the expert programming,If i change the value in files hw_inf.ini and serial.ini,it require a cold start.I can change value of file hw_inf.ini COM3=ENABLE ;[ENABLE, DISABLE] useable only for VxWorks

    Once modifications have been made in the files HW_INF.INI or SERIAL.INI, the controller
    must be rebooted by means of a cold start in order for the changes to take effect.

    How to make a cold start?

    Edited once, last by namkocao (February 25, 2009 at 4:56 PM).

  • Online
    SkyeFire
    Reactions Received
    1,052
    Trophies
    12
    Posts
    9,429
    • February 25, 2009 at 10:34 PM
    • #13

    ...well, I'll be darned. It *is* there in the manual. I never NOTICED that before. Well, that explains a few things....

    Okay, now. The HANDLE variable means nothing until after the COPEN command assigns a value to it. Before COPEN, HANDLE could be 0, 5, -27, 100001, any integer value. After COPEN, HANDLE should not be zero. If HANDLE=0 after the COPEN, then the COPEN command failed.

    Why COPEN is failing I'm not sure, but I think the first thing to do is try a Cold Boot to make sure your changes to the .ini files are taken up.

    Under CONFIGURE, select ON/OFF OPTIONs, then select FORCE COLD STARTUP and hit the Enter key. A message should appear that "The next shutdown will be a cold start." After that, shut off the power to the robot and wait until it shuts off completely. Then turn the robot back on. Once the robot finishes booting up, all the changes to the .ini files should be in place. Try running the the program again and see if anything different happens.

  • namkocao
    Guest
    • February 26, 2009 at 9:07 AM
    • #14

    thanks SkyeFire,lindepauli

    I change the value of files HW_INF.INI or SERIAL.INI,and I make a cold start.My program already run :icon_smile: :applaus:
    Next,I press the Windows Start button and calling the command “Run”.
    Enter the string “telnet 192.0.1.1” in the selection box “Open” and press OK:
    A message present :
    SER_OPEN
    SER[3]-TX:123
    here,I do not see line :SER[3]-RX:123 ???
    Thus,I rewrite my program.My program's name is TEXT.src and TEXT.dat

    In the TEXT.dat,I write declaration

    DECL STATE_T SR_T, SW_T, SC_T
    DECL MODUS_T MR_T, MW_T

    REAL TIMEOUT
    INT HANDLE,OFFSET
    INT I,J

    In the TEXT.src,I write program

    MW_T=#SYNC
    MR_T=#ABS
    TIMEOUT=3.0
    OFFSET=0
    I=123

    COPEN(:SER_3,HANDLE)
    IF HANDLE==0 THEN
    HALT
    ENDIF

    CWRITE(HANDLE,SW_T,MW_T,“%d”,I)
    IF (SW_T.RET1<>#CMD_OK) THEN
    HALT
    ENDIF

    CREAD(HANDLE,SR_T,MR_T,TIMEOUT,OFFSET,”%d”,J)
    IF (SR_T.RET1<>#DATA_END) THEN
    HALT
    ENDIF

    IF I<>J THEN
    HALT
    ENDIF

    CCLOSE(HANDLE,SC_T)

    Then,I press start button.(RUN MODE)
    The pointer(white line) only run line CWRITE(HANDLE,SW_T,MW_T,“%d”,I)
    Continuously,I press Start button.The pointer (white line) run line HALT
    IF (SW_T.RET1<>#CMD_OK) THEN
    HALT
    ENDIF

    I think I have error my program at CWRITE statement
    Could you give me some advice,please?

    Edited once, last by namkocao (February 26, 2009 at 9:15 AM).

  • lindepauli
    Guest
    • February 26, 2009 at 9:27 AM
    • #15

    Hi namkocao,

    which serial protocol do you use ?
    With which device do you communicate ?

    I guess you'r using 3964R-protocol and your partner device doesn't understand the protocol

  • namkocao
    Guest
    • February 26, 2009 at 9:59 AM
    • #16

    hi
    I am using Xon/Xoff protocol.I want to communicate KUKA ROBOT and PC
    I will attach my software which is used on my PC
    parity=none
    My software is big(about 8MB).I will attach it after

    In the Serial.ini
    I change the value of this file
    [COM3]
    BAUD=9600
    CHAR_LEN=8 ; 7,8
    STOP_BIT=1 ; 1,2 at time not changeable
    PARITY=0 ; EVEN=2, ODD=1, NONE=0
    PROC=4 ; 3964R=1, SRVT=2, WTC=3, XONXOFF=4

    hi lindepauli
    I see COM ports on the My Pc and KUKA controller.They are male ports
    Thus,I need one cable which has 2 female connectors,andI need one cable which has one male connector and one female connector

    Edited once, last by namkocao (February 26, 2009 at 10:29 AM).

  • lindepauli
    Guest
    • February 26, 2009 at 11:09 AM
    • #17

    Hi namkocao,

    you wrote you ar using KSS 4.1 (9 jan 2004 version 6) ,KR C2.
    KUKA has never released such a version.

    Therefore please -see in the serial.ini. Does the section contain the line DSR_LINE=0 ?

    [XONXOFF]
    CHAR_TIMEOUT=50 ; msec Timeout after last received character
    ; to recognize the end of telegram
    MAX_TX_BUFFER=2 ; 1..5
    MAX_RX_BUFFER=2 ; 1..20
    SIZE_RX_BUFFER=100 ; 1..2048 longest expected telegram length + 15 characters

    XON_VAL=17 ; 0..255 XON character (decimal)
    XOFF_VAL=19 ; 0..255 XOFF character (decimal)
    ; if XON_VAL=0 and XOFF_VAL=0 then XON/XOFF protocol
    ; is disabled (pure communication)
    DSR_LINE=0 ; 0 = DSR line not connected, 1 = DSR line must be high

    What is the value of SW_T.RET1 ?

  • namkocao
    Guest
    • February 26, 2009 at 11:58 AM
    • #18

    hi lindepauli ,
    1.yes,the section contain the line DSR_LINE=0 in the serial.ini
    Thus,must I change the value of DSR?=>DSR_LINE=1

    2.I do not know how to find the value of SW_T.RET1.
    Could you tell me how to find the value of SW_T.RET1,please?
    Regards

  • lindepauli
    Guest
    • February 26, 2009 at 1:06 PM
    • #19

    Hi namkocao,

    1. DSR_LINE=0 is ok; i didn't know which software version V4.1 you have, therefore my question

    2. oh man, Monitor / Variable / Single

    If you press RUN, the program stops on the CWRITE ? How long ?
    3 sec or forever ?

  • namkocao
    Guest
    • February 26, 2009 at 1:20 PM
    • #20

    hi lindepauli :icon_smile:

    Yes,I checked the value of SW_T.RET1 but I see nothing

    After I change Xon/Xoff protocol,CWRITE statement is ok
    But when my program run, the pointer (white line) stop at line CREAD for 3sec (I see R letter below control panel from green color to red color)

    I think my cable is wrong???!!

    lindepauli,do you use my RS232-communication yet? ok?

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download