I am wondering if anyone here can give me some advice or perhaps point out the error in the recipe program i am using with a G3 series HMI. I have used this program multiple times with integers but this is the first time i have tried loading floating points values from the CSV.
When i execute the script it does load the value from the CSV file but it seems to get hung up after that (doesnt been or turn on the status flag at the end) and eventually spits out a guru meditation code. I am sure it is something silly i am missing.
I appreciate the help and any feedback anyone can provide.
Here is the code i am using. for simplicity i have only left 1 variable ( i actually have over 500 i am loading in production) but the issue exhibits itself no matter how many variables i load.
Thanks
cstring Item, Value;
int Position1, Position2, Length;
if (RecipeIndex < 10) CFNumber = OpenFile("/Recipe" + IntToText(RecipeIndex,10,1) + ".csv", 0);
if (RecipeIndex > 9) CFNumber = OpenFile("/Recipe" + IntToText(RecipeIndex,10,2) + ".csv", 0);
CFRead = ReadFileLine(CFNumber);
while (CFRead != "EOF")
{
Position1 = Find(CFRead, ',', 0);
Position2 = Find(CFRead, ',', 1);
Length = Len(CFRead);
Item = Mid (CFRead, Position1+1, Position2 - Position1-1);
Value = Mid (CFRead, Position2+1, Length - Position2-1);
if (Item == "Name") Name := Value;
if (Item == "Desc") Desc := Value;
if (Item == "N_DRAW_LENGTH") N_DRAW_LENGTH := TextToFloat(Value);
CFRead = ReadFileLine(CFNumber);
}
CloseFile(CFNumber);
Beep(30,500);
RECIPE_LOADED := 1;
Sleep(2000);
RECIPE_LOADED := 0;
When i execute the script it does load the value from the CSV file but it seems to get hung up after that (doesnt been or turn on the status flag at the end) and eventually spits out a guru meditation code. I am sure it is something silly i am missing.
I appreciate the help and any feedback anyone can provide.
Here is the code i am using. for simplicity i have only left 1 variable ( i actually have over 500 i am loading in production) but the issue exhibits itself no matter how many variables i load.
Thanks
cstring Item, Value;
int Position1, Position2, Length;
if (RecipeIndex < 10) CFNumber = OpenFile("/Recipe" + IntToText(RecipeIndex,10,1) + ".csv", 0);
if (RecipeIndex > 9) CFNumber = OpenFile("/Recipe" + IntToText(RecipeIndex,10,2) + ".csv", 0);
CFRead = ReadFileLine(CFNumber);
while (CFRead != "EOF")
{
Position1 = Find(CFRead, ',', 0);
Position2 = Find(CFRead, ',', 1);
Length = Len(CFRead);
Item = Mid (CFRead, Position1+1, Position2 - Position1-1);
Value = Mid (CFRead, Position2+1, Length - Position2-1);
if (Item == "Name") Name := Value;
if (Item == "Desc") Desc := Value;
if (Item == "N_DRAW_LENGTH") N_DRAW_LENGTH := TextToFloat(Value);
CFRead = ReadFileLine(CFNumber);
}
CloseFile(CFNumber);
Beep(30,500);
RECIPE_LOADED := 1;
Sleep(2000);
RECIPE_LOADED := 0;