Jump to content

Recommended Posts

Hi, I've written a program which has a 'save user settings' and 'restore user settings'.  Unfortunately, the code I ended up with is really complicated and I worry that future programmers will have a difficult time understanding how it works.  I've included a small snippet below for reference.  Is there a way to save settings on the SD card and load them back in without writing it into ladder logic, or other ways to achieve the same objective?

Thanks in Advance-

Zac

Save_Restore.jpg

Link to post
Share on other sites

@Zact - first of all, kudos to you for realizing that you're not the end-all brilliant programmer and somebody is probably going to have to follow up on your work in the future.  I highly, highly encourage writing network comments for each network as you write your program.  "Oh, I'll do that later".  No, you won't.

Your logic shown is rather complex, and it mirrors the first problem I give my students in my PLC class where I challenge them to toggle a bit with a single push button.  Using the Unitronics toggle function is not allowed, as most PLCs don't have one of these.  I'm not going to put the solution here unless somebody really wants to see it.

Anyway, in your example you show most of your settings to be Boolean choices.  Unfortunately, UniLogic does not allow how much screen space can be allocated for tag names so verbose tag names (combined with any elements) longer than 15 characters are cut off.  So keep your tag names short so you can read them on the screen.

If you haven't already, I would rework these choices into separate bits of a single BIT array.  If you check the Retain box the PLC will add them to battery-backed memory.

image.png.b8fdedcca8111f0121aacf44474fecb4.png

You can use the alias field to assign what each setting really is-

image.png.429aca0cd85c6e61f8db4311dfc15e77.png

 

No code required.  The PLC will remember the settings as long as the battery is good.

Now to answer your original question.  There are ways to make external copies of your user data.  I thought of these two that don't involve ladder code.

1.  In UniApps on the PLC, go to Memory tab -> Data Management -> Export Retained Tags.  This will copy the value of all your retained tags to a DOK (USB drive) to a file called "RetainedTags_r.hex".  Sorry, the SD card is not on the list of choices.

2. From UniLogic, you can upload all the values of the retained tags.  I always do this after setting up a machine to keep a record of what I did.  It's in the Help under Export and is super-easy:

image.png.79789aaea31631cb5db61c17333a54e7.png

 

If you have further questions upload a copy of your ladder program.

Joe T.

 

 

 

 

Link to post
Share on other sites
  • 2 weeks later...

Thanks Joe, Your info is helpful.  The problem I solved by making a 'restore user settings' option was: when our customers mucked around with the settings, they sometimes couldn't get back to where they were before, then they would call us.  I also have a 'restore factory settings', but each machine these control are a bit different, so have one set of settings doesn't help a lot other than if they do call us, I can ask them to restore factory settings just to have a baseline.  All the logic does is remember what state bit was in when the user saved the settings and then test if it needs to be changed when the user restores the settings.  I was just hoping there was some baked in section in unilogics that I'd overlooked that would maybe help avoid all the messy ladder.

Thanks again-

Zac

Link to post
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...