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.
From Automation Direct.