i want numbers from 0,1,2,3,...........n. how can i obtain this without using a loop? i tried using the formula node, but it gives only the last value even though i wrote it using a for stmt. is there any other way i can get the numbers?
You say you don't want to use a ramp but you're trying a for loop in a formula node. That doesn't make much sense. A LabVIEW for loop will execute just as fast if not faster that a for loop in a formula node. You probably didn't create an array in the formula node and update the array but with a LabVIEW for loop it's much simpler. Just wire a control to the for loop's N terminal and wire the iteration terminal out through the for loop and instant array with values 0 to n.
Your requirement of generating numbers without a loop is strange. Is there a reason why you want to generate a sequence of numbers without a loop? My guess is that you are experiencing difficulties using loops, and we can help you if that's the case.
the reson for needing a set of numbers is to create a array of boolean variables to generate a square wave. what i was doing previously was taking the iteration number from a for loop and divide it by 2. then i compare the reminder with 0. if it was an even number i would get a zero and for odd numbers i would get 1. so when i compare i get an alternative true and false values, which i gave to the digital pins. but this way i was able to create only a square wave of 1khz. i want it in the range of some Mhz range. so i thought the for loop was the one which is running slower and am trying to replace it.
siva
Enrique wrote in message news:<50650000000500000050D30100-1079395200000@exchange.ni.com>... > SivaSwetha; > > Your requirement of gen erating numbers without a loop is strange. Is > there a reason why you want to generate a sequence of numbers without > a loop? My guess is that you are experiencing difficulties using > loops, and we can help you if that's the case. > > Regards; > Enrique Vargas > www.visecurity.com
The for loop by itself will run very fast (assuming you have no wait statements inside). It is much more likely that it is either a limitation of the hardware you're tying to program or how you're actually doing it. Can you provide more details or post an example of your code?
for sure it is not the limitation of the hardware. i'm using a 6024E board. and its clock cycle is abt 20Mhz. i'm not using any sort of delay in the loop. all i'm doing is taking the iteration number in the for loop and dividing it by 2. the reminder will be alternative 1 and 0. i compare the reminder with 0 and i get an alternative true or false condition. this i give to a case structure. wen the condition is true i give out a 1 value to the digital port and wen it is a false i give out a 0. so in short i get a square wave. i could read 1khz on the scope.
thank you.
siva.
Dennis Knutson wrote in message news:<506500000005000000B8D30100-1079395200000@exchange.ni.com>... > The for loop by itself will run very fast (a ssuming you have no wait > statements inside). It is much more likely that it is either a > limitation of the hardware you're tying to program or how you're > actually doing it. Can you provide more details or post an example of > your code?
The 6024E is 20 Mhz only for it's counter/timers. The analog output is only 10kS/s and the digital I/O is going to be much slower than that. The digital I/O on this low cost board is static and not designed for high speed operations. If you want a faster square wave, use the timer output or a different board.