Sign in to follow this  
Followers 0
Marshall

fwrite function

7 posts in this topic

I am trying to use the fwrite instruction to record data. I have tried the example in the instruction reference manual with no success. I have tried different combinations of the control word. I am not getting anything to the memory card. The memory card works fine when using it on a program transfer. I am using a CS1 CPU45h. Any suggestions. Great site, I check it out everyday.

Share this post


Link to post
Share on other sites
Checked out the download section ? Try this link http://forums.mrplc.com/index.php?autocom=downloads&showfile=276

Share this post


Link to post
Share on other sites
Check out the memory area and display as ASCII, you will see the code for the messages..... etc This is inculded in the program...

Share this post


Link to post
Share on other sites
hi Sleepy, There is no problem with your program, it works fine. i have the problem with my application. I don´t know if i really need to interlock the portion of program where i use the fwrite funtion like you do. My application writes the first line of the file and then write the others that are diferent from the first one. When the file is full a PC download it via ftp. The problem is that sometimes (with random frecuency) the downloaded file come without the first line and that is a great problem. I think that the problem is that the ftp program download and delete the file while the PLC is writing to it and that the reason why the first line is not in the file. Whell, sorry for my long post, the question is:why do you interlock the fwrite function? i have never use the interlock function and i don´t know if i muss to use it in my program thanks

Share this post


Link to post
Share on other sites
The reason for the interlock was because i only wanted to execute the code on a positive edge...ie not all the time....otherwise i would of had to diff all of the instructions .....there is a far amount of processing of extracting the date and time etc the fetching the data before finally writing it to the card... On your second point...yep doing a FTP and deleting the file when you are writing to it is not really a ggod thing...as you no doubt have found out.... The way around that is to have a file you write to and then copy it to another and only FTP the copied version...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0