06-22-2017 10:52 PM
Let's say we have an array of 3,10,8,2
im hoping to feed this array to a loo in which my daq assist is located . If we need to increase send signal to channel 1 and if we need to decrease send to channel 2
so for this array start by sending Boolean true signal 3 times , then second element is 10 so send 7 (10-3) more times to channel 1 then next is 8 so decreases by 2(10-8=2) so send twice to channel 2 and finally since last value is 2 so it decrease by 6 (8-2=6) so send 6 to channel 1...
how can I do that ? Is there an easy way ? Maybe we just need 1 channel let's say channel 1 with default value 0 . So first digital signal 3 times to channel one then rest then send 10 times then reset to default ...
how do you reset to default after each iteration ?
Solved! Go to Solution.
06-22-2017 11:55 PM
To determine the difference between consecutive elements of a loop, you can auto-index your array with a 0 initialized shift register, and wire teh element to the right side whilst calculating the difference.
The Absolute value function will allow you to find the magnitude of the difference.
How are you deciding between Ch1 and Ch2? When you say "sending Boolean true signal 3 times" do you mean 3 digital high value pulses? You can send boolean pulses with the digital waveform nodes:
Here I send 3 samples with Toggle - this alternates the signal. By default, the values are 0 and 1, so this means the output will be 0,1,0. The sample rate determines the rate of the waveform that is outputted whilst the number of signals determines the number of digital outputs you intend to use.
06-23-2017 07:10 AM
Wow thank you so much for your explanations. No by sending signal I meant sending 1,1,1 when sample rate is 3. Or 1,1,1,1 when sample rate is 4
06-23-2017 08:09 AM
06-23-2017 08:46 AM
@cbutcher wrote:
To determine the difference between consecutive elements of a loop, you can auto-index your array with a 0 initialized shift register, and wire teh element to the right side whilst calculating the difference.
The Absolute value function will allow you to find the magnitude of the difference.
How are you deciding between Ch1 and Ch2? When you say "sending Boolean true signal 3 times" do you mean 3 digital high value pulses? You can send boolean pulses with the digital waveform nodes:
Here I send 3 samples with Toggle - this alternates the signal. By default, the values are 0 and 1, so this means the output will be 0,1,0. The sample rate determines the rate of the waveform that is outputted whilst the number of signals determines the number of digital outputs you intend to use.
In your first snippet, I'd toss the first element of the resulting array because it doesn't mean anything. (The initial "zero" is a made-up number and doesn't represent real data. The data starts from 3, not 0.) What are your thoughts on this?
06-23-2017 09:14 AM
06-23-2017 10:44 AM
@cbutcher wrote:
I'm not entirely sure, but the OP specified the values and pattern. It's true that taking the first value isn't the same as the others - they are differences while the first is just a replica, but that was the question
Oh, I understand. I was just curious about your opinion of my opinion. 😉
06-23-2017 10:59 AM
billko wrote:Oh, I understand. I was just curious about your opinion of my opinion. 😉
Well, I suppose the truthful answer is I don't know what my opinion of your opinion is! But I sort of imagined that this question was counting with increment and decrement pulses, and so starting from zero sounded vaguely reasonable in my head. I'm not at all certain that's really what's going on, and I'm sure there are a wide range of situations in which I would indeed drop the first value (time taken to do something, like a reset as I saw in another thread a couple of days ago, for example - the first measurement was only the start whilst subsequent measurements were a stop and then a start).
06-26-2017 04:35 PM
I tried with auto indexing.. the pattern was 5,7,2 ...
i wanted it to show 5-7=2 , 7-2=5 but instead it showed 5-7=2 , 2-2=0 .This is my code
06-26-2017 07:52 PM - edited 06-26-2017 07:55 PM