Hello, everyone!
I'm learning KRL and have a task to write .src program for KR C2 that will read data from file. I wanna write program that will read coordinates (X, Y, Z, A, B, C) from .csv file that I downloaded to controller. This .csv file can be also .txt. It's doesn't matter. I need to know what file extension I need.
So I found user guide about CREAD and CWRITE functions for KR C2: http://www.hgpauction.com/wp-content/upl…READ-CWRITE.pdf
And real hard question for me - to organize this conversation.
I'm not good in KRL, that's why examples of code with comments will be very useful.
How to read data from external file?
-
rain_philosophy -
April 4, 2018 at 10:45 AM -
Thread is marked as Resolved.
-
-
Hi.
May be first question you might get is what KSS version you use? IS it 5.4?
And meanwhile when waiting reply from some hero member, it might be helpful to see the following link which contain some sample codes.https://www.robot-forum.com/robotforum/kuk…orum/krl_fgets/ you can read the conversation and downlaod .src .dat file to get some idea
https://www.robot-forum.com/robotforum/kuk…3038/#msg103038
Thanks
-
KSS is 5.6.12
Yeah, thank you for examples! I just have examples from PDF file.
And there isn't all clear. -
As far as I remember on KRC2 it is not possible to read from files.
-
that is correct... this is something that was added in KSS8.x, probably as substitute for dropping RS232 support
-
I have an extra question.
I'll try to do my task maybe via Ethernet, however...
Please explain me this example from CREAD and CWRITE user guide:
the first part:
DEFDAT RECEIVE
;----Declarations----
INT HANDLE, OFFSET
REAL TIMEOUT
DECL STATE_T SR_T, SC_T
DECL MODUS_T MR_T
ENDDAT
the second part:
DEF RECEIVE()
;----Initializations----
MW_T=#ABS
TIMEOUT=3.0
;----Instructions----
OPEN_P()
READ()
CLOSE_P()
END
So, explain, please, what is MW_T? As I understand we didn't declare it. -
It's an ENUM variable of type MODUS_T, which defines the operating mode for CREAD and CWRITE commands.