LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array de 600 elementos

Solved!
Go to solution

Hola a todos, 

 

tengo una duda a la que le he dedicado mucho tiempo sin dar con la solucion. Os la dejo por si alguien puede lanzxarme un cabo. 

 

Debo rellenar un array de 600 muestras para luego sacar determinadas caracteristicas estadisticas. Dado que se trata de 600 valores he optado por generar un array a partir de un bucle for. Esto funciona si los valores que tomo estan DENTRO del bucle for (ejemplo 1). Bien, en mi caso (ejemplo2), los datos provienen de una comunicacion serie y mi bucle FOR cumplimenta el array con el primer valor que entra en el bucle for. En otras palabras, al final genero 600 arrays de un valor unico. 

 

¿Donde tengo el fallo? He pensado en usar Shift Register pero se trata de seisciento valores..... debe haber otra solucion. 

 

GRACIAS DE ANTEMANO

Download All
0 Kudos
Message 1 of 20
(3,588 Views)

Rough English translation, c/o Google Translate:

 


Hello everyone,

I have a question to which I have devoted much time without finding the solution. I leave it if someone can lanzxarme a cape.

I have to fill an array of 600 samples and then make certain statistical characteristics. Since it is 600 values ​​I have chosen to generate an array from a loop. This works if I take the values ​​are within the loop (example 1). Well, in my case (example 2), data from a serial communication and my FOR loop fills the array with the first value that enters the loop. In other words, the final array generates 600 a unique value.

Where I have the bug? I thought of using Shift Register but it is six hundred values ​​..... there must be another solution.


 

The problem is that in the second example you are not creating an array with 600 different values. You are creating an array with the same value repeated 600 times. All you're doing is passing through the same value out of the array. It's no different than using the Initialize Array function. Where is the value coming from? Is it data acquisition? Why aren't you reading 600 values to begin with?

 

0 Kudos
Message 2 of 20
(3,575 Views)

Good afternoon smercurio_fc. That's what I want, but do not get the desired result. The intention is to sample 600 values ​​and place in array, but not how to get it right, I thought the"for loop" could be a possible solution, but not is what I need.

 

What can I do???

0 Kudos
Message 3 of 20
(3,551 Views)

Have I explained? I need are 600 values ​​in an array. How I can do?

0 Kudos
Message 4 of 20
(3,541 Views)

Take 600 readings from your instrument.

 

You posted an image that shows nothing of your acquisition. Impossible to give a detailed answer with so little information.

0 Kudos
Message 5 of 20
(3,538 Views)

Ok I understand.

This is my original design with some requests from my tutor. I need to measurement each signal for 10 minutes and then save and plot these values ​​in each of statistical variables.The acquisition is via serial port. A PIC transmits signals from temperature, humidity ... six variables one after another.

 

Thank you for your help

 

Regards


0 Kudos
Message 6 of 20
(3,514 Views)

How, exactly, is the information coming over the serial port? You have it set up to check the number of bytes on the serial port, ignoring it, and then setting VISA Read to read 600 bytes. That's not the same as 600 readings. Unless each reading is a number between 0 and 255. Is it? Also, the read itself is flawed. You have termination enabled with the linefeed acting as the termination character. This means that if VISA Read sees the linefeed character (decimal 10), it will stop reading. This means you could read only 5 bytes. Or 130. Or 76.

0 Kudos
Message 7 of 20
(3,506 Views)

Sorry, I set termination disable manually.

 

Data is a number between 0 to 255. No termination Char.

 

The information is (for example):

 

PIC send                                LabView read

25                                          temp=25

60                                          Humidity=60%

30                                          Wind Velocity= 30m/s

01010                                     Wind direcction= NO (North-West)

760                                         Pressure= 760mmHg

60                                           Irradiance= 60W/m2

 

you know??

 

 

so I think I must get 6 variables for 600 bytes of data 3600 which correspond totemperatures 600, 600 for humidity, and so on

0 Kudos
Message 8 of 20
(3,496 Views)

Well, it's been a long time since I was in school, but I'm pretty sure that 760 is a number that's not between 0 and 255. And neither is 01010.

 

I think you're confusing values with characters. The number 25 is 1 value. It's made up of 2 characters, which (assuming ASCII and not Unicode) is 2 bytes. 760 is 1 value. It's made up of 3 characters, which is 3 bytes. 01010 is ... I don't know what that is, but it's 5 characters to indicate wind direction. That's 5 bytes. Seeing the picture yet?

 

You need to clearly define and understand what the PIC is sending. Is it sending some sort of separation character between the characters that signify the values? For instance, do you get 2560300101076060 over the serial port, or 25,60,30,01010,760,60, or is each value (which varies in length in terms of the number of characters) separated by something else, like a carriage return or linefeed? Or, does it send you the whole string and then end it with a character like a linefeed? This will tell you how many characters (bytes) to read in order to get your 600 values.

0 Kudos
Message 9 of 20
(3,478 Views)

760 is really bigger than 255?Smiley Surprised

 

I have not explained in detail the project because I thought it was not necessary.I do not speak good English and is not easy for me to explain the whole project in English. Anyway I will try.

 

In my project as I mentioned, I have six variables: temperature, humidity, barometric pressure, wind speed, wind direction and solar radiation (irradiance). Some of them come from ADC PIC (temperature, humidity, pressure and solar radiationand other measurements come from the CCP and Timer2 (wind speed) or digital capture port (wind direction).

 

All these variables must be captured for 10 minutes and I must save the statistical values like average, standard deviation, maximum and minimum to graph and evaluate the weather conditions.

My acquisition system is based on a 16F877 microprocessor which will take the signals that I have already mentioned, and send the raw values ​​via RS232. When I say "raw values​​," I mean that the PIC sends the ADC value (between 0-255) or the value of Timer2 and these are sent in the order of acquisition without termination char. I want to do conversions measured using labview.

0 Kudos
Message 10 of 20
(3,469 Views)