Jump to content

Flex727

MVP 2017
  • Content count

    1,200
  • Joined

  • Last visited

  • Days Won

    97

Everything posted by Flex727

  1. You are trying to program like you would a computer with some other language, not program a PLC with ladder logic. PLC ladder logic should be organized completely differently. Every rung of every subroutine should be evaluated on every scan. You probably should be using a State Machine instead of what you're trying to do. Our resident genius, @Joe Tauser, has written an example program to help educate us on this terrific technique to handle the type of situation you are trying to deal with. Looking at your edit, it appears you might be headed in the direction of a State Machine, which is great. Look at Joe's example program and see if it helps you.
  2. If ladder rung #1 is supposed to be a standard latch circuit, it's wrong - MB 2 should be MB 4. I think conditional subroutine calls are very poor programming practice. You have to be extremely careful not to leave coils hanging in limbo when the subroutine stops being called. With PLC ladder logic, the next subroutine is normally called when the previous subroutine is finished - and not before. You don't need a bunch of code to create that situation, as you seem to be doing here.
  3. Yes, there is a GoTo in Unitronics Ladder Logic, but it should be avoided. It is poor programming practice in 99.9% of circumstances. There are far better ways to execute only the rungs you want executed. My philosophy is to work backwards from outputs or coils to inputs or contacts. Determine every circumstance that should turn that output or coil on and write that logic. When that is correctly done, there is no need to skip rungs because they will not activate the output or coil automatically. A simple way of accomplishing this is to assign a coil to turn on when a>=b, then place the inverted contact of that coil in front of the logic you want skipped.
  4. It seems that way too many programmers (especially in the beginning) fail to recognize what the ladder rungs are in ladder logic. The screen is not just a blank slate to write the logic willy-nilly. The purpose of the rungs and separating logic threads is that the compiler will create machine code that tells the PLC to fully evaluate a single ladder rung before moving on to the next rung. When you have two logic threads with dependency between them and place them both in the same ladder rung, the programmer has lost control over order of execution. When in separate rungs, the programmer knows the first rung will be fully evaluated before starting on the next.
  5. You don't need to do Download All & Burn until you're ready to place the machine into service. During program development and troubleshooting, just do a simple Download. Download All & Burn wastes a LOT of time unnecessarily.
  6. I think he said it backwards - do not combine networks in a single ladder rung. The first picture shows two independent networks, or logic strings in a single ladder rung. NEVER DO THAT. The second picture shows the the logic broken up into two separate ladder rungs properly. I created the examples in VisiLogic to show more clearly. Rung 1 shows how NOT to do it. Rungs 2 & 3 show the correct way:
  7. The first two don't look fine. The compare is false, yet the coil shows as true (they're in red). Do a find on each of the coils (MB 16, 17, & 41) and confirm they are not duplicated elsewhere. Also, confirm the subroutine with the compares is being called in the Main Routine.
  8. How many HMI screens do you have in the program? Probably the easiest thing to do is to open the V430 project, go to the first HMI screen, Ctrl-A, Ctrl-C, open the Samba project, go to the first HMI screen, Ctrl-V. Save & repeat for each screen.
  9. I would do it this way: ML 0 would be your total accumulated hours. You could add a reset pushbutton that zeroes both ML 0 & MI 0 when the blasting wheel is replaced.
  10. Yes, but I don't have a deep enough understanding of the compiler to know the result. With SB 1 there, I know exactly what the compiler will do. Like I said, your expression will most likely work perfectly, it's just poor practice since more complex expressions can get you in trouble. Placing a line there instead of SB 1 will also most certainly work perfectly - I just consider that also to be poor practice, though others may not agree. By the way, even a technically legal logic thread can get you in trouble with order of execution. You should always break the logic up into the smallest pieces as practical to place in separate rungs.
  11. I also sometimes (but rarely) like to combine multiple pieces of very simple logic together, as you are doing above. Here is the way I do it: This will compile as you would expect, but this is purely an organizational thing for easier readability to the programmer.
  12. Yes, that would count as multiple logic threads in a single ladder rung. It will often work but it is extremely poor programming practice. Remember that what the PLC executes is compiled code, not ladder logic. The compiler may not compile code like that exactly in the way you expect. You can be certain what to expect when the logic is in separate rungs.
  13. Let me see if I can explain this a bit more clearly. The MI is a memory location. It doesn't get "written to" in the sense I was referring above when talking about PLC order of operations. - First rung is evaluated, zero is stored in MI 1 - Second rung is evaluated, the value in MI 1 (currently zero) is compared to zero. It is true, therefore MI 1 is incremented. It is now 1. - Third rung is evaluated, the value in MI 1 (currently 1) is compared to 1. It is true, therefore MI 1 is incremented. It is now 2. The ladder is now complete and the outside world can now see that the value of MI 1 is 2. Then we return to the first rung and start all over again with the same result.
  14. I just realized this is a bit ambiguous. The "O" operand itself will be updated immediately when it appears as a coil. When I say Write Outputs, I mean when the output module itself (the physical hardware) will be written to (thus actually sending the signal to the outside world).
  15. This is not true. MI 1 is reset to zero at the beginning of each scan, then it is incremented twice. The value will be 2, and it will stay at 2. The outside world will never see any other value for MI 1 except 2.
  16. "Outputs" means the digital outputs that are operands that begin with O. Integer operands, such as MI 1, are not outputs.
  17. The value would be 2. This is a fundamental property of PLCs running ladder logic. The basic order of operations is: 1) Read inputs 2) Execute all ladder logic 3) Write outputs Repeat. This is simplified, and leaves out networking, HMI updates, and analog (and certain other I/O), but this should be fully understood by any PLC programmer. No, it's because all ladder rungs are executed before it gets back around to re-evaluating the timer coil.
  18. I'd like to help, but I don't know what you mean by "cross check". The program has too many problems to discuss coherently in this forum. Do you have a specific question?
  19. You can download older versions of VisiLogic from Unitronics. The correct older version that matches the OS in the PLC will not generate the error you are seeing. I'm not sure which version you need off the top of my head though, so perhaps someone else here will know, or you can contact Unitronics Support. Also, I don't believe updating the OS in the PLC will disturb user application, but lacking 100% certainty, I will not recommend that.
  20. Flex727

    UniStream simulator

    My perspective is that with other companies you pay for the software. Even buying a PLC from Unitronics is still cheaper than buying software from other companies. And with an actual PLC for your simulator, you can be assured that the simulation of your code is 100% accurate.
  21. Unitronics publishes specs online for all of their hardware. Just look it up at https://unitronicsplc.com/
  22. I don't think you're understanding how an analog input works. Your analog input has a 10-bit resolution (or 1024 units). The number that you get in the MI associated with the input will range from 0-1023. For 4-20mA, it will range from 204-1023. Use 204 & 1023 in your linearization for X1 & X2 and you'll find it works better.
  23. Do you still have the screen protector film on the HMI screen? If so, remove that and carefully clean the screen. That is not a bootstrap display, that is Information Mode. It appears when the screen is touched for 4 seconds. I have had a particle trapped under the screen protection film that was recognized as a continuous touch. These are resistive touch screens, different from your cell phone (which are capacitive). Resistive touch screens respond to pressure. Make sure there isn't anything touching the screen or torquing it in some way.
  24. You're still trying to communicate on every PLC cycle (for 100ms at a time). Try using a positive transition on SB 7 in rung 3 and a negative transition in rung 4.
×