Home store site map
Bookmark and Share
Video - Send Dynamic Text to ViewMarq™ (Part 1 of 2)

Video Transcript

Suppose you want to switch dynamically switch between two messages like this.

You could create two instructions where one has message A and the other one has Message B - right? Sure. But what if you wanted to switch between 10 or 20 or even a hundred different screens? Do you really want to create all of those separate ViewMarq instructions and every time you make a change you would have to update or change all of them? Again, you CAN do that, but with the Productivity 3000 there is a much easier way.

Itís called Dynamic Text. In the simplest case, instead of putting the text here, you just create a String Tag, and put that tag right here. Then when the program wants to change the message, it just puts whatever ViewMarq String it wants in this tag, re-toggles this instruction, and that updates the ViewMarq display. Now you are using one instruction to display any message you want simply by changing the contents of the TAG. And while thatís pretty handy, there is still an even better way to handle large quantities of messages by using indexed arrays. And it makes your life so easy - letís take a look.

In this program, this Init routine is called on the first scan. His whole purpose in life is to fill this ViewMarq Message array with ViewMarq Strings. Looks like we have these 5 messages stored in the first 5 slots of this array.

Back in the main program, we just look to see if the index has changed, and if so, we send a ViewMarq Message. When that happens, this instruction is going to send whatever message is in this array at this index offset. And thatís dynamic text Ė itís exactly like before - this instruction is just going to send whatever string is in the TAG, instead of what was in this static text box.

Note this little trick here Ė when the index changes, we set the previous index equal to the index so on the next scan these two are be equal and they donít retrigger this instruction. Now anytime the program changes the index to a new message, this will be different and this instruction will get triggered.

How cool is this Ė Now I can add as many instructions as I want to this array and my PLC code that displays the messages never changes. My program just changes the index whenever it wants to change the ViewMarq display. Thatís it. This is a really great way to keep your code easy to modify and maintain.

Letís try it. Iíll transfer the project down to this controller. And bring up a data view so we can change that index. Thereís the index right there Ė Iím going to write it out to give us a baseline.

Letís pretend weíre the program and somewhere else in our PLC code we decide we want to display a different message. Well, all our code has to do is change the index.

Letís say he wants to display message 3. And BOOM, the ViewMarq display instantly updates. What if you code wants to display message 5? Weíll it just changes the index, and again, boom, the new message appears. Easy

So again, now you can have as many messages as you want, and never have to change your ViewMarq display code!

Some folks may not be real familiar with arrays, so how do you create an array of strings like this ViewMarq Message string we used over here? Well, itís easy. Just go to the Tag Database. You add a tag. Give it a name. Letís call it VStrings. We want to create a 1 dimensional array of strings. We want each of those strings to be a max length of 128 characters. And letís create a set of, oh I donít know, maybe ten of those. So this array of strings can hold up to 10 strings.

Thatís it, now you would just fill that string in with messages back here in Init and back here in main in our ViewMarq instruction we would just swap out this string array for the new one we created. Thatís it. Thatís all there is to it.

Did you notice that the messages used in this example were all shorter than the 128 character max length of a Productivity3000 String? That was for the convenience of this video, of course, but truth is, most ViewMarq messages you use will be longer than 128 characters Ė especially if you use a lot of formatting options and variables. So, what if you need to use a longer ViewMarq String? Check out part 2 to learn the trick Ö Itís the same thing we did here, but instead of using 1 D arrays, we use 2 D arrays.

Well, That ought to be enough to get you going with SHORT Dynamic Text strings. Let us know if you have any questions. Automation Directs Customer Support is always free and just a phone call or e-mail away.

Performance plus Value … That's Productivity.

From AutomationDirect.