02-23-2012 03:29 AM
Hello
I'm writing .vi for power supply, connected via USB on PC. Inside power supply (hammeg) is also USB to RS232. I can read, write in LabView, but my problem is that when I write some command to VISA(like set voltage and current) and then use property "bytest at port"->READ VISA, I only get previous data from VISA and not current one. I also add some short delay between write and read but it's same. Also try to Clear VISA before all, but it's same. Anyone know where could be a problem?
Thanks
02-23-2012 04:49 AM
Hi hlod,
Can you post a copy of your VI?
-CC
02-23-2012 04:57 AM - edited 02-23-2012 04:57 AM
Sure, in attachment
02-23-2012 07:21 AM - edited 02-23-2012 07:25 AM
A few pointers just quickly looking at your program:
1. You need to close the VISA session by adding the VISA close VI to the end of your code (see the basic serial read example to see where to put it correctly)
2. You don't need all of the Sequence structures you've put in, read the tutorials etc. to see when/where to best use sequence structures.
3. OP 0 will never be sent as a command because your serial code does not run when your boolean button is false.
4. Also, how are you running this program? I hope you aren't using the Run Continously button! That is a debugging tool only. Put a while loop around your VISA read/write section of code.
Try these changes to your code (especially the one about closing the VISA session) and see if they help your program execution.
There are also some free tutorials covering the basics of LabVIEW (http://www.ni.com/gettingstarted/labviewbasics) and the examples that ship with LabVIEW are always a good place for a beginner to start.
-CC
p.s. Feel free to post your code again when you've made those changes and if your problem isn't fixed