LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Got 4 inputs but only got 3 readings -.-

Hi guys!

 

I have met so many problems about the LabVIEW programming. There is one about that I have 4 inputs(4 channels are all turned on) but only got 3 readings coming from the 'reading' icon.

(it can display only one value, two values and three values but only more than 3)

Does the icon has the limitation or I can choose other icons to display all the values? Any suggestions?

Appreciate if you can help!Smiley Happy

 

Best wishes,

River

Download All
0 Kudos
Message 1 of 6
(2,179 Views)

First, please use block diagram cleanup.  You have a lot of empty space in that VI making it larger than it should be and some unnecessarily crooked wires.

 

Second, have you taken some LabVIEW tutorials?  You seem to be missing some concepts of dataflow.  For example, your Stop button terminal is outside the loop meaning it will be read once when the VI begins, never to be read again.

 

Third, Read Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2016 Help

Your event structure is outside your loop, but dependent on your while loop ending.  That also means it can only ever execute once.  But the problem is that if you hit the Export button, it queues up the event, which happens to be set to lock the front panel until it completes.  But if you haven't done the things you need yet in the loop (such as hitting a properly placed stop button), your user can't do anything on the front panel to get that loop to stop.

 

Fourth, make sure you name all your terminals with meaningful terms.  "Enum 3" and "Enum 4" don't mean anything to the user of your program.

 

Fifth, you have some awkward Boolean logic in  there.  NOT, NOT, AND?  Could be replaced with NOR.  Or replaced with a simple OR, if you swap the true and false cases of your case structure.

 

Sixth, what is a "reading icon".  I guess you mean the block diagram node that reads from the device?

 

Seventh, with what you posted, there isn't enough information to explain why it doesn't read more than 3 values.  It might be something about the way you configured the device.

 

Eighth, are you sending any termination characters with your commands?  Either a carriage return or linefeed depending on what the device manual says?

Message 2 of 6
(2,164 Views)

Hi RavenFan,

 

Thanks for your reply and patience!

 

What you said is very useful to meSmiley Very HappyLike making the interface meaningful and CTRL-U.

 

For the third advice, I put export button inside the event structure and add one more case about stop,hope that is what the website and you said.Smiley Happy

And for the logic you mentioned, I changed it to the simple one and it works.

Also. for the reading data, after I add one more channels into the code and it works fine which means that the results can show more than 4 or even 5 readings somehow but I don't get it what is going on- . -

For the termination characters, I want to add headers on the top of my readings which works fine, just need to adjust the space between the headers only if I turn the channels linearly(for example, 101, 102, 103, 104 is fine but 101, 103, 104 will display results under different headers.. )

 

Really thanks for you advice and it does help me a lot!

 

Best wishes

0 Kudos
Message 3 of 6
(2,140 Views)

Pleas keep all your related discussion in one thread. We don't need a new VI and new thread for each day of the week, especially if you don't listen to our earlier advice.

 

Some more comments

 

  • Yes, start with some tutorials again!!!!
  • You probably should initialize your shift register. Do you know what that means?
  • If you know the number of loop iterations before the loop start, you need a FOR loop, not a WHILE loop. Do you know the difference?
  • We don't have any of your instruments or subVIs. If you think it is a programming problem (instead of a hardware/instrument issue), boil the problem down to an example that uses simulated data.
0 Kudos
Message 4 of 6
(2,129 Views)

Sorry for any inconvenience and trouble.Joined the community 2 days ago, didn’t know about how it works, now I see there are many staffs working here, I thought you were just warm heart users in the community.

 

 I don’t know how you can see that I don’t listen to your advices. I chanced the code about what they mentioned although there are still errors, but that’s how u improve when you study new things right? And I did watch the tutorial on the  website and YouTube. Let’s say, if I fully understand what I have seen before and that really help me to slove the problem, I won’t be here right?

 I have been doing LabVIEW programming not even more than one week, but I do understand what is shift register, for and while loop. I used FOR loop at the beginning and I wasn’t able to make a control stop, so I take the advice to use while loop. After that I searched a lot about how to control the number of iterations by using logic in a while loop and I actually can control it now, so why should this bother you so much? You sound like pretty angry somehow.

0 Kudos
Message 5 of 6
(2,113 Views)

@RiverShen wrote:

I thought you were just warm heart users in the community.


Most of us are.  In general, those with blue names and bars work for NI.  But it is still easier on us that are choosing to help if you keep it all in a single thread.


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
0 Kudos
Message 6 of 6
(2,102 Views)