My problem is that when I try to run my vi program a second time, the VISA Read times out. I am trying to read some hall effect sensors and pass the data to a Windows XP computer using Labview 8.0.
I have 32 sensors and each returns a 10 bit value, so I am using 2 bytes per sensor (64 bytes total). I pass all these values in from an array in a microchip. When I run my vi program for the first time, I get a 0 where the first byte should be, and then next 63 bytes I get the correct values. I also include 4 more bytes at the end of the array from the microchip for doing a checksum.
When i look at the oscilloscope, I can see that I write and read successfully, but after the read both the TX and RX lines on the microchip are pulled low for about 2 min. During this time I am not able to do another VISA read, because it times out. Eventually, the TX and RX lines come up to the nominal voltage, and then I can run my vi program again.
Does anyone have any idea what is going on? Any input would be greatly appreciated.
There's a couple of things that are not clear. Is your VI intended to run continuously, i.e., keep reading the sensors? If so, do you need to send the command each time, or do you send the command once, and the micro-p is off collecting and spewing out data? If it's running continuously, how are you running it continuosly? Are you clicking the "continuous run" button in the toolbar? If you are, don't do that. You should only use that for specific debugging sessions, and this isn't one of them. You should have a loop inside your code.
Also, does the delay between the write and read have any effect? What happens if you tell the VISA read to read less bytes? SInce you seem to be reading a specific number of bytes, you should turn off termination character enable to prevent the VISA Read from terminating prematurely. Have you checked that you actually have 68 bytes at the serial port with the Bytes at Serial Port VI?
Also, the way you're handling the data is silly. You seem to taking the array of numbers, converting it into a spreadsheet string, and then parsing the string to get back to another array of numbers. There is no need to do this. This is what is known as Rube Goldberg code. Work with the array directly.
I need to send the command once and then keep reading data. I had tried with a loop but it hadn't worked, ill take another look at it though.
One of the things that I did do was change the amount of data bits that I wanted to read, and it would show me the right data.
Another thing I tried was to put the bytes at serial port vi, but it would only give me 40 bytes, and the rest 0's.
I had already tried eliminating the enable character termination.
I appologize for the silly data handling, but I did it so that I could see the hex and decimal representations of the data coming out of the 1st spreadsheet for early debuggin purposes. I don't plan to keep it there.
There's a couple of ways you can code it with a loop. You can use a pure while loop or a while loop with an event structure. The latter will be more flexible, but you may not need it for your case. With the pure while loop you should put the Initialize and Write outside the while loop. You do not need to Boolean to control the write, as it's pointless. In the loop just have the reading part. Again, no need to have the Boolean control "read" as it serves no purpose.