Red Lion G3 recipe program issue

drno10

Member
Join Date
Dec 2011
Location
alberta
Posts
2
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;
 
Not sure what might be wrong, but I can suggest adding Crimson tags for some of the values so you can monitor them when it runs. Make them retentive too, so maybe they will hold their values after the crash.

Perhaps Position1 or Position2 are causing an illegal value in the MID function?

Perhaps there is no EOF at the end of the file in question and you are going into an infinite loop?

These are just guesses, but maybe it can stimulate some ideas...
 
Thank you for the reply. After i have doing alot of investigating and have figured out the following

The program appears to be getting caught in a loop. If never makes it out of the while statement near the beginning. It does however appear to actually be loading the variables from the CF card (regardless of how many variables). The EOF is present in the CSV file so i am not sure what it is missing. And the rest of the program should be fine as i use this exact same script with a texttoint instead of texttofloat without any issue.
 
Well, then I suggest this:

Use a For Next loop instead of the While loop so you can limit the number of loops (and still inspect for EOF). Make the For/Next indice accessible outside the program so you can monitor it.

Maybe not the ideal answer, but it might actually be a good extra bit of insurance to use in all your instances of this recipe handler. Only drawback is that you'd be limiting the number of recipe items, but you could set it to some really high number I suppose.
 

Similar Topics

From the Red Lion website, after some customer enquiries in the last week or so... Rev. March 25, 2024 [18:30] Just thought it might help a...
Replies
9
Views
252
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
100
Hello All, I need the ability to remotely reboot a Red Lion CR3000 HMI. Due to some graphics issues when the database is updated the HMI must be...
Replies
4
Views
203
I'm trying to use a Red Lion Cub counter (Cub5B00) as a counter and give the cub's counts to a Graphite G12 PLC/HMI to display. After about an...
Replies
1
Views
106
Hi everybody, I have about three Red Lion HMI's, the calibration on the screens seems correct but where I'm using the pop up keypad to enter...
Replies
1
Views
111
Back
Top Bottom