LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with a RS232 LabView program

Hello Community,

 

I hope that this is the right forum to post my question.

 

I am 100% new to LabView. I am a PhD student and I need to control/monitor a device with RS232 port in my lab. As the supported software for the device is ~15 years old, it doesn't support 64bit. So the support jsut said I'd have to "program" it myself with e.g. LabView. They send me some commands in order to control/monitor the device. Now....as I am a complete noob with LabView I was hoping that there maybe is like a RS232 GUI for a similar device. So that I would not have to start from scratch as this would takes days/weeks (at least for me to figure out how LabView works). I guess the commands are not to difficult, but setting everything up in LabView would be. Attached you'll find the 3 pages they've sent me in order to figure it out by myself (or hopefully together with you).

 

Thank you very much for your support.

 

Greetings 🙂

 

page1.PNG

page2.PNG

page3.PNG

0 Kudos
Message 1 of 44
(2,642 Views)

Hi Torracc,

 

It's likely you'll have to do at least some programming yourself (unless you either a) hire someone or b) are studying at OIST, in which case come find me) but it shouldn't be too challenging, especially if you're familiar with other forms of computer programming.

 

(Written after I wrote a bit more): Perhaps the 0th thing to do is quickly read over some of the training materials here (LabVIEW Basics) , or look at the videos here...

 

The first thing to do is search for an example in LabVIEW - open the IDE then go to Help > Find Examples... and search for VISA.

Open something like "Simple Serial".

 

The next thing is to look at the connection settings (section 1.1) and then match them in the inputs to Configure VISA Serial Port. Take particular note of the "end of message delimiter" and set this as your "Termination Char(acter)". 0x0D is 13 in decimal format.

 

Then, move onto sending your first message (in the spirit of the example file). Pick a suitable command (e.g. Read Chiller Status) and then use VISA Write and VISA Read to get the appropriate response. Make sure to place the CR and LF at the beginning and end of your message ("R") respectively. LabVIEW has string constants for these two values that you can use to avoid having to manipulate numeric values (or flatten/unflatten hexadecimal).

 

Once you've done that, you'll have beaten the hardest part, which is getting something working. Then it's just adding more commands and parsing their responses.


GCentral
Message 2 of 44
(2,597 Views)

One tip.

 

A lot of examples and code you will see on the forums people will have used "Bytes at Port".  That is the wrong thing to use 99% of the time.

 

Look for examples that take advantage of the termination character and read more bytes than whatever the longest message you expect to receive.

Message 3 of 44
(2,590 Views)

Hi cbutcher,

 

thanks a lot for you quick reply. Sadly, I am a few thousand miles away from OIST 🙂

I installed LabView today and will try all your suggestions tomorrow. I will get in touch with you after I tried everything and see where it got me.

 

Greetings

0 Kudos
Message 4 of 44
(2,589 Views)

@Torracc wrote:

Hi cbutcher,

 

thanks a lot for you quick reply. Sadly, I am a few thousand miles away from OIST 🙂

You and everybody else 😉

 


@Torracc wrote:

I installed LabView today and will try all your suggestions tomorrow. I will get in touch with you after I tried everything and see where it got me.

Good luck. Hopefully you can make some progress with the examples and then the forum can help some more 🙂


GCentral
Message 5 of 44
(2,586 Views)

@RavensFan wrote:

One tip.

 

A lot of examples and code you will see on the forums people will have used "Bytes at Port".  That is the wrong thing to use 99% of the time.

 

Look for examples that take advantage of the termination character and read more bytes than whatever the longest message you expect to receive.


Ahhh... disaster. 

Don't use the Simple Serial example. It uses bytes at port, as RavensFan rightly advised to avoid.

 

Since you have the term char (which I mentioned a few times) you can use that without needing to check the number of bytes, so long as the value you give to Read is longer than the message.

 

"GPIB with VISA functions" might be a better example, but it uses GPIB style messages, which you probably won't. Still, it's a worthwhile thing to look at.

 

Since I want to try and put something a bit more useful in this post that "oops - I didn't check the example carefully enough" you might take a look at things like Scan from String or Match Regular Expression (though that will certainly require more handling afterwards) to parse the responses. But you can worry about this once you have a response to parse.


GCentral
Message 6 of 44
(2,583 Views)

Seems to be quite stait forward... the documentation isn't too bad 😉

 

What do want to do?

monitor and save the values... how long, how often

set temperatures?  set ramps?

do alarming?

???

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 7 of 44
(2,521 Views)

And so it begins...

 

I watched a few videos and tried both your suggestions (simple serial example and the GPIB). Sorry that the images are in German but I accidentally installed the German version and you can't change the language settings after installation...

simple serialsimple serialGPIBGPIB

The good thing is, that all the ports from my device manager are detected. Bad thing is, that nothing happens when I press play. That would be too easy I guess 🙂

 

So then I started with a simple design. Something like this would be sufficient for my needs.

My ExampleMy Example

I guess that that is the "easy part" you were talking about....(still kind of made me proud that I managed to get this done).

 

So that is my status now. I guess I will read some more tutorials and see how I can now connect my layout with the RS232 stuff and hope for some more feedback from you guys 🙂

 

@Henrik: I only need simple things. Something like saving data and keep track of the values would be future music. I only need the actual temperature, maybe be able to change it and look out for alarms (no water in the tank or the chiller is shut down).

 

0 Kudos
Message 8 of 44
(2,520 Views)

BTW can't you find a PC 'expert' to setup a 32bit virtual system with access to the USB/COM port and run the software?

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 9 of 44
(2,516 Views)

We don't have any IT here. So the "expert" would be me. And I can't do that 🙂

I wrote tons of mails to the support and even skyped with them. But in the end they did not support me at all with my problem. SO I guess using LabView is the only way at the moment. I am sure that there are other ways to solve that problem.

0 Kudos
Message 10 of 44
(2,501 Views)