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

  • Judging from the Telnet messages you saw, you're at least halfway there. You are opening the port and transmitting data.


    If you're trying to loop the data back into the KRC2, simply connecting the Rx and Tx lines on the RS-232 port may not be enough. Check this link:


    http://www.airborn.com.au/rs232.html


    Partway down the page, there is a diagram for a DB9 "Loopback Test Plug". This wires the handshaking lines together as well as the Tx and Rx lines. I've found in the past with some RS232 setups that you need those lines wired in order to get the port to work properly.


    I've never used the Loopback plug on a KRC, but since the KRC serial ports are the same as a PC serial port, this should work.


    The other thing you can try is to create a full 9-pin "Null Modem" cable, as shown on that web page, and connect your KRC to another PC. Using Hyperterminal on the other PC, if the settings are correct, you should see what the KRC sends, and should be able to type in text and see it received in the Telnet window on the KRC.

  • answers in order of questions


    -- you see nothing :hmmm:


    -- 3 sec is your timeout, you haven't receive any character
    the R goes red after the CREAD ?
    do you get the error 1422 "invalid value J"
    if yes, thanks for your information about it


    -- wrong cable ? I'm not a clairvoyan


    -- no


    please follow the advices from SkyeFire


    SkyeFire
    thanks for your advices - my patience is almost gone

  • hi
    when I check the variable of I ,I do not see the value of I
    yes, I got the error 1422 "J valid value"
    I will follow the advices from SkyeFire
    I will check my cable
    thanks a lot everyone! :merci:

    Edited once, last by namkocao ().

  • hi
    I communicated kuka robot and my PC.It was successful ! :applaus:


    But I still have some problem.hi :icon_smile:
    after My program had run,on the my PC ,I received a lot characters.I do not undestand these characters
    I attempt to send value 123 from kuka robot to Pc.On the Pc,I receive 3f 3f cc 3f 33(hex)


    I already read this link http://www.robot-forum.com/rob…cond_and_seq-t1433.0.html


    I think 3f 3f is a start character??!!


    hence,when I want to send data from pc to kuka robot, what kind of data type must I send ?


    My purpose:
    I will write a program in order to (from my pc) control kuka robot which move programming path

    I already have file move.src.I want to run this file from my PC

  • 3f 3f are not start characters. I guess, they are spoiled character because of wrong baudrate or parity on your PC. Please control your serial setup (on PC and KRC).


    You have to know what kind of data you want to send

  • If what you see in your Telnet window doesn't match what the PC receives, the most likely suspect is baud rate and/or protocol. Make sure *all* of the Hyperterminal settings on your PC match what the KRC is set up for.

  • hi
    On KRC,there is Xon/Xoff protocol.Thus,I use Xon/Xoff protocol
    [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


    I use a cable which have 2 female connector
    I connected pins(I attached picture)
    But I do not know whether it is right????!!!

  • Maybe the problem is cable too long. RS-232 is not recommended for electrically noisy environments (servos, motors, welding equipment, power cables, ...).


    I suggest using a *shorter* cable. Put the PC closer to the robot cabinet, I bet you'll end receiving ASCII garbage.


    Another idea would be to insert RS-232 to RS-485 converters in each end of the cable (robot side and PC side).


    RS-485 is much better, it uses balanced/differential signals and succeeds where RS-232 fails.


    Good luck,
    V.

  • - cable is ok
    - please make a "cold start" and try again
    - switch off XON/XOFF on PC and KRC2 (serial.ini)
    [XONXOFF]
    CHAR_TIMEOUT=50 ; msec Timeout after last received character
    :
    XON_VAL=[glow=red,2,300]0[/glow] ; 0..255 XON character (decimal)
    XOFF_VAL=[glow=red,2,300]0[/glow] ; 0..255 XOFF character (decimal)
    ; if XON_VAL=0 and XOFF_VAL=0 then XON/XOFF protocol
    ; is disabled (pure serial communication)
    DSR_LINE=0 ; 0 = DSR line not connected, 1 = DSR line must be high

  • hi
    Yes,I will switch off XON/XOFF
    My software on my pc maybe fail.I found other software.It is very cool
    I am reading how to write program by VC++

    Edited once, last by namkocao ().

  • hi all,
    I wrote a program,but I can not check it on the kuka robot(because kuka robot has hardware error) :icon_frown:


    Content:
    On my PC,I will send a string "RUN" to controller of kuka robot
    On KCP,I will write a program.It receive string "RUN" and run the program MOVE.SRC
    the program MOVE.SRC consist of motion instruction (PTP.CIR,LIN)


    In the TEXT.dat,I write A declaration


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


    REAL TIMEOUT
    INT HANDLE,OFFSET
    CHAR I,J
    INT COUNTER


    In the TEXT.src,I write A program


    MW_T=#SYNC
    MR_T=#ABS
    TIMEOUT=3.0
    OFFSET=0
    I="START"
    COUNTER=0


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


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


    WHILE (COUNTER<10) AND (SR_T.RET1==#DATA_END)
    CREAD(HANDLE,SR_T,MR_T,TIMEOUT,OFFSET,”%c”,J)
    COUNTER=COUNTER+1
    ENDWHILE


    IF (J=="RUN") THEN
    CWRITE($CMD,STAT,MODE,”RUN /R1/MOVE()”);I am not sure it is right.I read in manual
    ENDIF


    CCLOSE(HANDLE,SC_T)


    please,Give me some advice about my program!
    thanks!

    Edited once, last by namkocao ().

  • hi
    On KCP,I selected a program MOVE.SRC
    Now,I want to run this progam from my PC
    On my PC,I need to send variable via COM in order to run this program


    First,from my pc I send "variable" to turn on DRIVERS
    Second,send variable to start the program MOVE.SRC


    Hence,what is that variable?I do not find it in manual CREAD_CWRITE
    thanks

    Edited once, last by namkocao ().

  • you want to turn on DRIVERS ? what that ?
    -----------------
    In your program there are character variables I, J.
    You can not do IF (J=="RUN") THEN or I="START"
    -----------------
    CWRITE(HANDLE,SW_T,MW_T,“%c”,I)
    IF (SW_T.RET1<>#CMD_OK) THEN
    HALT
    ENDIF


    WHILE (COUNTER<10) AND (SR_T.RET1==#DATA_END)
    CREAD(HANDLE,SR_T,MR_T,TIMEOUT,OFFSET,”%c”,J)
    COUNTER=COUNTER+1
    ENDWHILE


    the program never runs through the WHILE loop (SR_T.RET1 is #CMD_OK) !!
    You have to use the REPEAT construct
    Why do you use CREAD in a WHILE loop ?
    ???

  • KRL does not have "string" type variables. Instead, it uses character array variables.


    So:


    DECL CHAR J[3] ; J can hold up to 3 characters
    DECL CHAR I[5] ; I can hold up to 5 characters
    .....
    IF I[]=="START" THEN...
    .....
    IF J[]=="RUN" THEN...

  • Hi all
    I have a question. I set up a com port as it is written in this topic, but the data from the KUKA robot on your PC is not transmitted.
    I looked in the Telnet, when developing team CWRITE, I see that the data is transmitted to the port you want me to, but the PC did not come.
    Although Windows KUKA robot and Windows PC without any problems transmitting data through Hiperterminal.
    What could be the problem ???
    Version KRC 5.5.12.
    :help:

Advertising from our partners