ORSO2001 Posted November 22, 2015 Report Share Posted November 22, 2015 Dear All, I am approching at PLC world then excuse me if the following question will be "stupid": I create a screen with two numeric boxes (dec); one is for the value one is for the "item" (called 1 and 2) that will have the value; each item has a differente modbus register. I thought that if I use an "equal" function to compare the number of the item and enable an "store" fuction to write the register but it doesn't work...if I simulated it the red line stop in the middle of the two fuctions (equal and store)...what I have wrong or I forgot?...attached some pics about what I have. Thanks Link to comment Share on other sites More sharing options...
Saragani Posted November 23, 2015 Report Share Posted November 23, 2015 Is function2 ever being called by function1? Link to comment Share on other sites More sharing options...
ORSO2001 Posted November 23, 2015 Author Report Share Posted November 23, 2015 Dear Sarangani thanks for your quick answer. For sure I misunderstand the meaning of "ladder function n°"...after reading your message I checked in the "help" of Unilogic about "ladder function"...If I understand each ladder function can has many regions and each region can has many row...it is correct? In the help I found that exist a instruction called "jump to region"...maybe I have to create a new region instead of a new "ladder function" and, at the end of the first region, insert the jump to region instruction...it is correct? however I don't found or better I don't understand how I have to do for enable or jump from a "ladder function" to others...can you help me in this way? Thank in advance Link to comment Share on other sites More sharing options...
Saragani Posted November 24, 2015 Report Share Posted November 24, 2015 Hi, I'll try writing the ladder as pseudo code: private function ladder() { while(true) { function1() // main } } private function1() { region1: // some code here region2: // more code here region3: if (someBit == 1) { Goto region2 } } function2() { region1: // your modbus code } Region1, region2 and region3 codes are being called, but a region is like a block of code, the the region is like a label you can jump to using GOTO. With my example. you see that function2 is being declared, but never called (which I believe is the situation in your code). You have to call it using the Call element Link to comment Share on other sites More sharing options...
ORSO2001 Posted November 24, 2015 Author Report Share Posted November 24, 2015 Dear Saragani, many thanks for your clarification...It is clear...I will try to make it real. Link to comment Share on other sites More sharing options...
ORSO2001 Posted November 26, 2015 Author Report Share Posted November 26, 2015 Thanks...it works! Link to comment Share on other sites More sharing options...
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