concatenate strings for caption in list selector

mrgees100peas

Member
Join Date
Aug 2016
Location
vermont
Posts
24
Hi,
I have a list selector which I want to display the recipe found inside a plc-5. The recipe is store in an ascii table with each character put in a different address. So A80:150 is the 1st character, A80:151 is the 2nd character for that recipe and so on.
What I've been able to do is concatenate them like this
/*S:0 {::[LineJ_Cartoner]A80:150}*//*S:0 {::[LineJ_Cartoner]A80:151}*/
all of that for just 2 characters. each recipe has at least 7 characters and there are 60 of them so you can imagine how much work it would be to do that for every entry. Is there a another way to tell the system use A80:150 thru A80:157?
 
Does PLC allow an indirect addressing syntax like A80:[offset], where offset is an integer? Then you could

  • initialize the output string to an empty string and offset to 150
  • concatenate A80:[offset] to the output string on each scan
  • increment offset by 1 for each scan
  • when offset increments to 158
    • store the concatenated string result
    • return to the initialization step
 
The solution per the article was to add ,LX where X is th number of positions you want. like this

{[LineJ_Cartoner]A80:150,L10}

In the example above I got the data from A80:150 to A80:159. However doing something like {[LineJ_Cartoner]A80:150,L20} did not give me the data from A80:160 which I found odd but whatever. We'll cross that bridge if we ever need to.
 
It isn't really odd at all, you got the exact data you asked for. Since you asked for 20 bytes (characters) and there are 2 bytes per word, the request should return 10 words. Remember to start counting at A80:150 since it returns the first two bytes. 20 bytes later you end at A80:159. To go even deeper to the bit level, this should return 320 bits of data. Starting at A80:150/0, this will take you all the way to A80:159/15. If you need A80:160, simply amend the L20 to L22 to get the next two bytes.
 

Similar Topics

Hello Everyone! What I would like to do is generate a random password to be used with the Active X Reset password object. I am currently doing...
Replies
0
Views
1,868
I have a panelview plus and a controllogix Plc that all the words above the start/stop buttons to display equipment names use a Concatenate...
Replies
3
Views
4,210
Hi, I want to concatenate the value of a temperature point with a string containing the engineering units in one textbox. Is that possible...
Replies
10
Views
5,287
Hello All, I have a little problem that I need some help with. I have got a 17 digit number coming from a supplier. It's basically a barcode...
Replies
11
Views
3,067
I am trying to concatenate two INTs into one DINT I have try following Knowledgebase Article 552006 but I am not having any luck. I have found...
Replies
6
Views
3,098
Back
Top Bottom