Convert decimal to hexadecimal from web browser

Forum Home Forums Understanding the Software Convert decimal to hexadecimal from web browser

Viewing 15 posts - 1 through 15 (of 42 total)
  • Author
    Posts
  • #13073
    kcks66
    Participant

    Hi Mikhail,

    I connected an inverter and I want to read its running output frequency and write command from web browser to change its output frequency.

    I managed to read its running output frequency. I faced challenge when I want to write command into the inverter from web browser.

    The inverter accept hexadecimal command to run with prefer output frequency. Below is the screenshot from communicator device which I could write command successfully in hexadecimal format.

    https://ibb.co/LRdn8fS

    0001 refer to run
    0BB8 refer to decimal 3000 (30Hz)

    I could use web browser to enter 00010BB8 and write successfully into the inverter.

    https://ibb.co/4gSjNCk

    I wish to enter decimal number example 30 in web browser and how to convert the 30 decimal number from web browser into 00010BB8 hexadecimal at the output channel before send to the inverter?

    Looking forward from your advice. Thank you.

    #13079
    manjey73
    Participant

    You need to use the formula in the control channel that will send the generated CmdData

    #13080
    kcks66
    Participant

    Hi manjey73,

    You meant write a scripts to convert decimal numbers to hexadecimal numbers in the output channel?

    I am weak in scripting. Any idea how to do it?

    Thank you.

    #13081
    Mikhail
    Moderator

    Hi,
    What is the current formula of the output channel?

    #13085
    kcks66
    Participant

    Hi Mikhail,

    Currently output channel has no any formula.

    #13086
    manjey73
    Participant

    public byte[] NewFreq()
    {
    byte[] freq = BitConverter.GetBytes)(uint)Cmd*100);
    return new byte[] { 0x00, 0x01, freq[1], freq[0])
    }

    I haven’t checked, but something like this

    #13097
    zzz
    Participant

    from webbrowers to VFD sounds a bad idea, there should be at least a middle agent to validate the data or access control etc…

    #13098
    kcks66
    Participant

    Hi manjey73,

    I got error message from SCADA Server:

    Error calculating standard command value for the output channel 20032: Unable to cast object of type ‘System.Byte[]’ to type ‘System.IConvertible’.
    Command is canceled

    My output channel formula:

    public byte[] NewFreq()
    {
    byte[] freq = BitConverter.GetBytes((uint)Cmd*100);
    return new byte[] { 0x00, 0x01, freq[1], freq[0]};
    }

    Pls advice and thank you.

    #13099
    manjey73
    Participant

    Formula

    Script in channel

    result on web

    For me, the formula does not cause errors during compilation. And the result of sending from the Web is shown below. It may be necessary to rearrange the bytes in the formula. Well, configure the command in the Modbus template as multiple for several registers in addition to the other channels.

    #13100
    manjey73
    Participant

    Yes, there is another nuance, in the formula it is necessary to additionally convert the number to HEX. We need to think about how to do this… Just using BitConverter is not enough for this

    #13101
    manjey73
    Participant

    | 31.07.2023 08:59:05 | Code=freq, Data=00010BB8 |

    Enter 30 in Web.
    Although no, it seems to be enough, I entered 30 into the Web and received the following data in the sent command.

    #13102
    manjey73
    Participant

    Is this your Modbus device ?

    #13105
    kcks66
    Participant

    Hi manjey73,

    | 31.07.2023 08:59:05 | Code=freq, Data=00010BB8 |

    Enter 30 in Web.
    Although no, it seems to be enough, I entered 30 into the Web and received the following data in the sent command.

    YES, this is what I need.

    I need to start from beginning step by step follow your instructions.

    The formula below is correct?

    public byte[] NewFreq()
    {
    byte[] freq = BitConverter.GetBytes((uint)Cmd*100);
    return new byte[] {0x00, 0x01, freq[1], freq[0]};
    }

    #13106
    kcks66
    Participant

    Hi manjey73,

    Next is my device template:

    https://ibb.co/gvcV15y

    Follow by my output channel:

    https://ibb.co/PDzX6hh

    #13107
    kcks66
    Participant

    Hi manjey73,

    I entered 30 in web browser:

    https://ibb.co/yfZv0Tn

    But error message occur:

    https://ibb.co/Dtx5cVZ

    What have I missed out?

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