Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

file read/write doesn't work with CAA.File

2015-12-04
2016-02-02
  • PhilipLykov - 2015-12-04

    I tried to use DLOG_STORE_FILE_CSV from OSCAT it doesn't work and report no error. Now I try to use CAA.File library, it also doesn't work with example code from the documentation. File created successfully on disk but FILE.Open doesn't return hFile and the xDone doesn't get TRUE.

    Does anybody have a success with file operations out of CoDeSys on Raspberry Pi?

     
  • LukaszBien - 2015-12-05

    Hi,

    I have managed to make this work on Raspi.

    I use File Open block in both READ or WRITE mode. ( FILE.MODE.MREAD and FILE.MODE.MWRITE)

    And I'm closing file every time after read/write. And that should work..

     
  • PhilipLykov - 2015-12-05

    Lukazs,
    Thank you for your answer. What library version do you use and what the version of the Codesys Control? I use library 3.5.7.0 and Codesys Control 3.5.7.10.
    I see that if I press 27 times 'Step into' at FILE.OPEN block it works as expected. Unfortunately I cannot see what are that 27 steps inside FILE.OPEN.

     
  • LukaszBien - 2015-12-06

    Hi Philip.
    I'm using 3.5.7.0 CAA file lib. and 3.5.7.0 raspi runtime.
    I've attached a simple example project that definitely works on my both Pi's (2 and B+) so maybe it will help you a bit.
    Good luck.

    FilesExample2.project [167.42 KiB]

     
  • PhilipLykov - 2015-12-06

    Lukasz,

    Thank you very much! Your example help me to find a source of problem.
    I'm writing a library. I declared FILE.Open, FILE.Write and so on in the method so it cleared at every cycle. I should declare them in the function block instead.

     
  • juhataipale - 2016-02-02

    Hello,

    I have tried to get DLOG_STORE_FILE_CSV by oscat also to work, without success. (Raspberry Pi 2, v3.5.
    Is it just not possible?

    Is there any demo available for this, according to manual there should be, but all I see is some weather -demo.
    I am quite newbie so some things are still unsure for me.

    I have the DLOG_DATA struct in my structs, DLOG_DINT collects my values and passes them to DLOG_STORE_FILE_CSV.
    It is not downloading my program in

    I guess I have made many mistakes, so I took a snashot from my screen, if you could tell me what I am doing wrong.
    Errors visible in picture.

    IMG: eroor.JPG

     

Log in to post a comment.