Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Refnum Defining (http://www.chiefdelphi.com/forums/showthread.php?t=80505)

Pausert 18-01-2010 14:59

Refnum Defining
 
I'm having difficulty with having my sensors read to my front panel. I know that the sensors function because they work in the front panel of the example VIs for digital inputs. I've managed to find an error message that tells me that the refnum I'm calling for my "get" statement does not exist. I had thought that I had created the refnum because I followed these instructions:
Quote:

1. In the Project Explorer window of the FRC robot project, within the
Team Code folder under the RT CompactRIO Target, double-click
the Begin.vi item to open the Begin VI.
2. Select Window»Show Block Diagram or press the <Ctrl-E> keys to
view the block diagram.
Notice that references have already been set for Camera, Watchdog,
Left and Right Motors, and Joystick 1.
3. Add a Gyro Open VI to the block diagram below the Joystick 1 reference.
4. Right-click the Analog Input terminal of the Gyro Open VI and select
Create»Constant from the shortcut menu.
5. Add a Gyro RefNum Registry Set VI to the block diagram to the right
of the Gyro Open VI.
6. Right-click the refnum name input of the Gyro RefNum Registry Set
VI and select Create»Constant from the shortcut menu.
7. Type the name you want to assign to this reference, such as Gyro 1.
8. Wire the GyroDevRef output of the Gyro Open VI to the GyroDevRef
input of Gyro RefNum Registry Set VI.
9. Wire the error out output of the Gyro Open VI to the error in input
of the Gyro RefNum Registry Set VI.
Is there some other step or setting for creating a refnum?

Alan Anderson 18-01-2010 19:28

Re: Refnum Defining
 
What you describe seems correct, but it would be a lot easier to verify if you posted a picture of your code.

Also show us the code where you're doing the Get so we can make sure you're doing that properly as well.

Pausert 19-01-2010 14:43

Re: Refnum Defining
 
Here is the code. If you need more I'll post it. I'm going to try to create a devref for something other than DIO today and see how that works.

UPDATE: I tried using a joystick devref and it gave me the same error in the error console.


Alan Anderson 19-01-2010 22:55

Re: Refnum Defining
 
Nothing strikes me as obviously wrong with what you posted. How are you running the code?

Greg McKaskle 20-01-2010 09:02

Re: Refnum Defining
 
Because the image in the post is clipped, I can't see what the switch statement has wired to it, but the sensor read and the indicator update are conditional. Is it possible that the code in that case of the switch isn't running because of the logic wired to it?

Greg McKaskle

Pausert 20-01-2010 10:58

Re: Refnum Defining
 
The case statement is definitely active. Other things in the case statement function correctly. I know that the error stems from a bad refnum because I created an indicator on the refnum call function and it told me that the refnum I was calling does not exist. I even went as far as to create a constant on the case structure for the case in which I have the sensor code because I was running low on new ideas.

Doug Norman 20-01-2010 11:03

Re: Refnum Defining
 
Because the RefNum Get is outside the case structure, it seems it should be getting called - and the error makes me think it is. One thing to try might be to actually make a copy of the "Sensor" text constant wired to the RefNum Set, and wire that into the RefNum Get. This would be just to make sure the names are identical and there isn't some hidden or nonprintable text.

Joe Ross 20-01-2010 11:55

Re: Refnum Defining
 
Quote:

Originally Posted by Doug Norman (Post 903023)
Because the RefNum Get is outside the case structure, it seems it should be getting called - and the error makes me think it is. One thing to try might be to actually make a copy of the "Sensor" text constant wired to the RefNum Set, and wire that into the RefNum Get. This would be just to make sure the names are identical and there isn't some hidden or nonprintable text.

It would be really helpful if the error message included the name of the refnum it couldn't get. I can imagine helping a team at a regional having this problem where the main indication is an error on the diagnostics tab, and not really knowing where to start looking, especially if there are a lot of refnums.

Joe Ross 20-01-2010 12:20

Re: Refnum Defining
 
Quote:

Originally Posted by Pausert (Post 903022)
The case statement is definitely active. Other things in the case statement function correctly. I know that the error stems from a bad refnum because I created an indicator on the refnum call function and it told me that the refnum I was calling does not exist. I even went as far as to create a constant on the case structure for the case in which I have the sensor code because I was running low on new ideas.

It would probably be helpful if you posted your VIs, since often times you can find things wrong that you can't see in a picture (at least until NI gives us LabVIEW 2009).

Pausert 20-01-2010 14:31

Re: Refnum Defining
 
1 Attachment(s)
Quote:

Originally Posted by Doug Norman (Post 903023)
Because the RefNum Get is outside the case structure, it seems it should be getting called - and the error makes me think it is. One thing to try might be to actually make a copy of the "Sensor" text constant wired to the RefNum Set, and wire that into the RefNum Get. This would be just to make sure the names are identical and there isn't some hidden or nonprintable text.

This is good advice, but I've tried this too! It didn't seem to fix the problem.

Attached is my code and a picture of the error message.


Pausert 20-01-2010 18:22

Re: Refnum Defining
 
UPDATE: I have reinstalled LabVIEW with the update and it has not solved the issue. Additionally, I tried another laptop and that gave me the same error.

Alan Anderson 20-01-2010 21:09

Re: Refnum Defining
 
How are you running the code? I don't see a Robot Main vi window open anywhere.

Pausert 20-01-2010 21:43

Re: Refnum Defining
 
From the teleop loop. Should I be running it from main? i thought that running it from teleop wouldn't be a problem as the other refnums didn't return errors...

Alan Anderson 20-01-2010 23:39

Re: Refnum Defining
 
If you don't run the Robot Main vi, the Begin vi doesn't get called. I think that should adequately explain the problem you've been having.

elmer_fud 21-01-2010 19:53

Re: Refnum Defining
 
Quote:

Originally Posted by Alan Anderson (Post 903615)
If you don't run the Robot Main vi, the Begin vi doesn't get called. I think that should adequately explain the problem you've been having.

This is your problem. The program you run is Robot Main and it calls all the other sub VI's as they are needed or to run them.

Also your indicator is going to appear in the teleop front pannel not the driver station or robot main front pannels. You can have these front pannels open when the program is running though without any problems


All times are GMT -5. The time now is 11:48.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi