11-30-2012 12:30 PM
Dear crossrulz
I have found the main reason why the VI is not working but i just cant tell why .
well when i run the VI and it says error at the peak detector . i double clicked the staistics VI and i let it display the number of samples and the time between samples. well the time is right as i configured it . 0.001 BUT the number of samples is giving only 1 ! eventhough i have collected 25000 samples .
what is causing this ? i feel like we're very close to the solution .... I am going out of my mind ..:S
11-30-2012 12:39 PM - edited 11-30-2012 12:40 PM
Have you really captured that many samples (25000)? Just because your collector is set to that doesn't mean you really have that many samples.
How many iterations of your loop before the error? Again, if you are only capturing 1 data point per loop, you will have to wait at least 15 iterations before performing the peak detect.
I also question your string to number conversion scheme. What is the format supposed to be coming from the micro.
11-30-2012 12:51 PM
ah okay . well I am using a string to byte array function .and teh output of it is connected to a waveform that displays the signal . so every single byte s drawn here . so yes I am dealing with a single point .
what do i have to do in this case . can you suggest anything to solve this ..kindly 🙂
Thank you .
11-30-2012 12:56 PM
sorry i fogot to answer the other part of the question .
concernin the conversion to a number . if you take a look at the VI you will see that was using a for loop and some stuff to convert from hex values to decimal .but now i am only using a singla function that does all that . it is a string to byte array function . since the microcontroller (16F874 from microchip) sends a word or a byte . so i am dealing with bytes at the serial port .
I hope i made it clear 🙂
11-30-2012 01:16 PM
@Bildavid wrote:
ah okay . well I am using a string to byte array function .and teh output of it is connected to a waveform that displays the signal . so every single byte s drawn here . so yes I am dealing with a single point .
what do i have to do in this case . can you suggest anything to solve this ..kindly 🙂
Thank you .
Ok, since you only have a single byte coming in at a time, you need to hold off your peak detection. As I stated earlier, use the statistics VI to output the number of samples collected. If more than 15 samples have been collected you can perform the peak analysis. If not, do nothing. Use a case structure.
11-30-2012 01:32 PM
Dear crossrulz
sorry for the misunderstanding i am making here , i beg your pardon . but i meant to say that the microcontroller sends a stream of bytes at a time . but i just cant know specifically the number of bytes the microcontroller sends .
what to do in this case please
AGAIN sorry :S
11-30-2012 01:39 PM
The solution I gave you is not dependent on the number of samples you are acquiring in each iteration. Get the number of samples collected. If greater than 15, then you can do the peak detection.
11-30-2012 01:41 PM
Does it make sense ?