LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS 485 program running dynamically doesnt read the holding register.

Solved!
Go to solution

I have a program where I am supposed to measure the RS485 signal using an oscilloscope. For that I need to run a program where there is continous transmission between the master and slave, i.e PC and RS 485 device and also parallely read the data using a picoscope. For this I wrote a seperate program for RS 485 transmission and then run it dynamically. But then when I run the program the parallel dynamic program is running but I am not getting an output, instead I am getting an error -1073807339 for the read holding registers. I try to find out what the error is by running the program in highlight execution, then I am not getting this error and the read holding registers is reading the data. So i try to put in a delay time instead of highlight execution but still no output in modbus read holding registers, instead its just the error -1073807339. What is the reason for this. Kindly do help me thank you. I have attached the program. 

0 Kudos
Message 1 of 6
(1,026 Views)

Hi Govindsankar,

 

hard to debug due to lots of missing subVIs…

 

There are two different devices used in the RS485 subVI: which of them is giving the error?

You also set several control values in this subVI AFTER you started the VI: I would set as many values as possible before I start the asynchronous subVI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(995 Views)
Solution
Accepted by topic author govindsankar

Thank you for your reply. I have figured out the problem. The problem is slave is transmitted from the main VI to the dynamic VI. But before transmitting is complete the program already starts with the defualt slave id and then once it is transmitted, it is too late. The new slave value is given to the slave id constant in the dynamic VI but modbus read is using the default slave id that existed before. So I have changed the program to a condition where the program starts running and waits for the slave id and will only go on to modbus read when the slave id is obtained from the main VI. Thank you.

0 Kudos
Message 3 of 6
(951 Views)

@govindsankar wrote:

Thank you for your reply. I have figured out the problem. The problem is slave is transmitted from the main VI to the dynamic VI. But before transmitting is complete the program already starts with the defualt slave id and then once it is transmitted, it is too late. The new slave value is given to the slave id constant in the dynamic VI but modbus read is using the default slave id that existed before. So I have changed the program to a condition where the program starts running and waits for the slave id and will only go on to modbus read when the slave id is obtained from the main VI. Thank you.


Nice job.  Don't forget to mark YOUR post as the solution!  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 6
(934 Views)

Hi Govindsankar,

 


@govindsankar wrote:

The problem is slave is transmitted from the main VI to the dynamic VI. But before transmitting is complete the program already starts with the defualt slave id and then once it is transmitted, it is too late.


Isn't this the very same what I wrote in my message before?

You also set several control values in this subVI AFTER you started the VI: I would set as many values as possible before I start the asynchronous subVI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 6
(927 Views)

@GerdW wrote:

Hi Govindsankar,

 


@govindsankar wrote:

The problem is slave is transmitted from the main VI to the dynamic VI. But before transmitting is complete the program already starts with the defualt slave id and then once it is transmitted, it is too late.


Isn't this the very same what I wrote in my message before?

You also set several control values in this subVI AFTER you started the VI: I would set as many values as possible before I start the asynchronous subVI…


Strangely enough, I thought I put that in my reply, but it disappeared.  I distinctly remember typing that you should get credit as well.  I mentioned "at least a kudos" because I wasn't sure if it was exactly the same.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 6
(922 Views)