|AutomationDirect Live Chat|
Do-more Designer 2.0 introduces a true file management and data logging feature. Learn how easy it is to use in this brief video tutorial.
The Do-more engine has a comprehensive set of file I/O instructions which you can use to get pretty creative with your data logging. But, most of the time you just want to issue a log with as little effort as possible, right? If so, then this video is for you. You can skip all of this stuff and just grab this one instruction – File Log. Let’s send the log to the SD card. Let’s use short string 0 for the file name, let’s add a log entry once a second and let’s append a time stamp to the file name. For each log entry, let’s send a string, the contents of D0, another string and the contents of WX0. That looks good. Let’s add an always on contact, accept the changes and send this to the Do-more PLC. I’ll bring up a dataview so we can put a file name in short sting zero, some text in string1 and some more text in string 2. Write all of those changes. Great. Flip the switch to RUN mode. Wait a couple seconds to get some log entries which should be coming at 1 per second, then open up the file browser. We want to look at the SD Card where we sent the log and sure enough, there is the new log we just created. If I re-browse to update the screen, you can see the time stamp changing. Exactly what we expect. That’s all there is to creating a log. Before we go back to dig a little deeper into the instruction, let’s take a look at this file browser. You can copy a file from your host computer to the PLC. Copy a selected file from the PLC to the computer, delete a file and even create a folder. All the things you would normally expect. You can sort on any column, drop down into any folder and even show hidden files. This tells you at a glance all about your storage space for both the SD card and the built in Ram Drive. Browse to Root refreshes the view and quickly gets you to the root folder. That’s great if you are buried down in several layers of folders and just want to get back to the top level quickly. I also use it to refresh the screen. You can see the time stamp change each time I do that. Refresh updates this list if you insert an SD card while this dialog is up. This is for formatting a RAM Drive. You can’t format the SD card because it would take forever on the PLC. So for SD Cards, just format them on your computer before using them on the PLC. You can also mount or dismount the SD Card. So what does that mean? Well, when you insert or remove an SD card from a BRX PLC, it automatically recognizes the SD Card and opens it up for use or closes for removal. It’s kinda like when you put a USB memory stick into your computer. You’re supposed to eject it before removing it – right? Same thing. It just makes sure all loose ends are tied off before ejecting the SD Card. But we said the BRX automatically does this – right? So why do we need this? Well, often times we will build a system in an enclosure and we don’t really want end users opening the box for any reason, much less to extract a memory card. So we add an extension cord so folks can access the memory card without opening the box. The problem with that is when you remove a card from the slot on the PLC, there is a mechanical switch that closes to tell the BRX PLC its been removed. If you have an extension cable plugged in, the switch contact never happens and the BRX has no way of knowing the card was removed. Which means the card is never cleanly dismounted and you run the risk of getting corrupt data on the card. The way around that is to provide this mount and dismount ability. Simply bring up this file browser and dismount the SD card before removing the card from the extension cable. Similarly, when you plug the card in, hit Mount to tell the BRX a new card has been inserted. Can you connect an HMI and have a button on it to mount and dismount the SD card? Of course. Just use the File System Command in your ladder code to format, mount or dismount the SD Card. Note that it is fully asynchronous. You just hit it with a rising edge – usually the HMI button press - and then wait for it to tell you it’s done to tell the user it’s safe to remove the SD Card. Easy. Whether you are using an extension cable or not, make sure you are not writing to the SD card when you remove it from the PLC. Ok, enough of that. Let’s take a closer look at the File Log instruction. We can choose to write to the SD Card or the RAM drive that is built into the BRX PLC. But wait a minute, the legacy Do-more platforms don’t have SD cards or Ram drives – does this work on those PLCs? Yeah, it does. When you update the firmware the legacy platforms will now have RAM Drives and you can use the new e-mail instruction to send that log anywhere you want. How about that! You can type in a file name here – be sure to put it in double quotes. I prefer to use a string variable so I can change it programmatically when ever I want. Can you change the file name while the program is running? Sure! Our last example is still running, so let’s change the file name. Wait a second or two and bring up the File Browser. We want the SD card and sure enough – the new file is now being updated. Cool. We triggered our log based on a specific time period, but you can also trigger on any event. When you select that option, it just adds an edge triggered input to the instruction so you can trigger on anything you want. Undo that, and now it just logs periodically as long as power is applied. You’ve already seen the file name time stamp – this guy. That’s handy. This Generated File Name is cool. Suppose you have things setup to periodically log messages. And you want to e-mail a copy of the current log. How do you know what the file name is? It keeps changing – right? Well, if you check this box, the last used file name will always appear in whatever string variable you put here. So you just give this string variable to the e-mail instruction – which we will cover in a separate video – and you’re done! You never have to worry about what the current file name is! Once again – Do-more makes things so easy. You’ve already seen how easy it is to use this table. Just put whatever you want to log in here. Easy. This count is simply how many consecutive elements you want to send. If we wanted to log D0 through D4 we would have put a 5 here. You are limited to a max of 10 consecutive elements per row of this table. And you can insert a row, remove a row and moves rows up and down. Very easy to work with. This instruction works great in a stage program – which I personally prefer because it’s so easy – but you can also do your interlocking using C bits if that is your preference. That ought to be more than enough to get you up and running with basic data logging. If you have any questions, please contact AtuomationDirect’s free award winning support team during regular business hours. They will be happy to help. And don’t forget the forums. There are lots of automation professionals there that love to share their years of experience. Just don’t post any questions directed at AutomationDirect’s support team there, they don’t monitor the forums on a regular basis.