Jump to content

Recommended Posts

I am working on a project where I allow the user to perform a dump of information located in the data tables to a .CSV file on the SD card. I am trying to avoid users blaming me if the SD card gets corrupted so I am coming up with a procedure that must be followed before the SD card can be removed.

I need to know how the SD Safely Remove function block actually works. What is the DW and what is the MB?

I assumed that the MB would go from a 0 to 1 if it was safe to remove the SD Card but I checked this while performing a dump to the SD card and the MB still changed to 1.

Also, I need clarification on the following sentence from the help. "It allows a current task to be completed, but prevents new ones from starting." What tasks is that referring to?

Basically what I am trying to do is perform a check to make sure that it is safe to remove the SD card.

Thanks,

Dan

Link to comment
Share on other sites

  • 2 weeks later...

SB 219 toggle rapidly between 0 and 1 while I am doing my data dump. I could always add a time based on that bit but I still return to my original question, How does the SD Safely Remove function block and what are the purposes of the DW and MB associated with the function block. I am avoiding using my own timers and memory because the more I program this PLC the more space I am going to need.

Thanks,

Dan

Link to comment
Share on other sites

  • 4 weeks later...

Hi Dan,

When you run the remove safely FB, if there is any SD function currently read or writing to the SD card it will be allowed to finish and then the linked MB will go high. The DW is a bit map that will show you which SD function was running (look in the help for how to read the bitmap). No further SD functions will run until you reset the link MB. Hope that helps!

Regards,

Ryan

Link to comment
Share on other sites

  • 2 years later...

I haven't had a chance to check this for a long time. Has anyone actually tested the code on this. I don't think the SD safely remove block actually locks the user out from dumping information while the bit saying it is ok to perform the dump is 1 / on position. Please confirm as I am having to change my data reporting and am going to need to actually use this block (assuming it works) to prevent the PLC from recording information to a .CSV when the user needs to retrieve the SD card from the PLC.

 

Thanks,

 

Dan

Link to comment
Share on other sites

How does the function block actually work? I assume MB2 in this case turns to the on state when it is in fact safe? That being said, does the function block stop recording to the SD card when that bit is on? Please confirm that the function block actually does something more than just being an if then statement.

 

Thanks,

 

Dan

Link to comment
Share on other sites

How does the function block actually work? I assume MB2 in this case turns to the on state when it is in fact safe? That being said, does the function block stop recording to the SD card when that bit is on? Please confirm that the function block actually does something more than just being an if then statement.

 

Thanks,

 

Dan

Hi Dan,

What the function does is as follows:

1. Wait for the currently SD command to finish.

2. After all currently activated read/write tasks are done, it does not allow further tasks to initiate. 

3. A success bit will rise, indicates that You can safely remove the SD card without the risk of corrupting data.

  • Upvote 1
Link to comment
Share on other sites

Eyal,

 

What if there aren't any actual SD commands running. I do my data dumping to the SD card independently. The user goes out and does a dump of the data via command prompts thru the HMI. 

 

Do I have to have the function block energized for it to not allow further tasks or does it prevent further tasks from initiating based on the success bit state (is there another bit that I am unaware of?)? I want to test this because previously when I played with it I was able to perform SD commands while it was in the "safe" position.

 

Thanks,

 

Dan

Link to comment
Share on other sites

Hi Dan,

SB 219 is for information only. It will be up if any write request(s) in progress.

You can remove SD card ONLY if "Safe to remove" bit is set.

*It should be reset before you set request to remove SD card.

When "Safe to Remove" bit being energized - you have to remove SD card and insert it again to allow next write functions.

You have to check in Ladder if "Safe to remove" is set, and disable all buttons, leading to write operations. As well, should not set in Ladder any write request.

**Any write request will be rejected with error.

***When you required "SD Safely Remove" - all in-progress requests are active. New requests are not allowed. When all write requests being finished - "Safe to remove" bit will be set and you can remove SD card.

There is a good explanation in Help->SD:Safely Remove.

 

One important remark - SD card extenders of any type are NOT SUPPORTED. SD card should be inserted in PLC SD card slot.

 

I hope this helps.

Link to comment
Share on other sites

I think I understand how the block works. That being said wouldn't it be easier to have the SD Write function blocks look at the safe to remove bit (if it is being used) rather than have to use a condition on every ladder rung that a Write command is being used? I'm not trying to a smart guy but I don't see that point of the function block if I have to protect the write blocks from is manually in the code.

 

I am leaning towards just locking the write blocks out with the Safe to Remove bit manually to insure that the PLC can't write to the SD Card while any information is being dumped.

 

Thanks,

 

Dan

Link to comment
Share on other sites

Hi Dan,

Conditions should be used to eliminate situation, when SD card is blocked to write, or somebody ejected it without processing  "SD Safely Remove".

 

SD card is not intended, and not designed to be removed frequently. It should collect data for long period of time.

This data (SD card files) will be:

1.Send by email;

2.Transferred by DataXport;

3.Retrieved by SD card explorer;

Etc.

 

BR.

Link to comment
Share on other sites

I've been designing a turn key product for the past 5 years that used the SD cards a the method for retrieving data from the site. I don't use the "SD Safely Remove" block because it didn't prevent anything from happening when I played with it several years ago.

 

This is the first that I have heard that the SD card is not intended or designed to be removed frequently. I saw no mention of this in any of the technical information when we decided to retrieve data via this method.

 

The reason for using .CSV files is pretty simple, when you sell a turn key product to 100s of customers having them install another software program on their computer is a pain. Almost all computers have excel on them so we just use the .CSV files.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...