Jump to content

hotwires

Members
  • Posts

    203
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by hotwires

  1. I had a crash course in UniLogic string to num conversions (formatting/handling). You have to remove leading spaces and trailing non numeric characters if I recall correctly. The Visilogic string to num FB is more flexible as to what it will convert. If your ASCII string is purely numeric characters you should be Okay. If you need a subroutine to strip off other characters let me know. I could share a snippet of code I used. 

    • Upvote 1
  2. By filter the float values you mean extract for use elsewhere (separate from the rest of the telegram)? I have done something similar but on a smaller scale using find in substring and remove from string FB's. It would be a more complex construct for what you're doing, doable none the less. I agree with NahumS, need to see it in context, give an example of the extracted floats? A table, CSV, loaded into an array?

  3. The only reason I caught it so fast it that I've done it myself a few times. Only other advice most of the forum guru's would give is to break up the three lines in rung 1 into individual nets. I'm sure it works fine as coded but in some cases line stacking in a single rung (net) can give unexpected results. Something to do with the compiler, not sure... I'm loosely re quoting others. Glad you got it working to your satisfaction.

    • Upvote 1
  4. 52 minutes ago, JohnR said:

    I can see this working on a unistream device as it is a linux box, but has anyone gotten this to work with a vision device?

    JohnR

    As long as the wireless side of the bridge connects the ethernet side doesn’t know (or care) what it is connected to. In theory it should work with any ethernet enabled device using the standard TCP/IP protocol. I use Ubiquiti wireless networking devices for PtP and PtMP links. Almost all of their devices can be configured in bridge mode (WLAN:LAN). 

  5. 19 hours ago, Sandy said:

    Hi,

    I'm trying to build a snooper that works on a modbus RTU network, to test a controller built by a third party.

    In this situation the Unistream is neither a master or slave, so the built-in modbus RTU configuration isn't suitable.

    I'm struggling to to get messages recieved consistently using the COM Rx ladder block. (it doesn't help that this ladder function isn't documented in the help file, specifically how it determines message boundaries in the absense of STX/ETX characters).

    I'd like to know that each time the "Data Arrived Bit" goes high, the first "RxLength" bytes in the "Rx Buffer" are new bytes, but that doesn't appear to be the case.

    With the attached code, I get an entry in the 'Raw' Data table for almost every scan. With condition before the COM Rx removed, it works better - but not a lot - there are lots of duplicate message fragments, but occasionally  I get an unbroken and unduplicated sequence of characters which can be reassembled into a valid message.

    Any recommendations on how best to use the COM Rx function for this?

    Comrx.JPG

    I recently setup two Unistream 5” pro to receive serial ASCII strings from two Ohaus scales, eventually got it working as desired. You are correct on the lack of help file content on the SERIAL Com RX function. I have kindly suggested content be added for that function. 

    In rung two, the second object from left, top branch, tag “ComRx”; is that supoosed to be a coil or a contact? The (P) is a coil. This seems out of context. Try -|P|- positive transition contact. These two are close together on shortcut bar and ambigitouis sometimes. 

    See if that helps and please advise. The way it stands now as a coil it would pass thru a true every scan that “logging” is true. Happy coding Sir. 

    Hotwires

  6. UPDATE:

    FOR REFERENCE....

    I took the time to see how a Vision V430 handles ACSII to INTEGER conversions:

    Visilogic will convert ASCII strings with:

    -leading zeros

    -leading spaces

    -trailing spaces

    -trailing letters

    It will not accept:

    -leading non numeric characters

     

    Unilogic will only convert strings with:

    -leading zeros

    *Leading and trailing non numeric characters must be removed before conversion.

     

  7. Doesn't Visilogic support dynamic Slave ID? I was thinking I had a test program setup (once upon a time) where I could use entry keypad to set MODBUS slave ID, may have had to PTC the configure block in conjunction with new ID assignment. I recall it all working as expected. Everyone gets tired of hearing this from me (I'm quite sure), but here it goes again: "Why can't UniLogic have all the features of Visilogic and have all the new features of UniLogic"? A good share of Unistream sales (SURELY) is to Samba/Vision users who are upgrading hardware or at minimum very accustomed to Visilogic and it's feature set. It was a suprise to me as I slowly discovered the missing features. I know, I know... I want to have my cake and eat it to. Doesn't stop me from wishing :)

  8. It’s not “pre coded”. Fairly simple to construct however. Link display element ( touch feild) to a memory bit (MB1), in ladder use NO contact to drive timer coil, second net: use a PTC (positive transistional contact) to drive a reset integer function —[R]—

     

         MB1                             T1

    ——| |————————(   )——

     

           T1                                C1  (or T)

    —-|P|————————[R]——

     

    alternatively I believe timer can "self one shot" but would repeat cyclically if button was held longer than usual:

         MB1         T1            T1

    ——| |———|/|———(   )——

     

           T1                                C1  (or T)

    —--| |————————[R]——

     

  9. Thanks for the help everyone Has given me in my "head scratching" moments. I try to pay it forward when I can. Here's to 2019 and the many successes Unitronics solutions will give us. I've had some bumps in the road but the support from @Joe Tauser, Unitronics US, Unitronics Israel, and this forum has been amazing (and free). Kudos to all. 

    • Like 2
  10. On 12/23/2018 at 4:55 PM, Barry said:

    Deja vous, Ausman?

    I'm interested because someone else is looking for info on what seems to be a seldom used module, but concerned because we were never able to get the 232 port on the 02RSC to work. Either in serial or modbus configurations. 

    At this point you ought to get a special commendation for dealing with this hardware. 

    If you have an example of code and Unilogic software version, I could try to help. I have a Unistream 15.6" with 01RSC talking MODBUS  to an RS-232 radio modem in a SCADA system. I wrote the code and it all works fine. Curious as to what is preventing setup from working for you. 

    • Like 1
  11. I'm managed to figure out UniLogics: "string to num", "replace", and "find in substring" on my own through trial and error. "String to num" will not interpret spaces (20h) in place of leading zeros in an ASCII string that you want converted to an integer. This presented me a dilemma since my device would send: ASCII "123.45 g", " 23.45 g", "   3.45 g", or "   0.45 g".  The only assured zero place is the ONES digit. Using an iteration of "find in string" I got a count on the number of spaces left of the decimal point, used that to drive "times to remove" in "remove from string" only then could I rely on "string to number" to function regardless of tens and hundreds places being blank (spaces).

  12. On December 20, 2018 at 10:37 PM, Joe Tauser said:

    Yes  This is what I had to do with a scale interface I just did in Visilogic but it removed the decimal automatically provided it always comes in the same place.  I looked for the existence of the "g" character and the converted the characters in front of it-

    image.png.b4d096101167e9cbc63aacc978ad3ae6.png

    The integer weight landed in ML 70.  I'll have to load a UniStream up and see how that ASCII-Num block works.

    I generally don't use real numbers in the PLC unless absolutely needed  for advanced calculations. 

    Joe T.

     

    Thanks Joe, that is some meat and potatoes. Maybe I can equivicate in UniL and get same result with less FB’s than I am currently using. Trying to get out of the over kill programming habits, sure it works but less is more in ladder. Make it simple for the next Guy.

    UPDATE: Now I'm curious how Visilogic handles to the ASCII TO NUM conversion. @Joe TauserWere your ASCII strings padded with leading zeros left of the decimal? I.e.: 0123.45, 0010.41, 0007.26 in units of weight?

  13. Joe:

     

    Please elaborate. Scale returns x.xx, xx.xx precision. By virtual decimal place you mean "10.41=1041"? This is what I did on AB 5/05 proof of concept program. I have to strip the ASCII decimal character and join the tens/ones  characters with tenths/hundredths characters (concatenation?). I had the notion maybe the message parser could pull what I wanted out of the ASCII's rear end.

    It's weird that the STRING to NUMBER block won't convert double number ASCII bytes that don't include a digit (null) in the tens place. RSLogix didn't care about the tens place, would convert D#10, D#7, D# .41, etc. Parsing out tens and ones individually got me around the road block. Maybe I'm missing something there?  The INT to REAL command actually works with simplicity (something not as simple in RSLogix). The null ASCII tens place caught me by surprise a bit (actually a byte to be exact). I am hoping to ditch the MULTIPLY and ADD FB's.

  14. I have an Ohaus scale with a serial printer port connected to a Unistream 5" pro. A part is place on scale and a comparison is made to a valid weight range. I finally have a working model for getting weight ASCII string into a REAL but it's very clunky. There has to be a better way. The biggest issue with my conversion rung (before using mul & add FB's) is if I weight in a part at 10.39 grams and the REAL displays as such and the next weight is 7.43 grams (THE TENS PLACE IS A NULL ((BLANK)) CHARACTER) the real displays as 0.43 grams. The tenths and hundredths always read out okay because the zeros present regardless of fractional weight. Is there a cleaner way to take "   10.39 g" ASCII,  narrow to "10.39" ASCII and convert to REAL D#10.39?

    Next issue, I want the buzzer (more of a beeper) to sound for a short burst when a valid weight is received. In Vision there was a simple SB bit that would sound buzzer for any duration the OTE was true. I have tried several constructs with the BUZZER START AND BUZZER STOP actions but always end up with a continuous buzzer or a chatter. Please and thank you for any assistance. 

     

    Please see "WEIGH IN" subroutine for example of the code I have that works but could stand to be simpler.

    JorachoPressNewScale12-20-18e.ulpr

  15. On 7/5/2018 at 5:36 PM, Ausman said:

    Hi Hots,

    I thought someone else might have chimed in, but alas no.  So my thought is to do it all via modbus etc.  But it would involve changing the SLC program to allow it to do bus work, which you may not like to do as it does fall outside your "keep it intact" requirement.  However, I don't think it would be that hard to have enough talking going on for a perfectly ok  solution the way you want.  Essentially view the SLC as a modbus I/O.

    cheers,

    Aus

    It was my understanding that the AB SLC 5/05 does not have native MODBUS capability. Additional hardware like a Prosoft MCM-3150 would be required? Sounds like the answer to the question "Is there a simple way to make a Unistream panel communicate with an AB SLC5/05" is.... NO.

×
×
  • Create New...