Use of the buttons

Forum Home Forums Understanding the Software Use of the buttons

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #5931
    danielfernandes
    Participant

    Hi,
    I need help for implement a system in web page where exist two buttons (on / off) and one led.
    I want that, in web page, the led was green if user press one button and red if user press off button.
    My question is how modified the variable/channel when the user press the button. I already read the manual but I don’t understand how I can use the output channels and formulas for this implementation.
    Can you help me?
    Regards.

    #5932
    Mikhail
    Moderator

    Hi,
    I can help by providing the idea here on the forum. Also I can connect to your PC remotely and configure the system with you. The 2nd way is for a fee.

    You should do the following:
    1. Create an input channel of the Calculated discrete type. This channel stores the led state.
    2. Create 2 output channels for the buttons.
    3. Create a scheme to display the led and the buttons.
    4. Bind the led to the input channel and bind the buttons to the output channels.

    Use SetVal() formula in the output channels to set led state. More details about available functions is here.

    #5935
    danielfernandes
    Participant

    Thanks Mikhail,
    I understand the idea and I already got implement my solution. I am doing little error.
    Regards.

    #5937
    Mikhail
    Moderator

    If you face the error and can’t fix it, ask here.

    #6086
    roni
    Participant

    Hi Mikhail, continuing with the inputs and outputs, I would like to know how to access two output channels from one dynamic text box.
    Once a value has been entered, I need to analyze it with two different formulas and show each value in an output.
    Regard.

    #6098
    Mikhail
    Moderator

    Hi,
    You can set a formula for an output channel the process the entered value. To create a complex formula, use the Formulas table.

    #6120
    roni
    Participant

    Thank you. I think I have not explained myself well. I have a decimal value (X.Y), obtained by means of a dynamic text, I convert it into two integers (X) (Y) and what I need is to be automatically sent to two different registers of a device modbus (X = Reg1) (Y = Reg2). Thank you.

    #6134
    Mikhail
    Moderator

    what I need is to be automatically sent to two different registers of a device modbus

    It’s possible to send 2 registers in a one command. But in the command form, you enter only a 1 number to send. Is it a problem in your case? Or you get the values that are already present in input channels?

    #6139
    roni
    Participant

    Hi, Mikhail.
    My device has two records that can be read and written. These records are of time, Reg1 maximum 23, Reg2 maximum 59.
    In my application I take those values ​​and show them in dynamic text, then if I want to modify them, I select the text, enter a command value, check that the value entered is in the range of HH for Reg1 and MM for Reg2.
    My problem is that when I send the value to the device I can only send it to the register that has the output channel activated. I have placed the commands as multiple.
    I am looking for a formula to send the two values ​​in one action. If I enter them directly in binary format if they are entered correctly.
    Regard.

    #6142
    Mikhail
    Moderator

    Hi,

    This is the idea of output channel formula:

    double SendHour()
    {
      return (((uint)Cmd) << 16) && (((uint)Val(111/*Minutes channel*/)) & 0x00FF);
    }
    
    double SendMin()
    {
      return (((uint)Cmd) & 0x00FF) && (((uint)Val(110/*Hours channel*/)) << 16);
    }
    

    You need 2 output channels, for hours and for minutes. Not tested.

    #6144
    roni
    Participant

    Thank you very much for the help.
    Two clarifications:
    1- the code sends the error:
    -the operator ‘&&’ cannot be applied to operands of type ‘int’ and ‘uint’
    2-this code is to obtain the value of Hours and Minutes, which I had already solved, what I need is to know if there is a function to send a single value formed by the two data and that can be sent to the device as It is done in binary format.
    I have tried to work with the automatic control module, but it does not give me time to verify the options.
    Regard.

    #6150
    Mikhail
    Moderator

    Change && to &

    if there is a function to send a single value formed by the two data

    If I understand you correctly, the above functions do what you need. Otherwise, provide more detailed description what an operator does and which Modbus packets should be sent.

    #6152
    roni
    Participant

    In dynamic text (input 401-output 3101), I enter a decimal value, for example 8.30. By means of a formula, I separate Hours=8 and Minutes= 30 and verify that the values ​​are in their respective ranges.

    The modbus device stores the H in address 513 and the M in address 514, if I manually enter in binary format with the formula new byte[]{0x00,0x08,0x00,0x1E}, the data is send correctly.

    If I apply the functions you sent me, the value obtained is 524,318.000, (8 001E) hex, but only part 001E is stored in the H register if it does not exceed 23 (0x17) and the register M is saves with 0.

    My intention is to send that value to those values ​​in standard format after entering the output in the dynamic text.

    #6154
    Mikhail
    Moderator

    It was the idea. I can connect to your PC and debug the formulas for a fee.

    #6164
    roni
    Participant

    Thank you very much for your help.
    I have managed to solve the problem. I think it was the selection of the number of bytes used in multiple mode.
    I think this option had already been selected, but as sometimes the save is not executed at first, it would not be saved well. Can it be a problem with my configuration?
    Regard.

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.