07-26-2014 11:58 PM
@Dennis_Knutson wrote:
You've been using LabVIEW for quite some time and an event structure shouldn't take more than a few minutes to write. Have two buttons (ie port1 and port2). In the value change event for each, just have a simple write and read. Configuration for each port should be done before the loop with the event structure starts. I'm assuming you get a termination character from both so the bytes to read can just be some large constant.
In my application, writing to different COM port is dynamic and will be depending on the initial character of data which I need to write to different COM port. Unfortunately I dont have any termination character. To be very frank with you guys. this code is working on my WIN7 and now changing again is a bit risky job, I agree that its a better way but now I dont want to take risk for now. Please understand my pressure also.
07-27-2014 12:18 AM - edited 07-27-2014 12:40 AM
@johnsold wrote:
What does the Arduino port return from VISA Find Resource? If it returns "USB Serial Port", then the USB loop may close that port.
Look at the image below. The last VISA Resource Name value coming from the for loop goes to VISA Close. It also is passed to the property node in the next frame and the VISA Write in the following frame. Although there may be a value on that line which was a valid resource name, that resource was just closed. I am not sure what the property node and the VISA write do with that situation, but it does not seem right.
Does the timeout occur on the Write or the Read? What is the exact source string in the error cluster?
Lynn
Actually this VISA is not at all posing problem. Other VISA which is arduino is posing problem. In run time MY PC might have 3-4 VISA including arduino. I doubt this might possible of my issue but surprisengly this is working fine without any issue in development PC. This COM have different baud rate which needs to be initialized. Also why VISA write? In my case this USB is connected to PCB which is sending data continously which is used for some application, After initialization, when I wrtie any data to it then it enters into test mode and my testing starts. After that I start my normal testing. Thats why I am not using my VISA read VI
07-27-2014 01:03 AM
Hi lynn,
I am getting timeout in VISA read and after that one more place where I am writing some data to arduino, eventhough before writing I am setting timeout timout as 10 sec then also I am getting timeout error there also after VISA write(Not using VISA read there).
07-27-2014 01:56 PM
Actually this VISA is not at all posing problem. Other VISA which is arduino is posing problem.
My concern is that Find VISA Resource may find your Arduino VISA and then close that session. If you just make a simple VI which calls VISA Find Resource with the inputs set as in your program ?* and Aliases Only, what does the Arduino channel return? If it also returns "USB Serial Port", which seems feasible, then the loop following VISA Find Resource in your program amy close the Arduino port and not the other port. It depends on the order it finds them, which one will be closed.
I am considering that the timeout error may be the result of the VISA session being closed.
Try removing the VISA Find Resource (temporarily) and wire a VISA Resource Name control which you manually set to the correct port for the other device. Do you still get timeout errors on the Arduino port then?
Lynn
07-27-2014 02:18 PM
07-27-2014 10:02 PM
@Dennis_Knutson wrote:
And remove the close as well. There's no point in doing that as far as I can see. The whole discovery process seems overly complicated and unnecessary. I would suggest you simply put the alias for each device in an ini file.
Since you do not appear interested in writing a simple VI to test the communication as I suggested, I'll not be responding any more.
Its not like I dont want to write simple one. I need to rewrtie lots of thing and also need to validate again. When I have time then I will be re-writing this code again. Now I dont want to take risk
07-27-2014 10:17 PM
Arduino code with COM port return. I agree that its a bug but why it is working on WIN7 all the time(Just a question)?
07-27-2014 11:06 PM
07-28-2014 07:14 AM
@Ranjeet_Singh wrote:
@Dennis_Knutson wrote:
And remove the close as well. There's no point in doing that as far as I can see. The whole discovery process seems overly complicated and unnecessary. I would suggest you simply put the alias for each device in an ini file.
Since you do not appear interested in writing a simple VI to test the communication as I suggested, I'll not be responding any more.Its not like I dont want to write simple one. I need to rewrtie lots of thing and also need to validate again. When I have time then I will be re-writing this code again. Now I dont want to take risk
The idea Dennis is presenting to you is to quickly make something that reduces the code down to where you think the problem is. You think it is the communications. So make something that just does the communications so that you can test that. Make refinements until you got something that works. Then you can take what you learned and put it in your main project.
07-29-2014 01:38 AM
@crossrulz wrote:
The idea Dennis is presenting to you is to quickly make something that reduces the code down to where you think the problem is. You think it is the communications. So make something that just does the communications so that you can test that. Make refinements until you got something that works. Then you can take what you learned and put it in your main project.
Thanks for the suggestion, I will implement the same and check. But any of you found any mistake in initializing the COM port for arduino and waiting for data and for next iteration becasue occasionaly it fails. also make sure after VISA find resource I am not closing the COM port