Jump to content

Write indirectly modbus register


ORSO2001

Recommended Posts

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.

Thankspost-44859-0-90846500-1448223718_thumb.jpgpost-44859-0-75752000-1448223724_thumb.jpgpost-44859-0-72443500-1448223729_thumb.jpg

Link to comment
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.