hello i looking for a routine for save in a file ( log txt .. cdv ) the base frame data with the date and hour
thanks for your help
Raynald
krc4 save baseframe in a file with date and hour
- raynald60
- Thread is marked as Resolved.
-
-
Unfortunately, KRL does not provide a means of writing data to external files.
One possible workaround would be to write the data to a KRL .DAT file, and set up a script in the Windows side of the controller that would periodically copy the data from said file. A bit kludgey, but would probably work.
-
It is possible to write data to external files, for example a log file. Quick example below!
The only problem i found so far is that i can't skip to the next row in the file.
;====================================================
; Write data to a CHAR array
;====================================================
OFFSET=0
SWRITE (sDate[], STAT, OFFSET, "%d%s%d%s%d%s", $DATE.DAY, ".", $DATE.MONTH, ".", $DATE.YEAR, " ")
IF (STAT.RET1==#CMD_ABORT) THEN
CheckError$FCT_CALL(STAT.MSG_NO,2)
ENDIF
OFFSET=0
SWRITE (sTime[], STAT, OFFSET, "%d%s%d%s%d%s%d", $DATE.HOUR, ":", $DATE.MIN, ":", $DATE.SEC, ".", $DATE.CSEC)
IF (STAT.RET1==#CMD_ABORT) THEN
CheckError$FCT_CALL(STAT.MSG_NO,2)
ENDIF;====================================================
; Open as text file for write access. In this mode,
; the contents of the file are not deleted on opening
; instead, the written values are added at the end of
; the file. If the file does not exist, it is created
; under C:\KRC\ROBOTER\UserFiles
;====================================================
CWRITE($FCT_CALL, STAT, MODE, "krl_fopen", "Date.log", "a", HANDLE)
IF (STAT.RET1==#CMD_ABORT) THEN
CheckError$FCT_CALL(STAT.MSG_NO,3)
ELSE
;==================================================
; Write a character string to the file
;==================================================
CWRITE($FCT_CALL, STAT, MODE, "krl_fputs", HANDLE, sDate[])
CWRITE($FCT_CALL, STAT, MODE, "krl_fputs", HANDLE, sTime[])
IF (STAT.RET1==#CMD_ABORT) THEN
CheckError$FCT_CALL(STAT.MSG_NO,4)
ENDIF
;==================================================
; Close the file
;==================================================
CWRITE($FCT_CALL, STAT, MODE, "krl_fclose", HANDLE)
IF (STAT.RET1==#CMD_ABORT) THEN
CheckError$FCT_CALL(STAT.MSG_NO,5)
ELSE
HANDLE=0
ENDIF
ENDIF -
Is this documented anywhere? I've been wishing for a way to write to external files on KRCs for years, but never found one. Is this new for KSS 8.x, or has it been around longer?
I cannot WAIT to try this out.
-
This is indeed an exciting new development! It's not often something this unexpected crops up.
Looking through the KRC.o file in my favourite editor, it appears that there are also functions for other things including reading from files... krl_fscanf, krl_fgets, krl_fgetc.
Back in the office tomorrow.... let's see what we can do
-
I guess this is new since KR C4 and KSS 8.x. I have attached the official documentation. Have fun
Oh, and if you find a way to jump to the next row in a file, please tell me!
-
After a bit of hunting, it turns out that it is documented!
The manual for CREAD/CWRITE has a whole section on it! I just wish my German was a little better...
Damn it! Cross post! Ignore me
-
Never mind my question,
CWRITE($FCT_CALL, State, Mode, "krl_fwriteln", FileHandle, " ")
Solves the problem with a new line!
-
OK, now I've got a question after reading the manual...
On page 13 (Section 5) there is mention of a driver file tcpdrv.o, which I assume would allow us to use TCP/IP comms. I don't have this file on my controller and I wonder if anybody else does have it. If so, does it come, for instance, with KRL-XML or something similar?
-
best thread of the week. I was wondering where the new version of this manual was, as obviously a lot has changed...
-
You won't find the tcpdrv.o in KSS V8.2.23 or V8.3.6. It's also not a part of KUKA.EthernetKRL. To me it seems like the tcpdrv.o is only an example name of an external module and not an actual module delivered by KUKA.
-
best thread of the week. I was wondering where the new version of this manual was, as obviously a lot has changed...
The file is on the official documentation DVD since at least 2012.
The problem is that nearly nobody has or takes the time to read all the manuals and compare them to the old ones. -
for some reason with the new robots I think the manual CD is very barebones. maybe I missed that one, but with our KRC2 in 2009, they gave virtually every manual on the CD. not anymore.