read modbus register as ASCII

Forum Home Forums Uncategorized Issues read modbus register as ASCII

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7063
    Avatarqiuqiaoan
    Participant

    hello,
    i have modbus which have string valves as following example
    modbus string valve example

    and i set the modbus template in rapid scada as following
    modbus template in rapid scada

    set the value type in channels as ASCII text as following
    value data to ASCII text

    and simulate the value from modbus slave as following
    simulating modbus slave value

    but the display was wrong as following
    wrong display in rapid scada

    #7064
    Avatarmanjey73
    Participant

    leave the format as D, D.D, and so on. ASCII text is for another.

    #7068
    MikhailMikhail
    Moderator

    Hi,

    1. Read the registers from 30215 to 30218 as a double (8 bytes) in Communicator. They will be passed to a one input channel.
    2. Check the displayed value.

    Share new screenshots, please.

    #7079
    Avatarqiuqiaoan
    Participant

    Hi, Mikhail
    double (8bytes) worked. as shown in below link
    read as double

    if I would like to convert the 20 bytes ascii string (they are all numbers) to number, so the values can be stored in the database and be shown on the chart.
    do you have suggestion for that, any tested formular?

    thanks

    #7087
    MikhailMikhail
    Moderator

    Hi,

    do you have suggestion for that, any tested formular?

    You should develop a formula by yourself. The idea is the following:
    1. Create an input channel of the calculated type.
    2. Add a formula in the Formulas table

    double MyFunc()
    {
    // your code here
    }

    3. Use this formula for the created input channel.

    #7088
    MikhailMikhail
    Moderator

    In the formula you should join the strings. Something like

    string s = "";
    for (int cnlNum = 101; cnlNum < 110; cnlNum++)
    {
      s += ScadaUtils.DecodeAscii(Val(cnlNum));
    }
    return double.Parse(s)
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.