LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array de 600 elementos

Solved!
Go to solution

I think now it is very important to solve the constraints imposed by my tutor, which are based on measuring for 10 minutes and return statistical values​​.olve at a time.

It is very possible that I have many doubts, but I must resolve at a time.

 

Regards

0 Kudos
Message 11 of 20
(1,332 Views)
Solution
Accepted by Santherberg

Why do I get the strange feeling that I'm talking to 2 different people. Hmmm.... Smiley Wink

 

OK, so let's see if I've got this straight now as far as the data collection. Your PIC is sending 6 bytes for 6 measurements, with each byte being either the raw ADC reading (I should point out that the 16F877 is a 10-bit ADC, not an 8-bit ADC, so you're cutting its capabilities byonly using 8 bits), or a measurement from something else. I don't know where the 600 came from in the original post. The only thing I can guess is that maybe the PIC sends the values every six seconds, so in one minute you get 60 values. Thus, in 10 minutes you'd get 600 values. But that's just a guess though. If you're sending the data continuously then you need some way to know where the set of readings starts.

 

What you basically need to do is to change the way you are currently doing the acquisition and you will need to change your architecture, unless you want to do something like a running average. The reason is that you don't want to hold the code up for 10 minutes while you are gathering values. Right now your VISA Read will block the VI while it sits there waiting for 600 bytes. What you can basically do is to set up separate loops. One loop gathers the data for 10 minutes and passes off the data to a queue, which the other loop can consume. I think the easiest way to accumulate the data is as a 2D array. Each row can be your measurement (e.g., temperature, humidity, etc.) and each column is the invidual value taken over time.

 

Attached is an example. See if it makes sense.

0 Kudos
Message 12 of 20
(1,325 Views)

Really I think so too.

 

Your guess about my adquisition data system is true. In fact, my idea is that PIC capture and send. So, I had thought capture every second six bytes (one byte per variable) . As you say, it is possible than I have to insert the termination char.

 

About structure, I had thought in producer/consumer loops too. What I didn't knew, is the existence of acquisition functions like the data queue. (That's not fair)

 

smercurio, I have to study what you have sent me before answer you.

 

Anyway, thank you for answering my questions.

0 Kudos
Message 13 of 20
(1,304 Views)

Hi, Smercurio .

Have you had a good weekend?? I hope that.

 

I have seen your desing and it's simply perfect. I have some questions about that. If I wire "byte count" of visa read with "bytes at port" the adquisition is endless. But if I wire to a constant (=6bytes), runs perfectly. Could you say me WHY???. I thought we'd have a full array every 60 bytes.

 

in the other hand, Statics module, in consummer loop, shows statisc values in the same indicator. indicator refresh firs temperature, second humidity and so on, isn't it??

 

 

thank you

 

0 Kudos
Message 14 of 20
(1,300 Views)

Santherberg wrote:

I have seen your desing and it's simply perfect. I have some questions about that. If I wire "byte count" of visa read with "bytes at port" the adquisition is endless. But if I wire to a constant (=6bytes), runs perfectly. Could you say me WHY???. I thought we'd have a full array every 60 bytes.


I don't understand what you mean by "endless". Does the VI just sit in the VISA Read?

 

Since you are sending raw data and that data is a U8 you can't really use a termination character since that character can be a measurement value just as well. For example, if you decide you want to use a linefeed, which is decimal 10, as a termination character, the VISA Read will stop once it sees a byte with that value. But what happens if, for example, the third measurement value is 10? The VISA Read will not read all 6 measurements, since it will stop once it see the byte with the value of 10. Wiring a constant of 6 is perfectly fine for your setup. The 60 is just a number I used for demonstration. It corresponds to 10 sets of measurements. You would need to use whatever number is appropriate for you depending on how often the PIC sends out data, and how long you want to collect data. If the PIC sends out the measurements once a second, and you want to collect for 10 minutes then this value should be 6 measurements X 60 seconds X 10 minutes = 3600 bytes.

 


in the other hand, Statics module, in consummer loop, shows statisc values in the same indicator. indicator refresh firs temperature, second humidity and so on, isn't it??

