Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • YouTube Videos
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Agility
      • Book your Agile Fundamentals training
      • Book you Kanban workshop
      • Learn more about Agile
        • Agile Webspace
        • Everything Agile
          • The Agile Manifesto
          • Best Practices
          • Retro Recipes
        • Methodologies
          • The Scrum Framework
          • Kanban
          • Extreme Programming
        • Roles
          • The Product Owner
          • The Agile Coach
          • The Quality & UX Coach (QX)
    • >> Go to DataMiner Docs
  • DevOps
    • About the DevOps Program
    • Sign up for the DevOps Pogram
    • DataMiner DevOps Support
    • Feature Suggestions
  • Swag Shop
  • Downloads
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Solutions
    • Deal Registration
  • Contact
    • Sales, Training & Certification
    • DataMiner Support
    • Global Feedback Survey
  • >> Go to dataminer.services

How to Set two bytes value in Parameter with QAction

Solved1.30K views19th March 2021QAction
3
Jurica Gajski140 17th March 2021 0 Comments

Hello,

Working on MODBUS communication and want to set value for two bytes in Parameter 2000 from QAction with protocol.SetParameter(2000,Val),. If this Prameter would be static it looks like this:

<Param id=”2000″>

<Name>Adres TempW2</Name>

<Description>Adres of TempW2</Description>

<Type>fixed</Type>

<Interprete>

<RawType>other</RawType>

<LengthType>fixed</LengthType>

<Length>2</Length>

<Value>0x000x11</Value>

</Interprete>

</Param>

What type must be variable Val (string, int, double…), how to calculate its value and how must be set xml tags in Param id=”2000″?

<Param id=”2000″>

<Name>Adres TempW2</Name>

<Description>Adres of TempW2</Description>

<Type>?</Type>

<Interprete>

<RawType>?</RawType>

<LengthType>fixed</LengthType>

<Length>2</Length>

</Interprete>

</Param>

Thank you!

Jurica Gajski Selected answer as best 19th March 2021

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
7
Laurens Moutton [SLC] [DevOps Enabler]9.05K Posted 18th March 2021 5 Comments

Hi,

This can be done by defining the parameter like this:

<Param id=”2000″>
<Name>Adres TempW2</Name>
<Description>Adres of TempW2</Description>
<Type>read</Type>
<Interprete>
<RawType>unsigned number</RawType>
<LengthType>fixed</LengthType>
<Length>2</Length>
<Type>double</Type>
</Interprete>
</Param>

In the QAction this can then be filled in like this:

int adresValue = 268;
protocol.SetParameter(2000, adresValue);

In the StreamViewer the communication will then look like this:

<< 08:01:52 – Send Command
000000 0C01

As you can see this is probably not as expected, as decimal value 268 is 0x010C and the StreamViewer is showing the bytes reversed. This is because by default little endian is used. So the little end (least significant byte) is sent first followed by the more significant.

How can this behavior be changed? This can be done by changing the endian to big (send big end (=most significant byte) first) and can be done in the interprete:

<Interprete>
<RawType>unsigned number</RawType>
<LengthType>fixed</LengthType>
<Length>2</Length>
<Type>double</Type>
<Endian>big</Endian>
</Interprete>

The StreamViewer will then look like this, which is more like expected:

<< 08:02:17 – Send Command
000000 010C

Laurens Moutton [SLC] [DevOps Enabler] Posted new comment 22nd March 2021
Jurica Gajski commented 19th March 2021

Thank you. Try it but not works in our Dataminer.
<< 11:38:04 – Set_ON_T_OnLD
000000 0000000000 06010618C0 0000
Last four bits (LSB) are bits from parameter which is set with QA.
From QA sent integer number 268 and result is 0000. The results are always the same. When change "raw type" from unsigned number to "other" result is always 2020. We use VS2015 professional with 4.6.2 framework, DIS 2.31.1.21 and DMA 10.0.0.0 9449.

Laurens Moutton [SLC] [DevOps Enabler] commented 19th March 2021

When looking at the behavior that is being described it seems to be pointing that the command is not being made. This means that either the value is filled in after the command has been made or the make command action is not executed at all.
Would it be possible as a test to add the following:

Before Command
command
before
action

2000

Make Command
command
make

With the used id 2000 then being the correct id of the command that is being used in the driver.
Please make sure that the value is filled in by the qaction before the group is executed.

Laurens Moutton [SLC] [DevOps Enabler] commented 19th March 2021

Seems like I’m not able to reply with tags in the comments. Trying to reply now by replacing the “greater than” and “less than” characters with a single quote
‘Trigger id=”2000″‘
‘Name’Before Command’/Name’
‘On id=”2000″‘command’/On’
‘Time’before’/Time’
‘Type’action’/Type’
‘Content’
‘Id’2000’/Id’
‘/Content’
‘/Trigger’
‘Action id=”2000″‘
‘Name’Make Command’/Name’
‘On id=”2000″‘command’/On’
‘Type’make’/Type’
‘/Action’

Jurica Gajski commented 19th March 2021

It works perfect now! I added your “trigger” and “action”!
Without yours adds had:
1. QA which triggers on parameter,
2. In QA set value in parameter for command and set value in another parameter for trigger which invoke action to execute group with pair in which is command and response.
Obviously this is not enough…
With respect, thank you!

Laurens Moutton [SLC] [DevOps Enabler] commented 22nd March 2021

Hi, I’m glad to see that it’s working. To avoid having to create triggers and actions for every command, the trigger could have On id=”each” command and then remove the id attribute in the On tag of the make action. This way the make action will be executed for every command that will be sent. For more information about the behavior of commands, please check the DataMiner help on this location https://help.dataminer.services/development/#t=DataMinerDevelopmentLibrary_Customerpart1PDGPDGConnectionsCreating_commands_and_responses.htm and look for the section “makeCommandByProtocol”

Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs