Skip to content

Inability to write without errors #560

@alpovo

Description

@alpovo

Hello Everyone
I have a problem that I've never had before but I've had recently. How can we solve it?
My problem is that I have a bool variable in DB100 at address 0.0, but I need to send true or false to this variable 3 times in order for it to be written to the PLC. This doesn't just happen with bool variables. It happens with all variables.

Image

previously=

public Plc plc = new Plc(CpuType.S71200, "192.168.0.10", 0, 1);
bool tf=true;

public void Btn_Click()
{
    plc.Open();
    if(plc.IsConnected)
    {
         plc.Write("DB100.DBX0.0",tf);
    }
   plc.Close();
}

Now=

public Plc plc = new Plc(CpuType.S71200, "192.168.0.10", 0, 1);
bool tf=true;
public void Btn_Click()
{
    plc.Open();
    if(plc.IsConnected)
    {
         for ( int i=0;i<3;i++)
             plc.Write("DB100.DBX0.0",tf);
    }
   plc.Close();
}

What I'm trying to explain is that when I write expression #1 this way, it works fine. Recently, I had to write expression #2 at least three times to send the full value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions