10-21-2009 08:57 AM
Hello,
I am using a High Voltage power supply (Matsusada model HSX-3R5-01LRs) that I can control with a PC through a RS 232 serial port. I am using also LabView 8.6.
I wrote a first program with the simple structure :
- VISA Configure Serial Port (baud rate: 9600, data bits: 8, parity: none, stop bit: 1, flow control: none, timeout: 10000 ms)
- VISA Write
- VISA Close.
Thanks to it : the HV voltage, the polarity can be controlled.
Nevertheless, When I added the VISA read vi (between VISA Write and VISA Close), an error message appeared : time out expired (code -1073807339 or in hexadecimal : 0xBFFF0015). So after consulting the NI forum, I tried several solutions to fix the problem :
1) Check the configuration parameters (thanks to MAX, hyperterminal, Windows XP)
2) Check the CR symbol
3) Put a delay between (10 ms, 1000 ms, 10000 ms) write and read
4) Change the timeout values (10 ms, 1000 ms, 10000 ms, 100000 ms)
5) Change the byte number in the read vi
6) Change the buffer size to 4096 and other values (thanks to the vi : VISA Set I/O Buffer Size)
7) Use the vi "VISA Flush I/O buffer" in order to clear the input and output buffer of the serial port.
But the problem is not still fixed (see test_6.vi).
Then I tried another solution : I added the node properties "Serial Settings : number of bytes at serial port" and connected it to the VISA read vi (see test_7.vi). Two strange events occured :
1) the number of bytes returned by the VISA write.vi is equal to 4 but the number of bytes returned by the node properties is equal to 0.
2) a warning message appeared also : code 1073676294 or in hexa 0x3FFF0006.
I cannot still read anything in the buffer. Does somebody can help me (in English or in French)? Thanks in advance.
10-21-2009 09:00 AM
10-21-2009 09:11 AM - edited 10-21-2009 09:15 AM
Regarding test_7.vi
The reason Bytes at Port reads 0 but Read reads 4 is because Bytes at Port does not wait for the bytes to get there, whereas Read does. To demo, put Bytes at Port on a loop and allow it to reads for a while. Then it will report 4 bytes.
OR
10-21-2009 09:13 AM
Good Morning,
It appears that you aren't getting anything back from the power supply. This can be hardware, not having the return wire connected, or it may be that the power supply isn't replying. When you tried with MAX, hyperterminal (what is up with hyperterm being dropped from Vista!) what did you see returned? If nothing then the problem isn't in your code, per se, although it might be in the syntax of what you send to the power supply. The bytes returned by the "Write" vi indicate those sent, not those received.
My poor attempt at French!
Bonjour,
Il semble que vous ne ressentez rien en retour de
l'alimentation électrique. Cela peut s'agir de matériel, de ne pas
avoir le fil de retour connectés, ou elle mai être que l'alimentation
est de ne pas répondre. Lorsque vous avez essayé avec MAX,
HyperTerminal (ce qui est en place avec Hyperterm étant passé de
Vista!) Qu'avez-vous voir de retour? Si rien ne puis le problème n'est
pas dans votre code, en soi, bien qu'il puisse être dans la syntaxe de
ce que vous envoyez à l'alimentation électrique. Les octets envoyés par
le "Write" vi indiquer ceux qui sont envoyés, et non ceux reçus.
10-21-2009 09:55 AM
Hello,
I thank you all of you to answer so fast. I am a beginner on Labview and in the field of the serial port. I am going to try all the proposed solutions and see if it will work. As soon as possible, I will gine you more news.
I had also a discussion with our electronical engineer and he thought than the buffer could be erased just after sending the information.
See you and best regards.
LV_pro : Your French is more fluent than my English 🙂
10-22-2009 10:06 AM
Hello,
aestet : I think that the termination character is the CR character. This is described in the user manual of the HV.
Broken Arrow : I tried your proposed solutions but the results stayed the same as before.
LV_pro : The last time I tested the port with just to check the configuration parameters. Then I tested the the serial port
with the following fonctions : write and read and the same error message appeared timeout expired (code
-1073807339 or in hexadecimal : 0xBFFF0015). Two possible solutions to explain the problem : bad use of
MAX but after asking to our electronic engineer the way of using the test was correct. The second solution is
a bad configuration of the port. Let see what happen's next.
I am testing another solution : probably the HV power supply receives only the command but doesn't senr anything. I am waiting for an answer from the company.
10-22-2009 10:24 AM
yvan1007 wrote:Hello,
Broken Arrow : I tried your proposed solutions but the results stayed the same as before.
My contribution wasn't a solution, I just wanted to show why Bytes at Port would read 0. Even with a loopback (very fast return of message), it would read 0, without some delay or looping.
Good luck. And use hyperterminal first to get serial devices working, so that you don't second guess your LV code so much.
10-23-2009 12:02 PM
Does anyone know if Windows7 is going to have hyperterminal back in it (it was removed from Vista)? I know that there are fewer and fewer instances in the non-technical world where serial is used, but for those of us in this world it is a very handy tool. With all the other bloatware that comes installed with Windows these days the few kB that hyperterminal represented seems like a minor thing!
Troubleshooting communications with instruments is one of the more difficult tasks we face. Too many variables, particularly if the instrument isn't well supported by the manufacturer (or as has happened to me, is no longer in business). Good luck, keep checking here for help.
10-26-2009 06:44 AM
I stopped using Hyperterm for this as soon as I discovered that PuTTY had added serial COM port support. You can easily find it on a web search.
[ I actually use a development snapshot as I had to deal with a device that sent <CR> as the end of line sequence, and the release version doesn't have the option to convert this into <CR><LF> but the snapshot does. ]
11-09-2009 08:51 AM
hello sir,
i can't open test 6.vi and test 7.vi coz i using labview 8.5
may i get in compatible file for labview 8.5 ?
thanks