03-08-2013 06:05 PM - edited 03-08-2013 06:07 PM
Howdy. I wrote a fairly straightforward VISA serial read and write program in LV 2010. I use VISA write to send a query through the COM port, then use VISA read to get the response and display it for the user. I do this for several more addresses, then go back to the first one, and then it continues to loop over and over. It works fine when I run it as a vi on my computer, and it runs fine when I compile it and run the executable from my computer as well. My computer has Windows XP.
However, when I transfer the exe to a laptop running Windows 7, it either works sporadically, or not at all. I know LV is installed correctly because a couple other small programs work fine, and as I said this one will occasionally communicate, although usually I'll see the wrong address being displayed.
At first I thought it was my code, but no matter how many different methods I tried, it would always work perfectly fine under XP, but awful under Windows 7. Then I ran into Windows 7 USB and COM port driver issues with a different, nonrelated software program, so now I'm beginning to suspect it may be Windows 7 that's the culprit and not my code.
ETA: LV is the only program running on the Windows 7 laptop, so I know there is nothing else trying to use the COM port. Plus, I have shut LV completely off and restarted to make sure LV itself isn't still holding the COM port and that didn't help either.
Anyone else run into something like this?
03-09-2013 05:36 AM
@spaceman_spif wrote:
[...] and as I said this one will occasionally communicate, although usually I'll see the wrong address being displayed. [...]
What should I expect from this? This tells me that it is not related to VISA but the application logic.
Can you post a snippet of what the app is doing?
BTW: I have not faced any VISA issues between WinXP and Win7 so far.
03-09-2013 07:57 AM
I'll post a snippet as soon as I can. It will be messy, but I usually clean it up once it's working nicely.
But in the meantime, I still wonder - if it's my code, then why does it work perfectly fine every time I run the exe from my XP computer? Plus I've gone throught about 10 different variations of my code and I see the same thing. The exe works perfect under the XP laptop, but boogers up when I put it on the Win 7 laptop.
03-09-2013 08:14 AM
What brand of USB-RS232? Have you checked to see if there is a newer driver available for it?
03-09-2013 08:45 AM
Actually my LV code is talking through a standard DB9 COM port. It was another software application I use that communicated through a USB-to-COM converter that I found worked fine via plug-n-play in XP but I had to go through multiple steps to finally get it to work under Windows 7.
Here's a sample of my code. This is step 4, so I've already established my COM port settings earlier. It sends out a query, in this case "MD 8009", and the microprocessor will echo back the query plus a value, like "MD 8009 75". The serial communication in this device is very slow, so I send the message, then I have to loop for a while until I see a response that includes the original string plus more data. If I don't see a reply that looks correct after so much time, I try sending the query again 20 more times before I give up and flush the I/O buffer then move on to the next address. If everything works well, I store and display the data, flush the I/O buffer, then move on to the next query.
03-09-2013 11:03 AM
I just did a check on the Windows 7 laptops and they have the latest COM port drivers.
03-09-2013 11:22 AM
Your receive loop expects to read the entire answer in one loop iteration. I have never dared this but always used a concatenate string to collect the bytes received and then operate on this answer. This I usually accomplish using a Feedback Node or a Shift Register.
I would also add a 1ms wait to the receive loop in order to guarantee that the loop doesn't finish too early.
03-09-2013 11:32 AM
Can you post an example on how you read it one byte at a time? I'm curious if that might work in my case, since I'm expecting a complete string plus terminating character when I'm doing the read function.
03-09-2013 04:54 PM
Why are you writing to the terminal called "OTT" and a local variable of that terminal at the same time?
03-09-2013 06:16 PM
@RavensFan wrote:
Why are you writing to the terminal called "OTT" and a local variable of that terminal at the same time?
Yeah, I know they're both wired there. This is an early version of my code that I haven't cleaned up yet. The "OTT" local variable will be used elsewhere, and as soon as I get the code working properly I'll clean up spots like that.
Btw, congrats to your Ravens!! We'll see if my Bengals can dethrone you next season!! Unlikely, but hey I can dream can't I??