LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a numerical value to change with time

Solved!
Go to solution
Highlighted

Hi,

 

I'm trying to control a bunch of relays connected to a NI 6008 and 6501 unit. I've got a program which can take a binary coded decimal code and turn on the appropriate relays for that code but I'd like to automate the system to free me from keeping an eye on the clock and changing the code as necesary. As such I was trying to get the program to reference a spreadsheet each iteration of the loop, however this returns an Array which I can't seem to find a block which will pull the value I require out. I then tried making a waveform replicating the on/off cycle of the relays with no joy at pulling the value of the waveform at each time step out and giving them to the microcontrollers.

 

I'm sure there must be a simple way that the program references an array/speadsheet/waveform and gets the value out at the specific time but I can't seem to find it!!

 

The number is a double, 64bit real type.

Sample data would be the number being 0 for the first 40seconds, ramp up to 7 in the next 10 seconds, hold that for 20 seconds then ramp back down to 0 in a final 10 seconds.

 

Any clues or suggestions would be very much appriciated!!

 

Cheers,

Stuart

0 Kudos
Message 1 of 7
(1,120 Views)
Highlighted

You've mentioned a few different things there.

 

The attached vi is one suggestion of how you could generate the waveform you described.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 2 of 7
(1,111 Views)
Highlighted

Troy,

 

Thanks for that but it's not the generating that I'm having a problem with, it's more the getting LabVIEW to recognise that I want to output the prescribed waveform in real time, i.e. at 20 seconds into running it will reference the waveform at 20seconds, see the value on the graph at that point (lets say 3) and give this value into the DAX assist which will switch on three lines.

 

I've got the switching bit covered as the number of resistors will be in binary coded decimal but it's the middle bit I'm after.

 

Cheers,

Stuart

0 Kudos
Message 3 of 7
(1,078 Views)
Highlighted
Solution
Accepted by topic author singlis89

Delay.png

This snippet shows how to use the time delay express vi to get the type of operation I think you are looking for.

 

You say you have the DAQ code working so I left it out of my example.  You may also want to OR the Stop from the file with a boolean on the FP so you have control of the ecexution without relying on just the file.   Although you specifically stated you wanted to read the file for each "vector" its going to be much more effecient to read the whole file at once and auto-index the2D array.  However you could read a line at a time if your file is changing durring execution

"Should be" isn't "Is" -Jay
Message 4 of 7
(1,071 Views)
Highlighted

Program.JPGThat's brilliant cheers Jeff.

 

I had to split the array twice and wired it up to the iteration count to make sure it kept looking at the next line but that's solved a lot of problems!!

 

I've attached a picture of my final program incase anyone else has the same problem.

 

Thanks again,

Stuart

Message 5 of 7
(1,039 Views)
Highlighted
There's no reason to use two separate DAQ Assistants. Set one for multiple channels.
0 Kudos
Message 6 of 7
(1,035 Views)
Highlighted

Glad to help!

 

I would recomend forcing some data depandancy by wiring error in and error out from your sub-vis but it looks like you got a good solution for your needs!

"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(1,033 Views)