dan_lorentz Posted November 1, 2011 Report Posted November 1, 2011 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
dan_lorentz Posted November 10, 2011 Author Report Posted November 10, 2011 Does anyone have input regarding this? It has been longer than a week and I need to finish this task up so I can move on and not worry about it. Thanks, Dan
sgull Posted November 11, 2011 Report Posted November 11, 2011 Hi Dan Dont Know if it helps, but there is a system bit SB-219 that comes on when it is safe to remove the card. Regards Denis
dan_lorentz Posted November 14, 2011 Author Report Posted November 14, 2011 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
dan_lorentz Posted December 9, 2011 Author Report Posted December 9, 2011 Still haven't received any input on this subject.... Dan
Ryan Posted December 9, 2011 Report Posted December 9, 2011 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
dan_lorentz Posted December 9, 2011 Author Report Posted December 9, 2011 Just used the function block and the SD Safely Remove Block's safe to remove MB was set at 1. The PLC still performed my entire SD dump of information which contains numerous SD Utility Delimited Line & Write SD Delimited Line function blocks. Any input? Thanks, Dan
Ofir Posted December 11, 2011 Report Posted December 11, 2011 Hi, What is the condition you are using to activate the SD safely remove? Implement the condition for SD safely remove as apeared in the attached picture. If you still face the same problem try upgrading VisiLogic and the PLC system files to the latest.
dan_lorentz Posted November 24, 2014 Author Report Posted November 24, 2014 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
dan_lorentz Posted November 25, 2014 Author Report Posted November 25, 2014 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
Eyal Koren Posted November 30, 2014 Report Posted November 30, 2014 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. 1
dan_lorentz Posted December 2, 2014 Author Report Posted December 2, 2014 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
AlexUT Posted December 2, 2014 Report Posted December 2, 2014 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.
dan_lorentz Posted December 4, 2014 Author Report Posted December 4, 2014 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
AlexUT Posted December 4, 2014 Report Posted December 4, 2014 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.
dan_lorentz Posted December 4, 2014 Author Report Posted December 4, 2014 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now