Modbus register, pulling in multiple 16 bit unsigned.

I would like to pull in multiple registers with one dataset.  I attached a screenshot which shows registers R30001 through R30016.  As you can see, R30001 has a value of 94, R30005  a value of 138, etc. 

This is if I set my PLC data type to Input registers, PLC base address: 30001 and Number of values: 1 the resulting dataset reads 94.  If I then change Number of values: 16, the resulting dataset reads 94.

Q: How do I read multiple registers and then separate them to individual analog values?  I would assume number of values is delineated by individual registers where value (1) is register R30001, value (2) is R30002...so forth.  If diagnostics can read them this easily there must be a simple way to pull these in.  Thanks in advance.Modbus_registers.docx

  • The input registers (R30001, R30002, etc) are fields of the device signal tag for the dataset.
    If you gave the dataset configuration a DST like PLC_REGS, you can use PLC_REGS DST on an AI block and then select the register or use PLC_VALS/R30002 from logic to get the value.

    Where are you trying to use/see them?
  • Helllo Scott Krejci,

    I took the liberty of inserting the screenshot you reference here in my reply so members of the community can see it from their mobile, etc and do not have to download it.  For future reference, to  Insert an image into the post, you can use the Insert/Edit Media Icon that lives in the formatting toolbar just above the blank field when you created the text for your post. :)

    Best Regards,

    Rachelle McWright: Business Development Manager, Dynamic Simulation: U.S. Gulf Coast

  • In reply to Matt Stoner:

    If i understand your reply properly I'm already pulling them in as float. An AI Block would only allow me to pull in one value at a time, that part I understand. I would like to pull in all the registers for say, temperatures for channel 1-6 as one DST R30001_30006. For simplicity, using binary, that would be register R30001 through R30006 which turns out to be channel 1 temperature is R30001 = (0000 0000 0000 1010) base 2 or 10 degrees F in decimal. (units are assumed). Channel 2 is R30002 = (0000 0000 0110 0100) = 100 deg. F. But when you put them together it results in a composite number: (0000 1010 0110 0100) which is in base 2 and the converts to 2,660 in decimal . At that point you would need to separate the high word and low word to convert it back to float to give 100 degrees and 10 degrees. So I'm pulling them in to display them on a Delta V graphic and trend in historian.
  • In reply to Scott Krejci:

    Matt, I read your post again and it took a minute to make sense. Let me try this.
  • In reply to Matt Stoner:

    Fantastic, it works. Thank you.
  • In reply to Matt Stoner:

    The AI block works, but what do you recommend I use for XD_Scale, OUT scale? I've tried 0-100 and 0 - 32,768. These may also be 32 bit extended registers. I'm not sure because its a vendors PLC, I do not have access to it only the serial data. Thank you.
  • In reply to Matt Stoner:

    You can use a register DST to an AI function block?
  • In reply to Rachelle McWright:

    For the scaling you need to know how the value is scaled in the vendor PLC, as well whether the PLC sends values as 16 bit signed/unsigned integers, 32 bit signed/unsigned integers or reals (floats).
    For instance a temperature may be send as a signed integer multiplied by 10 to keep one decimal. If you want to capture a range from -100 to 100 deg, in that case the XD_SCALE will be -1000 to +1000 and the OUT_SCALE will be -100.0 to 100.0
    Other PLC's might send values as unsigned integers in count values. I am communicating with a PLC where the full scale of an instrument is send as a count value from 819 to 4095 counts. With the same temperature range as in the previous example that would be XD_SCALE 819 to 4095 and OUT_SCALE -100.0 to 100.0

    At least in DeltaV versions 12 and 13 you can configure the Modbus register on the AI functionblock using the DST parameter, e.g.: DST_NAME/R30001.
  • In reply to Bill Sayers:

    Yes you can use a serial dataset DST and select the register on an AI function block.
  • In reply to Scott Krejci:

    The scaling depends on how the information is being sent. I have seen this done in different ways and depends on the device and/or programmer. I have seen 0-32768 be 0-100% of scale and also seen the value needing to be divided by 100 or 1000 to convert the value with the correct number of decimal places.

    You will have to dig into the PLC logic to figure out how the value is encoded or hopefully the PLC vendor can just tell you :)
  • In reply to Alfred Pol:

    You have always been able to reference a Data Set register directly with an AI block. However, in v12, DeltaV licensing changed. In previous versions, licensing was counted by module and every module that referenced a Data Set resulted in additional licensing. In v12, licensing shifted from module reference counting and now one Data set equals 1 DST , no matter how you reference it. The result is you no longer need to use landing or marshaling modules to manage DST licensing on Data Sets. This makes for a much cleaner configuration.

    Note. If the register contains packed discrete bits, do not use the AI block to read the register. The AI block converts the value to floating point and you can end up with some loss of bit resolution. Read these with external references and process with the BFO block.

    Andre Dicaire