jfls45
Member
I am up against a wall trying to figure out how to retrieve saved recipe values from the CompactFlash in my Red Lion G315. I have been successfull saving to the CF card but trying to retrieve these same values back to the HMI has been daunting. I trying to learn C programming to do this task by reading the included Reference Manual in Crimson 3. I have downloaded the sample files from Red Lions website, most of them are in Crimson 2. I converted them to Crimson 3 and downloaded into the HMI, and they don't work.
Here is the code I am using to save to the card. Keep in mind, this does work:
int hfile; //file opened index
int i; //array scanning index
// Create a new folder if it doesn't exist
CreateDirectory("/recipes");
//Create the file if it doesn't exist
CreateFile("/recipes/recipe.csv");
//open the file
hfile= OpenFile("/recipes/recipe.csv",1);
//Write each recipe as a line in the file
//Copy each array index as a file line beginning by the recipe index
for (i=0;i<100;i++){
WriteFileLine(hfile,AsText(i)+","
+OutsideDiameter.AsText+";"
+RecipeOD.AsText+";"
+WallThickness.AsText+";"
+RecipeWall.AsText+";"
+GapRoll1.AsText+";"
+GapRoll3.AsText+";"
+GapRoll5.AsText+";"
+GapRoll7.AsText+";"
+GapRoll9.AsText+";"
+AngleRoll1.AsText+";"
+AngleRoll3.AsText+";"
+AngleRoll5.AsText+";"
+AngleRoll7.AsText+";"
+AngleRoll9.AsText+";"
+AngleRoll2.AsText+";"
+AngleRoll4.AsText+";"
+AngleRoll6.AsText+";"
+AngleRoll8.AsText+";"
+AngleRoll10.AsText+";"
+DeflectRoll4.AsText+";"
+DeflectRoll6.AsText+";"
+DeflectRoll8.AsText);
}
//Close the file
CloseFile(hfile);
Now I am trying to retrieve these same values and have had no luck trying to do this. Can someone help me out here? I've tried using the "ReadFileLine" function in place of the "WriteFileLine" but it doesn't work. I know there is probably alot of syntax changes so anyone who is willing to help please feel free to make some suggestions.
thanks in advance,
jfls45
Here is the code I am using to save to the card. Keep in mind, this does work:
int hfile; //file opened index
int i; //array scanning index
// Create a new folder if it doesn't exist
CreateDirectory("/recipes");
//Create the file if it doesn't exist
CreateFile("/recipes/recipe.csv");
//open the file
hfile= OpenFile("/recipes/recipe.csv",1);
//Write each recipe as a line in the file
//Copy each array index as a file line beginning by the recipe index
for (i=0;i<100;i++){
WriteFileLine(hfile,AsText(i)+","
+OutsideDiameter.AsText+";"
+RecipeOD.AsText+";"
+WallThickness.AsText+";"
+RecipeWall.AsText+";"
+GapRoll1.AsText+";"
+GapRoll3.AsText+";"
+GapRoll5.AsText+";"
+GapRoll7.AsText+";"
+GapRoll9.AsText+";"
+AngleRoll1.AsText+";"
+AngleRoll3.AsText+";"
+AngleRoll5.AsText+";"
+AngleRoll7.AsText+";"
+AngleRoll9.AsText+";"
+AngleRoll2.AsText+";"
+AngleRoll4.AsText+";"
+AngleRoll6.AsText+";"
+AngleRoll8.AsText+";"
+AngleRoll10.AsText+";"
+DeflectRoll4.AsText+";"
+DeflectRoll6.AsText+";"
+DeflectRoll8.AsText);
}
//Close the file
CloseFile(hfile);
Now I am trying to retrieve these same values and have had no luck trying to do this. Can someone help me out here? I've tried using the "ReadFileLine" function in place of the "WriteFileLine" but it doesn't work. I know there is probably alot of syntax changes so anyone who is willing to help please feel free to make some suggestions.
thanks in advance,
jfls45