LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview y Bloc de Notas

Solved!
Go to solution

Good Day to everybody, I'd like some help with my project. In my project I've conected Labview with a MOXA ioLogik E1214 in which I receive the states on and off from the digital inputs and y visualize them on Labview. This works perfectly for me. Moving on I wanted to send the on and off states from Labview to a note pad and I have made it. My problem is that Labview is writing on the note pad every second (ex. on 111111111111111 off 0000000000000 on 1111111111 and so forth) and I actually need it to write only when a change in state is presented (ex. on 1 off 0 on1 off 0 and so forth) I'd really appreciate the help

 

Carlos Torres

 

Download All
0 Kudos
Message 1 of 12
(3,031 Views)

Your issue seem to be similar to this one http://forums.ni.com/t5/LabVIEW/E3631A-sampling-issue/m-p/1798150#M620566.

Hope this helps.

regards,

aCe


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 2 of 12
(3,022 Views)

Thanks for your response; just two question do you think inside the while loop should only be the write to spreadsheet.vi or all the elements from the read through the write??? if so the case structure what would it include???

 

 

0 Kudos
Message 3 of 12
(3,018 Views)

I would do it similar to this one:

https://decibel.ni.com/content/docs/DOC-8962

 

When you receive data, add to the queue. So basically you will have two while loops as in the link above, the top while loop (producer loop) will be the data acquisition loop and the bottom one (consumer loop) will be your write to spreadsheet loop.

 

Sorry, if I have misunderstood your question.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 4 of 12
(3,013 Views)

Hi, 

 

 

Maybe you can use this example as a template for your application. 

 

https://decibel.ni.com/content/docs/DOC-2431

 

In this example, you use a Producer/Consumer Architecture along with Synchronization Queues.  This allows you to be constantly acquiring data through DAQmx, while the consumer writes the results in the text file using the Queue. The low level vi's used to write to the text file allow your application to be efficient regarding processor usage. 

 

Hope this helps!!

 

Anuar Rojas

Anuar R.
National Instruments México y Latinoamérica
Ingeniería de Aplicaciones
www.ni.com/soporte
Message 5 of 12
(2,996 Views)

Thanks for your response and I tried this solution yesturday by putting the read section on the first loop (top one) and the write section on the second loop (bottom one) but I couldn't use the queue with the write to spreadsheet vi; for some reason it didn't even read the digital inputs anymore so that was the reason it didn't even write; I would appreciate an explanation to this. As you can see in the vi's I posted with my question the read and write works perfectly but when I put everything in a while loop it doesn't read the digital inputs anymore. Thanks for your help.

0 Kudos
Message 6 of 12
(2,991 Views)
Solution
Accepted by topic author carlos.torres123

Please look at this example, you need to create an event structure and have value change events for your controls. So instead of Input in the diagram below, it would be your network variable (ex 100004).

This is not a full scale implementation of your solution, its just a quick mod of the default template. You will need to add more cases for other variables.

Hope this helps.

regards,

aCe


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 7 of 12
(2,979 Views)

Hi,

 

I have already checked your VI's, however, I don't really understand what your application is trying to accomplish.  In your Block Diagram (Test3.vi) you have 5 Boolean controls which are hidden in your Front Panel.  This Boolean controls are connected to Boolean Indicators which are visible in your Front Panel.  After that, you use a local variable for the Boolean Control 100004, which you parse into an integer and then write to the spreadsheet file.  As a matter of fact, you need to introduce a 1D or 2D array of data to be written into the spreadsheet file.  

 

I have a question for you here, are you going to write to the file only the value of the Boolean control 100004?

 

If the answer is yes, you can use the producer loop to write its Boolean values to the Queue using the Enqueue Element function (Function Pallette -->Synchronization --> Queue Operations --> Enqueue Element).  In the consumer loop, you can take the elements out of the Queue using the Dequeue Element functions, and place them into an array.  Once the array reaches a certain size, you can write the values to the spreadsheet file (using the Array Size function and a case structure).  Then you clear the data in the array and start over. 

 

If the answer is no, maybe you can place all of the values of your Boolean Controls into a 1D array, which you can write directly into the Spreadsheet file.

 

Hope this helps!!

 

Anuar Rojas

Anuar R.
National Instruments México y Latinoamérica
Ingeniería de Aplicaciones
www.ni.com/soporte
0 Kudos
Message 8 of 12
(2,977 Views)

Sorry to bother you but could you send me the vi in 2009 y haven't updated my labview thanks for your help

0 Kudos
Message 9 of 12
(2,971 Views)

Actually I'm going to send every digital input to a different note pad because that is what I was asked to do but in the vi I sent I only have programed the 100004 because I'm still just testing it thanks for your response.

0 Kudos
Message 10 of 12
(2,970 Views)