Problem in Sending Modbus (Command) Float32 data

Forum Home Forums Communicating with Devices Modbus Problem in Sending Modbus (Command) Float32 data

Tagged: ,

This topic contains 16 replies, has 3 voices, and was last updated by Mikhail Mikhail 2 years, 4 months ago.

Viewing 2 posts - 16 through 17 (of 17 total)
  • Author
    Posts
  • #2294
    Avatar
    raazsi
    Participant

    Thanks, Manjey n Mikhail… It really helped. Now that I got to know that we can write our own script in RapidScada. It’s really helpful.

    Meanwhile, i tried a bit on my own for generating reset output. I wrote a script wherein, the output is 1 for a specified duration and then it gets to zero. But I am facing a difficulty.

    The input parameter for the function is a coil channel read via Modbus from the Modbus device. Is there any way to set the values of output/Input channel dynamically through a code??? I tried with CnlValSet(Int Cnl, Double Value) & SetVal(Int Cnl, Double Value) But I am getting an error with it…

    Line 496, column 1: error CS0103: The name ‘CnlValSet’ does not exist in the current context

    Below is the snippet of the code I am using. The algorithm which I intend to use is that if the value of coil register is 1, then the function will return value of 1 for 5 seconds and then it will return zero. Then I’ll make the value of coil register to zero inside the function itself to reset it.

    bool Getreset (bool a,int InCnl )
    {
    // bool a is the value of coil register

    int result;
    DateTime now = DateTime.Now;
    DateTime now2 = now.AddSeconds(5);
    if (a==Convert.ToBoolean(1))
    {
    do
    {
    result = DateTime.Compare(DateTime.Now, now2);
    if (result < 0)
    return (Convert.ToBoolean(1));
    else
    return (Convert.ToBoolean(0));
    } while (result < 0);
    return (Convert.ToBoolean(0));
    CnlValSet(Incnl,0);
    }
    else
    {
    return(a);
    }
    }

    #2296
    Mikhail
    Mikhail
    Moderator

    You should use SetVal or SetData according to http://doc.rapidscada.net/content/en/software-configuration/using-formulas.html
    There is no function named CnlValSet unless you define it by yourself.

Viewing 2 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic.