Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Rs 232 communication with a projector

Solved!
Go to solution
Please, can anybody help me with STM part? I can't find why it isn't working 😞
0 Kudos
Message 11 of 19
(2,696 Views)

You are not converting the data in your client program to the appropriate data type. In the Knowledgebase article there is the picture of a typical client. As you can see you have to do the opposite of what's done in the server, which is to flatten the data. Flattening the data does not create a "True" or "False" from the Boolean. It creates a "binary" string. On the client side you need to use the Unflatten From String function and wire a Boolean constant to tell it what data type to parse. This will give you a Boolean that will tell you whether the On button was True or False.

 

You should also change your server VI so that you send the messages "on demand". Right now it's continuously sending those commands. I would suggest you look into using an event structure. Open the Example Finder and search for "events" and open the "New Event Handler" example VI.

0 Kudos
Message 12 of 19
(2,692 Views)

Smercurio_fc thank you very much you have told me the truth about STM, is working now! really thanks. Can i ask you one more thing? I need to connect the server to multiple clients, but i need to make a queue for doing that because i will have to power on/off some projectors in different computers, so i will have to connect to the first, power off for example, connect second send the same and the third. How can i make that? any ideas? Thanks again in advance.

0 Kudos
Message 13 of 19
(2,684 Views)

There is an example that ships with LabVIEW to show how to manage multiple connections. It uses a functional global variable (a.k.a. "Action Engine") as the queue. Open the Example Finder (Help -> Find Examples) and search for "tcp/ip". The example consists of several VIs, all starting with "Multiple Connections ...". What they consider "client" and "server" may be different than what you are considering "client" and "server", but that's just semantics. You should be able to use the concept shown in the example for your objective.

0 Kudos
Message 14 of 19
(2,678 Views)

Thank again smercurio_fc, i am reading now the example you have told me. I have found another problem in my project i can read on client the lamp hours values from the projector, but when i try to send them to the server it doesn't work. I mean, on the server i click on read on lamp and on the client string i read the value, but i have to send it to my server and that part is not working at all. I put here the Vis, and two images with the problems. Do you know if it could be a problem with formats like you told me this morning? or maybe it could be that i am not configuring well the STM part for sending the values. Thanks!

Client

Server

*Trying (misspelled on the image hehe).

Download All
0 Kudos
Message 15 of 19
(2,673 Views)

I think your problem here is that you are not giving enough time for the client to get the data and send it back. In your server program you have a timeout of 1 second to get the data. This is probably not enough time. You can check this by putting a probe on the "timed out?" output if the SMT Read Msg VI. If this is the case, try increasing it to 5 seconds to see what happens.

0 Kudos
Message 16 of 19
(2,661 Views)

Hi! i have tried everything you have told me but it doesn't work. Increasing the time out doesn't work too. I have checked quitting timeout but it never reads the value from lamp. I am trying to check everything but i don't find the error. Thanks.

0 Kudos
Message 17 of 19
(2,657 Views)

You will have to debug the program to find out exactly where it fails.  You should use probes to check the following things:

1.  When you click the button on the UI, does the "Lamp" string arrive as the Name element of the cluster?

2.  If that happens, can you see a new value in the Lamplectura indicator when you click the button?

3.  Are there any errors coming out of the STM write or STM read?

4.  What does the Name element of the read on the cluster side contain?

0 Kudos
Message 18 of 19
(2,597 Views)

Hi there and thank you for answering, and i am so sorry for not responding you, because i have been without internet for a long time now ...

Ok i maked a mistake in the my client, and i added a dialog and a button when lamp is readed, so the program started to work fine and when i pressed on the server Read lamp, on the client, it readed the message perfect and the dialog appeared, so in the server i received the message, i worked in that and it was a kind of a time problem, because if you pause the normal execution of the program it works like a charm. So thank you for your tips. I am working now in adding queues, because the server need to connect to multiple clients and read the messages. I guess i will have to change who connect to who and i will have to add the queue thing, i am reading the examples but don't know really how to do it hehe. thanks you all.

0 Kudos
Message 19 of 19
(2,578 Views)