Jump to content

Porter

Members
  • Posts

    231
  • Joined

  • Last visited

  • Days Won

    27

Posts posted by Porter

  1. I've put together a wrapper to the Plasmionique Modbus Master library that makes communication with PLCs a bit easier. It could be used for just about any Modbus device, but I had PLCs in mind when I was developing it.

    What is easier?
    - Modicon-style addressing instead of data address and function code.
    - Data-type conversion built-in(eg. 32-bit float mapped to two U16 registers). Word swapping option.
    - Poll list and cached data block. Allows you to poll a range of registers then lookup and convert the values elsewhere.

    image.png.17360f6ac081ba5262ebabcbac174cdd.png

    The code is up on GitHub: https://github.com/rfporter/Modbus-PLC-Client

    Its a rough draft at the moment. Comments are welcome and appreciated.

    • Like 1
  2. The release is now updated on github. I will send it off to vipm after a bit more testing.

    If you are curious about how I compiled libmuParser for windows and ubuntu, and the modification that I made, here are my notes: muParser Build Notes.pdf

    On an unrelated topic; is it worth uploading the latest versions of projects on the LAVA CR? Each project now has a copy on github, vipm, and LAVA

    - vipm is the most convenient for distribution
    - github is most convenient for source version control and issue tracking
    - LAVA is most convenient for discussion

    • Like 1
  3. Shockingly it works just fine for me. Note that installing LV2022 on ubuntu 22.04 is not straight forward. Its best to stick with ubuntu 20.04. I also couldn't get VI package manager to install so I extracted the vip manually.

    I did notice that the muparser .so files were not put in the right place. They should reside in /usr/local/natinst/LabVIEW-202X-64/resource/ and not in the vi.lib. Otherwise they won't be found.

    image.png.4e1977fdd682078733557fdd4b30c09a.png

  4. On 8/3/2022 at 7:05 AM, Rolf Kalbermatter said:

    You may want to try with this library. No guarantees about its proper operation. It's a quickly hacked together version from this library that I posted earlier. It's not really tested for the extra bitwise operators and there is no provision for correct left and right association of these operators, so it might require explicit bracketing to work as expected unlike in other languages and formula parsers that tend to follow the mathematical and/or C style conventions.

    Do you have any plans to put this up on Github and/or vipm.io?

  5. The muparser library should definitely be updated. I had modified the muparser library to add the : character as a valid variable name character because my variable names often include colons.

    To add bitwise operations like "2&3 = 2", either you would need to create a wrapper that adds these functions to muparser, or just modify the original source code like I did for the : character. I'm not sure how much work this would be. The labview code wouldn't change at all, except for specifying a new version of the muparser dll.

  6. 300 baud. That is slow!

    This error is generated by the slave ID check that happens after the first 2 response bytes have been received.

    Byte 0: SlaveID
    Byte 1: Function Code

    If the slave ID doesn't match the slave ID of the request, then you have a slave ID mismatch. Likely the data is somehow corrupt.

    Are you sure that your stop bit and parity bit are set correctly?

    You can also check the two received bytes using a property node like this:

    image.png.284657381b09013487833bc362f612ad.png

    Be sure to set the string indicator to hex display.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.