06-01-2011 05:10 AM - edited 06-01-2011 05:15 AM
Hi there! I am working in communicating with my prjector. The commands are pretty simple, just PWR ON\r for on, PWR OFF\r for off and LAMP?\r for asking the device how many hours have the lamp worked. So i just used the example of write/reading serial with labview, but had some problems.
1º) It works but it keeps giving me an error i can't handle. Is the common timeout operation from visa. I have searched it here and all the people say something about the commands lines, but i put them and configure in the port so i don't know really how to handle this error. Another thing is how can i put \r or 0xD to be my write end command just by default?
2º) How can i make my application just be an exe that you don't have to press RUN always for using it?
3º) My last question is for asking about how can i manage this thing, i need to read the lamp used hours with the command LAMP?, and projector will respond me with something like :LAMP=xxx .How can i manage that response for sending it via tcp/ip? Should i have to create a new variable or something? I mean, i just need with another app to be able to Power on/off the projector via tcp/ip and asking the lamps hours via tcp/ip so i don't really know how to handle it. Thanks for all people and let me know if you need more info, i am not english native so sorry for my faults.
Edit: forgot to put my vi.
Solved! Go to Solution.
06-01-2011 07:50 AM
1. You are obviously going to get a timeout when you send the commands that do not generate a resonse from the instrument. Only do a read when you send the LAMP? query and to automatically send \r, set the termination character to '0D'.
2. You need the app builder to create an exe. In order to make the VI automatically run, go to VI Properties>Execution and check ''Run when opened'.
3. I don't understand. First you are talking about RS-232 and now you want to convert this VI to TCP/IP communication?
06-01-2011 09:17 AM
Hi! Thanks for taking your time and helping me out. Ok so you are saying that my problem is trying to read always, that i have to only read when LAMP? is sended, isn't it? Another thing is, that i have to communicate with the projector using visa, but i have to integrate it in a bigger app that will communicate via tcp/ip with other computer. This is my first app to see if i can control the projector via rs232, but it will be like this.
Computer A---> Server ( will be able to send on/of and check lamp status via tcp/ip to the client ).
Computer B-----> Client ( will be able to transmit with the server ((A)) and control the projector via RS232)
Thanks for all gonna try the things you've told me.
06-01-2011 09:31 AM
It worked ! i have maked some modifications and is working now perfectly, you rock. I upload the new vi.
Other thing is tcp/ip i am still thinking how to do it.
Thanks.
06-01-2011 10:02 AM
That's way to complicated. You can have a single case statement (or better yet, an event structure). With the single case statement, you would have two cases that just do a write and the third case would have a write and read. The nested case structures is not at all necessary.
06-01-2011 10:10 AM
I don't understand you. Let me explain again.
Projector<----------->Computer A <------------------------------------->Computer B
Rs232 TCP/IP
Ok so Computer A have his own app to control the projector and computer b has his own app to access computer a for controlling the projector. It is possbile? Thanks in advance.
06-01-2011 10:37 AM
I was referring to your posted VI.
There are shipping examples of TCP/IP client server apps and Network Streams in 2010. It is very possible. You might also want to look at the STM library.
06-03-2011 04:47 AM
Hi there again. So i just added to read on tcp/ip and send the readed string to the client but i don't know how to really send a command to visa if someone on the client side wants to turn off or on a proyector. How can i do that? any advice? thanks in advance.
06-03-2011 11:47 AM
I think the STM Library would be perfect for you. You could define the meta data as write and read and for the write, use messages of 'power on' and 'power off'.
06-08-2011 06:34 AM
Hi Dennis again, i have been trying to use STM in my project but i seems that i don't make it work. I have tried just to send PWR ON to the projector via STM but it doesn't work. I upload the vis. Thanks in advance.