Datalogging more than 1 line...PLEASE HELP
Hello,
So I am trying to log more than one cycle to a data file.
Here is what I have so far:
MODULE WriteToFile
VAR iodev datalog;
VAR string stDate;
VAR string stTime;
PROC rCycleTimes()
IF DInput(JoeyTry)=1 THEN
stDate:=CDate();
stTime:=CTime();
Open "HOME:"\File:="SawPart1CT.csv",datalog\Write;
Write datalog,stDate+","+stTime+","+"Cycle Time ="\Num:=ClkRead(CycleClock);
Close datalog;
ENDIF
IF DInput(JoeyTry)=0 THEN
stDate:=CDate();
stTime:=CTime();
Open "HOME:"\File:="SawPart2CT.csv",datalog\Write;
Write datalog,stDate+","+stTime+","+"Cycle Time ="\Num:=ClkRead(CycleClock);
Close datalog;
ENDIF
ENDPROC
ENDMODULE
For some reason I can only log one instance then nothing else gets logged in the CSV file.
Only one instance logged and there seems to be no way to have it go to the next line in the CSV file as well.
I honestly feel like I am missing something simple. Please help and thank you ahead of time
HAPPY THANKSGIVING AND GOD BLESS
Joey
Best Answers
-
Sure,
Open "HOME:"\File:="SawPart2CT.csv",datalog\Write\Append;
Lee Justice5 -
You are welcome.Lee Justice5
Answers
-
It looks like you are saying that the next instance overwrites the previous. That is what I would expect from the code, too. When you reopen the comdevice, you need to add the optional argument \append , which will add new lines.Lee Justice0
-
Wow Thank you so much for the fast response!!!
May I ask, please, where would that \append go in the code?
0 -
I actually just figured it out when you sent the answer lol. Thank you so much for your help.0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings