LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO Analog input err


@NICK4457 wrote:

Yes, sir, my code was available before, but there was a problem yesterday. Since I currently only have two myRIOs, and both of them have this kind of problem, I cannot troubleshoot, but I observed two IO is switching very fast, really fast. Maybe I should upload a video.


Was this in response to my Post when I said your code seemed to run fine in the myRIO used for testing?  What do you mean by "IO switching is very fast"?  What I/O are you "switching"?  

 

Tomorrow, I'll rig up the myRIO to have some defined voltages to measure (rather than let them "float").  I'll also try to build in explicit timing of the A/D loops to be sure that they run at the rate we tell them to run.

 

Bob Schor

0 Kudos
Message 11 of 13
(405 Views)

emmm,I mean, this code is no problem before the PC is not replaced. I used the code in myRIO-lowlevel for further testing and found that I / O switching is very fast. Overlay of IO data. I will try to change a PC for programming in the afternoon, and I may get the correct result, maybe it is just a small problem. I am in Beijing now, and you may not bother you at night. Thank you for solving the problem for me.
Thank you
From Nick

0 Kudos
Message 12 of 13
(401 Views)

Well, my "experiment" was very interesting!  I tried connecting the A input to 3.3v, and the B input to 0v.  To my surprise, when I ran the code, following the initial big peak I described in my previous reply, Channel 0 showed about 4200 (with fluctuations of 100 or so), while Channel 1 showed 3200 (with fluctuations) (I'm not sure of those numbers because I didn't write them down, but did more "experiments" which taught me a Valuable Lesson).

 

I noticed that when sampling at 10 samples/second, there were fairly large (and fairly slow) fluctuations, about 10-12 per 100 samples.  When I changed the sampling rate, I expected I'd see more (for higher rates) or fewer (for lower rates) fluctuations, but they stayed the same.  Curious!

 

So I changed the inputs so both were connected to ground.  The values were more similar, but still strangely fluctuating.  And I was also confused why Channel 0 was higher than Channel 1.

 

My carelessness!  Looking over your code, I noticed, first, that you wired B to Channel 0, and A to Channel 1.  OK, that explains why Channel 0, which was B, which was 3.3 v, was larger than Channel 1, which was A, which was 0 volts.  But why were the numbers so strange?

 

Because you were not looking at the output from the A/D converters, but were using some point-by-point code to do something, which was producing the strange peak that I saw when the program started, and was probably producing the fluctuations that were indpendent of sampling frequency, but appeared to be dependent on sample number.  

 

So, in conclusion:

  • I need to be more careful when examining someone else's code.  I should not expect to find "logical wiring".
  • An important part of programming and debugging your own code is to look at intermediate values.  Sometimes using a Chart to examine samples is a quick way to spot trouble.
  • When the "final answer" looks silly, look at the earlier inputs before you do too much processing.
  • When "processing" produces silly results, try to understand what's being done.  Sometimes a simple test program that generates "samples" (using a constant, or a random number generator) can provide insights to find the problem.

Bob Schor

0 Kudos
Message 13 of 13
(383 Views)