LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with a RS232 LabView program

Good morning,

 

I hope you had a great weekend. I started playing around a little bit with the Alarms. So I used a boolean array to read out the possible alarms. This worked for the command flags (and yes, they are reversed in order). Somehow I don't read out a binary number for the alarm flags. I am not sure why that is. 

1234.PNG

Next would be the "set temperature". Not sure how to tackle that issue. Do I put this in the "main" VI somewhere in between? Or do I need a completely new "line" for that?

 

0 Kudos
Message 31 of 44
(1,189 Views)

@Torracc wrote:

Somehow I don't read out a binary number for the alarm flags. I am not sure why that is.


Well, your data is showing 0 for the alarm flags.  So it looks right to me.  Do note that I did not look at your VI to verify.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 32 of 44
(1,177 Views)

Based on a quick check with your input values, I did the following

Example_VI.png

 

It seems that you're getting "00" for the alarms, which seems reasonable. Are you expecting one or more to be true?

Probably they're all 0/False until something is going wrong...

 

As a side note (and a very minor point) you can right click on the Feedback Node and choose "Change Direction" to make it a little easier to wire in some (including your) conditions.


GCentral
Message 33 of 44
(1,176 Views)

@cbutcher wrote:

It seems that you're getting "00" for the alarms, which seems reasonable. Are you expecting one or more to be true?

Probably they're all 0/False until something is going wrong..


Well I was expecting a 00000000. There are 8 bits and I thought that they all are 0 as long as there is no error. And then the 0 change to 1 if there is an error. Like with the control Flags. Maybe I am wrong. The problem is, that I actually can't manually trigger an error to check this. At least not at the moment. Maybe I can check for the errors later on.

 

As a side note (and a very minor point) you can right click on the Feedback Node and choose "Change Direction" to make it a little easier to wire in some (including your) conditions.


Yeah my code is a little bit messy 🙂 Thanks for that tip

0 Kudos
Message 34 of 44
(1,173 Views)

@Torracc wrote:

Well I was expecting a 00000000.


That is just a display issue.  Right-click on your indicator and choose "Display Format..."  You can edit the format however you want.  I would go into the Advanced Formatting and change it to be %08x.  Well, actually I use this plugin (shameless plug): Format Numeric Quick Drop Plugin 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 35 of 44
(1,166 Views)

@crossrulz wrote:

@Torracc wrote:

Well I was expecting a 00000000.


That is just a display issue.  Right-click on your indicator and choose "Display Format..."  You can edit the format however you want.  I would go into the Advanced Formatting and change it to be %08x.  Well, actually I use this plugin (shameless plug): Format Numeric Quick Drop Plugin 


I had it set to binary just like the control flag...didn't work. Now I changed it to %08x and it works. Thanks a lot! 

0 Kudos
Message 36 of 44
(1,154 Views)

Good morning,

 

I was able to implement the "set temperature" idea

set temperature.PNG

However, this only works with it's own VISA resource. I was not able to use the same VISA resource. Because I doubt that you would need to set up a VISA resource every time you set up a new function. Also, I think that the Set Temperature part has to be in the same loop. Because I am not able to set the temperature on the fly. I need to restart the program in order to get it working. But the overall frame works I guess.

0 Kudos
Message 37 of 44
(1,116 Views)

Because your Set Temperature part is standing all by itself outside the loop where it will only execute once!

 

Put it in side the loop.  You can put it in a case structure so that it only changes when you tell it to such as through a button press or when the value of the control changes.

0 Kudos
Message 38 of 44
(1,100 Views)

You need to follow some previous advice and create subVIs.  You definitely want a VI just for sending a command.  You should also make one for each command you want to send.  This will help immensely in just organizing your code.  It would also be beneficial if you used a cluster for your status to even better organize it.

 

Also with organizing your code, you really should be using a project to organize your VIs.  I would also make a library that is the API for controlling the chiller.

 

Finally, it is time to pull out the Event Structure.  You can use the Timeout event to ask for the status and use the Set Temperature Value Change event for sending the command to set the temperature.

 

I just did some massive cleaning up and got you this far.  See if you can handle the next command.

 

EDIT: I just noticed the interface VI was not in the zip file.  Just added it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 39 of 44
(1,097 Views)

@crossrulz wrote:

You need to follow some previous advice and create subVIs.  You definitely want a VI just for sending a command.  You should also make one for each command you want to send.  This will help immensely in just organizing your code.  It would also be beneficial if you used a cluster for your status to even better organize it.


So for me as a beginner I find the use of SubVIs not so easy. For me it is way easier if I can see the compelte code the whole time. THis, I can try to follow everything and find a possible error and its solution. I get that the use of SubVIs is useful, but I struggle a little bit with them at the moment. Maybe later I can get used to them a little bit.

0 Kudos
Message 40 of 44
(1,086 Views)