vectrex Posted September 22, 2010 Report Posted September 22, 2010 Hello ! I am kinda new to programming the V350 and programming in general. I have following situation and cannot find a workaround ;( i have 3 MBs indicating a status and i want to have another MB set if e.g. BIT1,2 is Set and BIT0 is UnSet .... so IF MB1 + MB2 = 1 and MB3 = 0 THEN MB4 = Set ELSE MB4 = Unset how can i implement such a function ?? Thank you for your help in advance ... best regards .. Thomas
pascal Posted September 22, 2010 Report Posted September 22, 2010 the easy way is |---[sB1]------(R mb4) SB1 = system bit 1 = ALWAYS 1 | |---[mb1]--|--[mb3]------(S mb4) |---[mb2]--| first net : reset coil MB4 next net : mb1 or mb2 and mb3 = set mb4 kind regards, pascal
Fantasia83 Posted September 22, 2010 Report Posted September 22, 2010 You can insert a conditional Subroutine Return following your TRUE Condition. (net 0) --|MB1|--+--|/MB3|--------(S MB4)-(Sub RETURN)- --|MB2|--+ (net 1) -----(R MB4) (net 2) RETURN
vectrex Posted September 23, 2010 Author Report Posted September 23, 2010 hello ! thanks for the reply but thats not exactly what i want to do i think @pascal: your version allways resets MB4 each cyle and then sets it again so MB4 is allways changine ?! i need MB4 be allways stable on or off @fantasia83: your version ... conditional sub routine ? call a subroutine ? so when MB4 is set it calls the subroutine and then resets MB4 ... also not what i want to do !? i have 3 Bits ... if they are 1 i want to set Bit4= 1 ELSE Bit4 allways is 0 please help again thanks ! and another question: when i set Power Options for MB ... e.g. to RESET ... on my V350 the MB only gets set to REST when doing two power off/on cycles .... how comes ?????????????????
External Moderators Ash Neilson Posted September 24, 2010 External Moderators Report Posted September 24, 2010 Hey! So you want to set MB4 to 1 if MB1 and MB2 and MB3 are 1, otherwise MB4 always is 0? <Net #1> MB1 MB2 MB3 MB4 --| |--| |--| |--() Very simple! If one of the MB's is 0, then MB4 will become 0 automatically. With the Power Up Options - the whole point of it is to RESET an MB when the PLC is restarted or Powered On/Off. If you are trying to keep, for example MB5 reset (0) all the time, just put this in a Net: MB5 --(/)-- Hope that helps you!
vectrex Posted September 24, 2010 Author Report Posted September 24, 2010 hello and HELP ... But what when MB1 or 2 or 3 isnt 1 anymore ... MB4 doesnt get Reset ... i need IF MB1 = 1 , MB2 = 1, MB 3 = 1 THEN MB4 = 1 ELSE MB4 = 0 so if e.g. MB1 turns from 1 to 0 MB4 needs to be reset to 0 !!! how can i achive thise funktion ??? please help
vectrex Posted September 24, 2010 Author Report Posted September 24, 2010 HELLO ! ... yes DIRECT COIL does the TRICK ... thank you for the help about power up options ... when i set a MB to Powerup option RESET ... isnt it supposed to RESET = 0 whenever i power off/on the PLC ????
Emil Posted September 24, 2010 Report Posted September 24, 2010 Hi Vectrex, I want to start a step earlier - how the controller works? When powered, it: 1. First check the status of inputs. Update hte memory, related to each input. 2. Execute the program - from left to right, from top to bottom. If it finds contact of an input, it checks the status of the memory, related to this input. If there is a digital output as result of a rung, it updates the relevatn to this output memory. 3. When finish executing the program, PLC updates the status of the outputs according to the relevant memory. 4. After finishing the update of the outputs, it starts a new scan. Based on this information - having Normal contacts as conditions and normal coil as result, each time the controller will come to this rung in the program, it will check the status of condition contacts and acording to this status - true or false - will update the condition. This condition will remain unchanged until the next scan (in case there is only one coil in the program, which is highly recommended!!!). The question you posted has very simple soluiton in Ladder language and Ash already gave it. About Power Up value: Think, at the beginning of your program, you write a rung, like N.O. contact of SB2 (active only the first scan after power up) = Set or Reset coil of the MB you want to give a Power Up value. As result this bit will have requested value. Then, in your program, you can change its state. If I'll take your example - if you give to MB4 power up value Reset, at the beginning of the scan its value will be 0. Then, comming to the rung Ash shown to you, according to the values of MB1, 2 and 3 it will be updated with a new value. I hope this makes sense to you.
vectrex Posted September 29, 2010 Author Report Posted September 29, 2010 yes and thank you ! e.g. i have MB 1-100 to reset ... is there a function to reset all at once or do i have to "manually" rest all one per one ?? thanks !!!!
External Moderators Ash Neilson Posted September 29, 2010 External Moderators Report Posted September 29, 2010 Hi Again. You can use a Vector Fill (Under the Vector Menu). A (Fill Value) = SB0 B (Fill Vector: Start Address) = MB1 C (Number of Operands to Fill) = 100 We use SB0 as the value of SB0 is always False (Reset). This Utility will fill MB1 to MB100 with the value '0' - meaning they will all be Reset. Remember if you just want to do this on startup, put a SB2 contact before it --|SB2|--
vectrex Posted October 12, 2010 Author Report Posted October 12, 2010 thank you BUT with fill vector i cannot fill MBs (only MI,XI,ML,XL,DW,XDW) any work around ???? THANKS !!!
Emil Posted October 12, 2010 Report Posted October 12, 2010 You can! Just move the scrol barr up to see this option!
CltOff Posted October 12, 2010 Report Posted October 12, 2010 Hello ! I am kinda new to programming the V350 and programming in general. I have following situation and cannot find a workaround ;( i have 3 MBs indicating a status and i want to have another MB set if e.g. BIT1,2 is Set and BIT0 is UnSet .... so IF MB1 + MB2 = 1 and MB3 = 0 THEN MB4 = Set ELSE MB4 = Unset how can i implement such a function ?? Thank you for your help in advance ... best regards .. Thomas The ans at the first question: --|MB1|--+--|/MB3|--(MB4)-- --|MB1|--+ (MB1 or MB2) and (not MB3) then MB4 =1 else MB4 = 0
vectrex Posted October 12, 2010 Author Report Posted October 12, 2010 humm ... i am using 8.0.1 build 0 and a V350 with VECTORFILL i cannot use MB it is not an option ;(
vectrex Posted October 12, 2010 Author Report Posted October 12, 2010 OK THANK YOU VERY MUCH !!!! i have several 100s of MBs in use so Resetting them was allways a pain ;) learning by doing and asking thanks again
Emil Posted October 12, 2010 Report Posted October 12, 2010 You're welcome! BTW - if you want ot reset vector of bits, the best way is to use SB0 as value to fill. Now you know you can use it...
vectrex Posted October 21, 2010 Author Report Posted October 21, 2010 hello again ! why please why is the ladder net width so limited ??? i mean the graphical editor ... why cant the vertical slider be expanded to the right ??? (to create longer functions IN ONE ROW !) thank you again !
Emil Posted October 21, 2010 Report Posted October 21, 2010 In fact - it's too big! We always recommend: Write one rung per net! Write simple, short nets! Following these roles, you will understand why in fact the nets are too big!
vectrex Posted October 22, 2010 Author Report Posted October 22, 2010 well i have the situation comparing about 100 thermocouples status judged by the temperature in status of wrong wired, wrong polarity .... so function gets big ... so no way to expand to the right instead of using lines lines lines lines ?
Emil Posted October 23, 2010 Report Posted October 23, 2010 Definitelly NO! And, as I explained in my previous post, this is not the right way of writing programs and we will not "sponsor" it. In other hand, VisiLogic has a lot of advanced tools to ease programming. Please describe better your needs. I'm pretty sure we can find some other solution. Small tip - take a look at FB Events...
Damian Posted October 23, 2010 Report Posted October 23, 2010 In fact - it's too big! We always recommend: Write one rung per net! Write simple, short nets! Following these roles, you will understand why in fact the nets are too big! Hi Emil, I disagree with you on this one. I like short simple nets as well, but I often find myself constantly creating the dreaded "S-loop" to be able to be able to finish one simple train of logic. If Writing one rung per network is good practice (as most of us probably agree), it would seem that Visilogic has too much vertical network area in proportion to the horizontal area. Even with the smallest function blocks, I can only have three in series and still have enough room at the right to place a coil without having to make a loop. Yet, Visilogic leaves room to create up to six parallel rungs in one network all tall enough to contain function blocks. As a side note. Most software dynamically modify the wires for you as you build code. RSLogix as an example. Once your net gets too wide it automatically does the S-curve for you. This tends to be much more efficient to program from a "development time" standpoint. I feel like I waste a lot of time in Visilogic drawing wires as if I were using Autocad, instead of just entering logic. Maybe something R&D can chew on for the "next generation". In this day and age, if something that can be automated has to be performed manually, we're just wasting time and money.
Damian Posted October 24, 2010 Report Posted October 24, 2010 well i have the situation comparing about 100 thermocouples status judged by the temperature in status of wrong wired, wrong polarity .... so function gets big ... so no way to expand to the right instead of using lines lines lines lines ? Sounds like you should consider creating a loop and using indirect addressing. If you have to do virtually the same thing 100 times over than it is to your benefit to organize it such that you can just re-use the same block of code as if it were a function.
Emil Posted October 24, 2010 Report Posted October 24, 2010 Right, Damian! Just idea - you can make DT with Address of... and then a subroutine. This way with one DT and few nets in one sub you will perfomrm all requested logic.
vectrex Posted October 25, 2010 Author Report Posted October 25, 2010 yes i definitly have to look at indirect adressing ... i started with programming (beside some basic with c64 ) from zero when picking the v350 for our projects and just wanted to get it to work myself so i just did it with direct adressing .... which means much S line drawing in the nets anyway the product is finished this will take time time time :P:P
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now