I'm sorry, but I don't understand what you are asking here. The for-loop is used to convert the raw readings to physical values (temperature, humidity, etc). Since the measurements exist in rows (first row is temperature, second is humidity, etc.), the for-loop auto-indexes the 2D array. It does this by rows. Thus, in the first iteration i=0) it peels off the first row. In the second iteration (i=1) it peels off the second row. The case structure is used to determine which row is being peeled off, so it performs the appropriate conversion. The output of the loop automatically creates a 2D array with the raw numbers converted to physical values. You will need to put in the actual code to perform the conversion from raw value to physical value - I don't know what they are for your setup.

0 Kudos
Message 15 of 20
(1,287 Views)

Thank you very much for your answers (and sorry for my bad English).

I have studied your clarifications and I have changed the adquisition specifications. I have had to reprogram the PIC and I'm evaluating the posibility to use the 10 bits of adc. (for better resolution)


Now I do six measurements and send it. I wait to one second and reset the software. This is because I have seen too many values in the buffer and, in fact, values belong to same second. Then, the measurement lasts ten minutes but in reality it is the measurement of a second. I have to test if this fails in Labview. (I do not know if I explained well)


Before, you said me than I couldn't used termination char because my software couldn't discriminated between values and termination char. I don't understand why?I mean how I can send and read values ​​to know that is a number and that the termination char?What can I do for use termination Char? I guess that it improves the fiability of read.

 

Thank you very much. 


Regards

0 Kudos
Message 16 of 20
(1,264 Views)

@Santherberg wrote:


Before, you said me than I couldn't used termination char because my software couldn't discriminated between values and termination char. I don't understand why?I mean how I can send and read values ​​to know that is a number and that the termination char?What can I do for use termination Char? I guess that it improves the fiability of read.


I pretty much gave you the explanation in my previous post. If you're sending raw data LabVIEW isn't going to know whether it's seeing the value as a measurement or as the termination character. It just sees a byte. If the byte's value matches what you said should be termination character, then it stops reading. It doesn't care if it has read only 1 byte or 3000. What's the difference between a byte value of 10 that indicates a measurement of 10, as opposed to a byte value of 10 that is supposed to indicate a termination character corresponding to a linefeed? From LabVIEW's perspective, absolutely nothing. It just sees a byte value of 10. Thus, if you tell it to use a byte value of 10 as the termination character, it will oblige and stop reading as soon as it sees a byte value of 10. Thus, if your 6 measurements were (in raw values) 5 8 13 10 123 215, and you did a VISA Read, all you'd get is 3 numbers. Clear?

 

If you're sending raw value you can't use the termination character unless you can guarantee that whatever byte value you use for the termination character cannot, under any circumstance, ever be used as an actual raw value. Can you guarantee this? I don't think you can. The best solution is to have a query/response mechanism. LabVIEW sends out a query request for data, and your PIC responds with 6 bytes (or 12, if you change to 10-bit resolution). The query command can be anything you want, like a single character. In this case VISA Read doesn't need a termination character since it knows how many bytes the PIC will be sending in response to the query command.

0 Kudos
Message 17 of 20
(1,254 Views)

I understand. Labview drives the data transmissions

 

I will investigate when and how to use termination char. 

 

 

thank you very much again.

 

 

 

0 Kudos
Message 18 of 20
(1,246 Views)

@Santherberg wrote:

I understand. Labview drives the data transmissions

 

I will investigate when and how to use termination char.



You still don't get it. If you're sending raw data as you are you CANNOT USE A TERMINATION CHARACTER because VISA Read won't know the difference. I'm sorry for yelling, but I've tried to explain it three times now.

0 Kudos
Message 19 of 20
(1,243 Views)

Smercurio, I understand perfectly. 10 is the same to use like termination chart as data, so I can't use termination chart. What I say is that I don't know how to use termination chart. No for this proyect. I want to know that to my knowledge. Anyway thank you for your answers, has been very heplful for me.

 

 

 

 

0 Kudos
Message 20 of 20
(1,237 Views)