The debug outputs of the library can be activated by setting the boolean system property net.wimpi.modbus.debug at startup time of the JVM as true.
This will allow you to see the actually exchanged Modbus messages encoded as hex.
Standard JVM's have a D option for this purpose:
-De.g.:= set a system property
Fangorn:~/development/java/jamod wimpi$ java -Dnet.wimpi.modbus.debug=true \ -cp build/classes net.wimpi.modbus.cmd.DITest localhost:5555 0 4 3 Connected to localhost/127.0.0.1:5555 Request: 00 00 00 00 00 06 00 02 00 00 00 04 Response: 00 00 00 00 00 04 00 02 01 50 Digital Inputs Status=00001010 Response: 00 01 00 00 00 04 00 02 01 50 Digital Inputs Status=00001010 Response: 00 02 00 00 00 04 00 02 01 50 Digital Inputs Status=00001010
If you get something like a class not found exception for net.wimpi.modbus.debug, then you did not specify the parameter to set a system property correctly.
If you are using an IDE, please refer to the corresponding manual, that usually should provide the ways and means to pass parameters or system properties for run configurations.
Once you see the messages, you will usually be able deduce what is going wrong with the communication with your specific device and your specific implementation (also see FAQ 4 below please).
2) Why don't you use <insert your favorite logging tool>?
jamod was written with the intention to be as portable as possible, including to devices with extremely constrained resources (e.g. SNAP, Tini). In these devices, some forms of logging may not make as much sense as on your fully equipped desktop machines.
Given the fact that commonly you just need to "debug" while establishing and adjusting the communication, but very few times afterwards, we decided that the best choice was to solve it in the current form and let the community leverage the open source to derive the versions to their liking (which actually has happened).
3) Why can't I build/use this in <insert your favorite IDE>?
You sure can. Your best bet is to use either ant or maven integration, both of which are provided by all mainstream IDE's. If there is no such support, I would suggest to obtain either ant or maven (depending on what you want to build; maven build does not support any resource constrained devices yet) to achieve local builds.
To use the build artifact (i.e. the jamod library packed into a JAR), you will need to place it in the classpath of your own project, respectively establish the dependency (in maven or your IDE).
4) Why does jamod not work with <insert your device>?
The most common answer for this question is that:
a) you have not read your devices manual
b) you are not addressing correctly
It may sound harsh, but please, try the following first:
a) Debugging (see FAQ 1 above): checking the message flow will usually help you to figure out what is going wrong.
b) Double check your reference: there may be some offset that you didn't consider. Remember, Modbus addressing starts at 0; unlike other tools, jamod does not introduce any artificial offset (i.e. will pass directly into the message what you specify).
Hope this helps.

