How to select a file to process with a Program in Crimson 3.0

Ken Roach

Lifetime Supporting Member + Moderator
Join Date
Apr 2002
Location
Seattle, WA
Posts
17,483
Hi guys,

I'm an absolute beginner with G3 terminals and Crimson, coming from a deeply PanelView background. I plan to use a G308 terminal.

A couple of months ago I got some great advice on data logging in PLCTalk Thread 442419.

The project cooled off, and now it's hot again.

And now there's another feature I need, that's the opposite of data-logging: I want to browse a directory on the CF card and select a *.CSV file, and then parse each line and the place each value into a Data Tag in the G3, which in turn will write a value to a CompactLogix. There will only be twelve items of data.

The files will get to the CF card via FTP, manually placed there by the customer using a nearby laptop.

I found some nice Crimson 2.0 scripts written by KP_EENG in this thread (PLCTalk Thread 54225) that I will base my "recipe read" program on.

As I understand those example Programs, I need to make the file name part of the program or enter the filename as a String on the terminal.

What I'd prefer is to be able to browse the "recipe folder" to select the file by tapping on it from a list of files.

While I'm busy Reading the Fine Manual, can anyone tell me the basics of how this sort of function could be implemented in Crimson 3 ?

Is there a "select a file and when the user clicks on it run a specific program" object or primitive ?
 
ken dont know if this helps:
RUNNING PROGRAMS
Programs may be invoked within actions by following the program name with a pair of
parentheses. For example, Program1() will invoke the associated program. The program will
execute in the foreground or background as defined by the program’s properties.
pg 228 rtfm
f= fine LOL
just kidding I know nothing about these YET....

also i find the search feature in adobe usefull
 
Last edited:
I did figure out how to run Programs based on Actions, like the press or release of a button. :)

That's not too dissimilar from RSView32. In fact, if this were VBA, I'd be a lot further down the road.

I'm digging through the Programs chapter now.
 
Thanks, STL, I found that but didn't convert it to Crimson 3 to investigate it. I'll have a closer look.
 
Hi ken, im kicking this up just to keep it hot i would really like to here some feed back on this one for future reference thanks, steve
 
Last edited:
Ken, the Crimson 3.0 Reference Manual should (I haven't looked yet) offer help on the CF directory navigation methods.

You will find it very DOS like, but with C-like commands and return parameters.

I believe that you cannot programmatically reach the root and that you are limited by 8.3 naming conventions no matter what Crimson lets you name things. IIRC, you may be required to put the files in a certain named folder in order to make them programmatically available, but I may be wrong on these two points with the latest and greatest.

They may have fixed Crimson now so that it won't let you break some of those rules in the editor...I haven't yet installed the latest build they released a couple days ago, but I have the "Gold" one right before it, just haven't used any custom file commands since I switched to their built in logger for my Event based log. I did have it working and I may have an old revision with the code still in there I can look at tomorrow.
 
Last edited:
Ken,

From my understanding you can go at this several ways. I guess what decides which way is what you do with the data. I have attached a program where I created shift data and then opened it to send it to a printer.

Basically what you have to do is use funtion OpenFile then decide how you want to read the file. I read mine by lines, since I did not know how many lines I used a while loop. Next I told where I wanted it to go, in my case I went directly to the printer.

Tip on how I use the manual:

When I need to write script I open the reference manual and then open C3. I use the resource pane to find the functions that might work then I find them in the resource manual. Red Lion has the functions grouped based on general function. The one you need to look at is called File.



Hope this helps.

PS. Dan at Red Lion helped alot on this. I found out about the shift report once I got on site so the code is a bit chunky. It gives you the general idea though.

Clay
 

Similar Topics

Is there a way to select a parameter file when loading a given screen based on the value of a variable? I see that under "Global Connections" the...
Replies
2
Views
1,120
RS Logix 5000 - Uploading an unknown file. Ask to "Select File" when I don't have one Good Morning , I have a CompactLogix program that I...
Replies
2
Views
2,088
Im trying to install a Siemens upgrade license using Automation License Manager v6.0. I clicked D: mistakedly, and now I can not find a way to...
Replies
2
Views
61
Hello, We recently upgraded our control server to a newer model. After the transition we are experiencing issues with our trend graphs to where...
Replies
2
Views
127
Hi all, I really need help with this one. I'm at a complete loss... For months and months, I've had no problems with pressing a NEXT button to...
Replies
14
Views
1,454
Back
Top Bottom