Forum Home › Forums › Understanding the Software › Use of the buttons
- This topic has 16 replies, 3 voices, and was last updated 4 years, 4 months ago by roni.
-
AuthorPosts
-
September 10, 2019 at 9:19 am #5931danielfernandesParticipant
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.September 10, 2019 at 1:53 pm #5932MikhailModeratorHi,
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.
September 11, 2019 at 7:12 am #5935danielfernandesParticipantThanks Mikhail,
I understand the idea and I already got implement my solution. I am doing little error.
Regards.September 11, 2019 at 1:08 pm #5937MikhailModeratorIf you face the error and can’t fix it, ask here.
November 27, 2019 at 9:31 pm #6086roniParticipantHi 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.November 28, 2019 at 12:05 pm #6098MikhailModeratorHi,
You can set a formula for an output channel the process the entered value. To create a complex formula, use the Formulas table.November 29, 2019 at 7:24 pm #6120roniParticipantThank 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.
December 1, 2019 at 12:12 pm #6134MikhailModeratorwhat 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?
December 2, 2019 at 4:31 pm #6139roniParticipantHi, 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.December 3, 2019 at 1:59 pm #6142MikhailModeratorHi,
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.
December 3, 2019 at 5:08 pm #6144roniParticipantThank 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.December 4, 2019 at 3:14 pm #6150MikhailModeratorChange && 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.
December 4, 2019 at 7:33 pm #6152roniParticipantIn 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.
December 5, 2019 at 3:03 pm #6154MikhailModeratorIt was the idea. I can connect to your PC and debug the formulas for a fee.
December 7, 2019 at 11:32 am #6164roniParticipantThank 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. -
AuthorPosts
- You must be logged in to reply to this topic.