02-02-2011 04:59 AM
I thought this particular problem had been cured, but it seems to have come back. I’ve been using a Modbus development tool to read ADC output values without a problem. I've written a small vi which should do the same thing. It runs on the same PC and uses the same COM port. Obviously I have to close the Modbus programme to release the COM port for LabView. The vi runs fine, but data only appears on the front panel every 8 seconds.
Putting in a 500ms delay in MB Serial Receive.vi improves the response time to around 500ms, but I need 100ms. A shorter delay just results in 8 second refresh times again. The 500ms delay workaround has been implemented in the vi Reverse Power by putting the delay in a FOR Loop.
I’ve created log files looking at the data flows and they are very different between the dvelopment tool and the vi. I’ve attached these. For the Modbus development tool it can be seen that at line 130 that the data is written as a single word, and immediately received as a single word.
For the vi, there’s a lot of communication activity at the start that as a novice I don’t begin to understand, but at line 35 the data gets written. However, the read operation doesn’t take place until line 68.
I've attached the vi, Reverse Power, and the sub-vi's, and the log files. I would appreciate any ideas on how to solve this problem. Thank you.
02-03-2011 08:41 AM
Hello Placebo,
Thank you for your post on this forum.
I have had a look at your code and I need to ask you for some clarifications to better understand the issue. From your post I could gather that you were experiencing similar issues before. Is this the case? Did you manage to solve it at that time?
Moreover, it would be hard for me to test your code since I don't have the hardware you are currently using. It might be useful to give me some more information on what you are trying to do.
The link below might help you if you have not seen it before:
http://zone.ni.com/devzone/cda/tut/p/id/7675
Have a look to make sure you have implemented your VIs properly.
Many thanks,
02-03-2011 09:20 AM
Hello Placebo,
While looking at your codes I could see that a lot of parameters (for example; baud rate, etc) are being read or written to inside the loop. This means that each time the loop is executed, these parameters are set which add to the execution time and hence the delay you are experiencing. I would suggest you set all these paramaters outside the loop and keep things like VISA read inside the loop. This might reduce the delay.
Hope this helps.
02-08-2011 04:40 AM
02-08-2011 05:23 AM
Hello Placebo,
I am glad that you managed to solve the issues you were ecountering. I also have to mention that it is always good practice to put a delay in a loop so that you do not use all the processor time.
Well done and if you have any other issue I would be happy to help.
Regards,
02-09-2011 05:12 AM
Thank you. I am having trouble integrating the solution. The reason is I really need a response time of 100ms, but of course putting in a delay value of 500ms means I don’t achieve a response time of 100ms. A delay value below 300ms causes the data to go back to refreshing every 8 seconds.
Also, even with a delay of 500ms, when I link the vi in COM 2 Share_2.vi, it doesn’t run at all although Stepper Move runs fine.
Any tests you can think of would be very much appreciated.