Showing results 1 to 2 of 2

Thread: Cycle read file

  1. #1
    Join Date
    27.08.2015
    Posts
    8

    Default Cycle read file

    Hi All,

    I use this code to read data from a file:

    Click image for larger version

Name:	2019-06-04_192823.png
Views:	15
Size:	4.8 KB
ID:	2589

    The first time I run, It's correct, like this:

    Click image for larger version

Name:	2019-06-04_192858.png
Views:	12
Size:	21.0 KB
ID:	2592

    I saw that the ID1 increase step by step, and then when ID1=32 then return to 0, it's not correct, like this:

    Click image for larger version

Name:	2019-06-04_193141.png
Views:	10
Size:	19.6 KB
ID:	2593
    Could you please help me to solve this.
    Attached Thumbnails Attached Thumbnails 2019-06-04_193141.png   2019-06-04_192858.png  
    Last edited by kieuminh : 4th June 2019 at 13:44

  2. #2
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    799

    Default Re: Cycle read file

    Open the file only once, and not in each cycle. Then use this (single) ID as long as file is open.
    In each cycle you then can read the next line.
    And when you finished to read (all) lines - close the file, e.g.:

    #define fNull 0
    if fileID = fNull then
    fileID := F_ROPEN (FPATH);
    end_if;
    if fileID <> fNull then
    if not F_EOF( fileID ) then
    lineText := FM_READ( fileID );

    (* file line evaluation - to variable value and timestamp
    ...

    *)

    else // file completed - close file
    F_CLOSE( fileID );
    fileID := fNull;
    end_if;
    end_if;

    Last edited by ursulak : 5th June 2019 at 09:40 Reason: corrected to 1 cycle process

Similar Threads

  1. Can zenon read data from a *.csv file
    By kieuminh in forum zenon Supervisor
    Replies: 4
    Last Post: 23rd May 2019, 12:40
  2. Can zenon read data from a *.csv file
    By kieuminh in forum zenon Energy Edition
    Replies: 0
    Last Post: 15th May 2019, 17:04
  3. Replies: 1
    Last Post: 25th July 2013, 11:07
  4. Replies: 2
    Last Post: 9th June 2009, 12:53
  5. Archive scanning cycle ignored
    By nsko in forum zenon Supervisor
    Replies: 5
    Last Post: 18th August 2008, 14:03

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •