In the first part of this video, we cheated a little bit. Did you notice? All of the ViewMarq messages were less than 128 characters long Ė Thatís the maximum allowed length of a string in the Productivity 3000. The problem is ViewMarq messages can be up to 500 characters. And honestly, youíll find most of your ViewMarq messages will be longer than 128 characters Ė especially when you start using a lot of formatting like this or you start using variables. So Ö How do you handle these longer messages if the Productivity 3000 can only handle 128 characters at a time? Weíll it is the exact same concept as we used in the previous video with the 1 D arrays, but now you just have to break things up a little bit and take advantage of the Productivity 30000ís 2D arrays.
Over in the TAG database, instead of creating a 1D array of strings, you create a 2D array of strings. Letís give it a name - weíll call this one Long Messages. Itís a 2 D array of strings. We want each of those strings to be 125 characters long, and we need four of those to build a 500 character ViewMarq message. And letís see. Letís go ahead and have this array hold 15 of those 500 character messages. We can always change that later if we need to add more messages.
So over here in the Init routine, we just fill in as many of these 125 character sub strings as we need. For example. Hereís that ViewMarq message we had a second ago. It was what .. 414 characters long. Iím going to copy this and Iím going to drop it into notepad. Then in notepad Iím going to make myself a little ruler. Thereís 10 characters. Copy that. And that will give me 20, 30, 40, 50, 60, 70, 80, 90, 100, 10, 20. 1, 2, 3, 4, 5 characters. Now I have a 125 character ruler and I can use that to break up my message. Letís find a nice clean place to break it. Letís break it right there. And letís see Ö I like to break it at a non-whitespace, so Iíll grab that one right there. And that one right there.
Now I have four parts of that message, all less than 125 characters.
Now we just take the first part, copy that, go over here to our copy data instruction, and drop it into that 2-D string we just created. This will go into string number 1, part 1. He gets that first sub-string. Remember to start with quotes, and end it with quotes.
Then we drop the second string into the first message, part 2. Let me go get that guy, and drop him in here. The third part Ė guess where that is going to go Ö yep, you got it. Message 1, part 3. Let me go grab that guy. And drop it in. Opening quote, paste, close quote.
And letís go ahead and do the last one. And we are done.
We now have the first message setup.
I went ahead and created a few more messages for us to play with. But you see the pattern here. Hereís the original message with his four parts. The second message with his two parts. Third message has two parts. Fourth message has two parts. And the fifth message has two parts.
And notice that these donít have to be in any particular order. Just make sure you get all of your substrings filled in.
Well, given that we have populated all of the strings, all we have to do now is go back to main, drop into the ViewMarq instruction, and put our new 2 D string in here. This is LongMsgs, and we want the index to pick which message to display. And right here we put part one. Iím going to copy that. So down here, I can put part 2. Over here I can put part 3. And over here we can put part 4.
So now the ViewMarq instruction will automatically assemble the four parts of this and send them out to the ViewMarq for you. How about that?
So really, other than using this new 2D array to create the long string, this is identical to the simple version we had with short strings in the previous video. Somewhere in your PLC code, you just change that message index and you get a new display. The ViewMarq instruction does all the dirty work for you.
Letís go ahead and try it real quick. Iím going to transfer this down to the controller.
And now, to display those long strings we just change the message index Ė just like before. Letís go ahead and display message 1, and there it is. Message 2 and there he is. Message 3. Message 4. And message 5.
So the beauty of this is Ė look Ė we didnít change a thing up here in the main program level. All we did was populate the strings and put the new 2 D array in our instruction. Thatís it.
And again Ė I can add as many long messages as I want now, and my ViewMarq display code doesnít change a bit, does it? Thatís a real time saver for large projects and makes changing messages a snap. And all it cost us was making a simple 2D array over there in the TAG database, and filling it up with all of those 125 character chunks of the ViewMarq messages. Easy.
Well, that ought to be enough to get you going with LONG Dynamic Text strings.
Check out the other How To videos in this series to get the most out of your Productivity 3000 and ViewMarq systems.
And please 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.