Jump to content

[LVTN] Plasmionique Modbus Master


Recommended Posts

Porter,

  First, thanks for sharing your code. I have been using it to interface with BriskHeat Lynx controllers in a multi-drop RS485 configuration. It is working great running on a Windows based host. However, I tried today for the first time to use this library on a RT target (cRIO). I did not get very far. It just hangs when trying to connect. Do you know of anyone using this library on a cRIO? Should it "just work", or are there known issues that I am running into?

Thank you much!

Link to comment
On 10/7/2024 at 8:42 AM, Porter said:

It should work as long as you have NI VISA working on the cRIO and you are using the correct serial port name. You should be able to use serial ports named with the ASRL#::INSTR format.

Hi Porter, Thank you for the reply. 

I have not gotten it quite yet. I keep running into failure to initialize lock or failure to obtain lock errors. I am using a cRIO-9045. Things I have tried:

1) Run MB Master on a windows host using a USB-485 Adapter. Works great, no issues.
2) Run MB Master on a windows host using a cRIO-9045 as a VISA Server with my devices attached to an NI 9871 serial interface. This throws various errors related to VISA lock, with this one being the most common:

Error -1073807345 occurred at VISA Flush I/O Buffer in MB Master.lvlib:MB_ADU_RTU.lvclass:TX ADU.vi:5300002->MB Master.lvlib:MB_Master_Serial.lvclass:Querry.vi:3550001->MB Master.lvlib:Read Holding Registers.vi:2420022

Possible reason(s):

VISA:  (Hex 0xBFFF000F) Specified type of lock cannot be obtained, or specified operation cannot be performed, because the resource is locked

I tried initializing only a single handle for one of my devices, this works fine. It is only when the locking stuff comes into play.

3) Thinking that maybe the NI 9871 just doesn't properly support locking, I connected my devices to the on-board RS495 port on the cRIO-9045. Again, I ran MB Master on a Windows host using the cRIO as a VISA Server. Same sort of lock errors.

4) With devices still connected to on-board RS485 port, I ran MB Master directly on the RT target of the cRIO-9045. This was interesting. It sort of works sometimes, for a little while. If I give enough re-tries and sufficient timeout, it chugs along for a while but will eventually still error out with lock related issues.

I have no choice but to keep digging into this. If you think of anything that might be useful let me know, I'll try it out. If I get it working I will let you know.

Thanks much!

Link to comment

Its worth noting that I kept the VISA locks in place only to (possibly) support multiple applications trying to access the same VISA resource. I implemented my own locking mechanism using a single element queue as a mutex for locking within a single application instance because the behavior of VISA locks (at the time) was erratic. You might want to try removing the VISA lock/unlock calls from the MB_VISA_Lock library and see if that helps.

image.png.056674bda4b48e4dd59c3e51c50ec9b8.png

Another culprit could be the VISA flush in the TX ADU.vi. I have once come across a serial device that didn't like the flush command.

Try replacing it with a read all bytes at port.

image.png.f70d1993a305dcb133965ba39a27c288.png

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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