News:

  • July 07, 2026, 12:57:23 PM

Login with username, password and session length

Author Topic: Strings and How Do I Fix the "Short" Ones?  (Read 34273 times)

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #15 on: April 05, 2016, 12:52:09 PM »
Mike, If you can give a little more detail as to exactly what you are trying to do then maybe I can help. I have dome some pretty deep string manipulation between C-more and Do-more.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #16 on: April 05, 2016, 12:54:41 PM »
Quote
Some days I begin to wonder whether I am the only one having these issues.  But more likely I am just the squeakiest wheel.

I don't have C-More issues because I don't use C-Mores, but all HMI's do weird things you have to accommodate.  My current preference, mostly having to do with the TFT they use (brightness, saturation, resolution, etc.) is Idec, but their software is no better than anyone else's.

In fact, the cheapest HMI's, C-More's and the AVG's sold by EZAutomation.com, actually have some of the least annoying software as HMIs go.  I just don't use them because the actual screen hardware isn't as good.
« Last Edit: April 05, 2016, 12:57:57 PM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6165
  • Yes Pinky, Do-more will control the world!
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #17 on: April 05, 2016, 01:15:29 PM »
I am not writing to the .MaxLen at all. I know Data View doesn't allow it. That is just the behavior I see when the C-more writes to the string.

We know you're not. We think that C-more is writing the entire structure, rather than just the relevant parts, and would be overwriting the read-only MaxLen with bogus data. The low level comms do as little error checking as possible to minimize performance hit, assuming that comm clients are playing by the rules. It seems that C-more is not.

As an aside: When we first released Do-more we didn't allow any HMI to use the programming protocol for exactly this reason. My preference remains that all HMI should go through quarantined memories like Modbus and DLxxx, but, customers complained and ADC asked us to reconsider the policy. We may need to add some additional checking to prevent this. Fortunately, it only affects writes, which should be comparatively rare.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6165
  • Yes Pinky, Do-more will control the world!
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #18 on: April 05, 2016, 01:17:17 PM »
But more likely I am just the squeakiest wheel.  :D

Squeak away, my friend. We listen.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #19 on: April 05, 2016, 01:30:01 PM »


Stay squeaky, my frensss!
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #20 on: April 05, 2016, 10:08:55 PM »
Mike, If you can give a little more detail as to exactly what you are trying to do then maybe I can help. I have dome some pretty deep string manipulation between C-more and Do-more.

Basically "duplicating" the functionality of an old Giddings and Lewis system that I don't get to see the original code of. I looked at using the C-more recipes, but frankly keep shying away from them. I like the idea of the recipes living in the PLC better.

So the issue area gets down to the lacking text input functionality in the C-more. I am using the User qwerty keyboard with a few tweaks to give more symbols (and I originally had no comma, but I can't remember what it was inputting.) That's another issue as an aside. I copied it and modded it and now I can use the copy, but can't find it in the keypad screens anymore.

So I am wanting to have the operator allowed to enter a recipe description of no more than 40 characters. I then create a date and time stamp string from the PLC clock and append what the operator entered. All 60 recipe numbers and time-stamped descriptions are on one screen simply as a recipe parts list. The desired recipes for a job are entered by the 1-60 numbers (any 5 in any order even duplicated, 0's for unused.)

All of that is working properly, except I can't limit the C-more string to 40 characters per franji1's advice. OK, I can, but I have to be very careful how I handle it afterwards because it is highly infectious towards other strings. Oh, and if anything bad happens there's a trail of evidence pointing straight to me.

I did look at some kind of event handling but every time I had another ah-ha idea it had already been anticipated and blocked. Pretty frustrating.**  At this point I will probably just snip it in the PLC and be done with it.

And on the Run screen, where the 5 (or less) "chosen" parts reside, I strip off the time stamp and just show the description the operator entered.

So I guess I have enough of a handle on this at the moment that I am moving on to the extraneous I/O logic and the other 2 servo CTRIO2's. The real booger was wrapping my head around blending those chosen recipes into a linear progression through a machine. It's more like scheduling than anything else, no steps can be missed because you can't go back, you can never go back. Well, until the last piece of the order drops off and then you can back the hopefully still unblemished material out 20-30 feet.

Anyway, I tend toward verbosity rather than succinctness.

Thanks plcnut. I've played with strings in QuickBASIC and others a good bit, mostly long ago. The Do-more terminology is a little different but seems to work well for this.

And thanks HOST! I am pretty amazed when I look at how little code I have actually written to get some pretty powerful results. And still at 1.2mS max so far. I'm not the best planner in the world, I much prefer the just try it and see approach. The Do-more makes this pretty painless indeed. I have actually found myself looking at what the logic churned out to make sense of the numbers. It was usually easier than Excel though I used it extensively trying to understand the pattern I needed to see.

 

*(especially after I finally realized all of the Ctrl-C Ctrl-V's I had done were indeed being processed - even though I was clicking on the pushbutton object each and every time before Ctrl-C, it was copying entire screens over in the left pane instead, site unseen. C-more has a focus issue, even the tag name tool tips intercept and steal mouse clicks.)

** I do have some event manager sounds working finally, but found that just because it is a .wav file does not mean C-more will play it. It has to be PCM format or at least not CCITT u-law. The simulator played those fine.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6165
  • Yes Pinky, Do-more will control the world!
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #21 on: April 05, 2016, 10:21:07 PM »
And thanks HOST! I am pretty amazed when I look at how little code I have actually written to get some pretty powerful results. And still at 1.2mS max so far. I'm not the best planner in the world, I much prefer the just try it and see approach. The Do-more makes this pretty painless indeed. I have actually found myself looking at what the logic churned out to make sense of the numbers. It was usually easier than Excel though I used it extensively trying to understand the pattern I needed to see.

Some of the highest praise you could give us and absolute music to my ears. Thank you!
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #22 on: April 05, 2016, 10:39:38 PM »
Point your text input at MHRs or other integers instead of Do-More strings.  For years, that was the only way we had to do it and the C-Mores handle that just fine.  Then you don't have the length issues.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: Strings and How Do I Fix the "Short" Ones?
« Reply #23 on: April 05, 2016, 11:13:11 PM »
Point your text input at MHRs or other integers instead of Do-More strings.  For years, that was the only way we had to do it and the C-Mores handle that just fine.  Then you don't have the length issues.

Thanks! I'll give that a whirl. I am happy with the C-more's displaying of the SS strings (now that I know what to watch out for), just that single one is used for input. Do-more massages and moves it where it is needed. I would really prefer C-more limit the entry to 40 characters so that may be the way to do it for this one.