I’m using a program that operates on a csv file on Storage memory. At the moment I’m using a SlimLine CPU module with ethernet, and I write the file by using an FTP access to the module. I’m thinking to use a SlimLine Lite CPU module and to do this I need to write the file by using a serial connection.
My idea is to read the serial port until a special character is received, for example “^”, and then open the local file in write mode and write on it everything is received until another special character like “$”. I am trying to implement it but I have some questions:
1: If I have a buffer for incoming data, is it preserved through each running loop of the function block ?
2: Since I don’t know the required length of the buffer, how can I enlarge it when I get more data ?
3: When I try to write the data to the file, is there a possibility of a conflict with the other function block that reads the file ? How can I prevent it ? Is there some kind of locking mechanism ?
Is it possible to have an example program that executes something like my needs ?