06-24-2014 07:45 AM
@MAGI2 wrote:
Yes the loops are not necessary, we are just playing with the Vi.
We put the Visa inside the loop cause if we put it outside it will read only once and this is the final array and not the stages in between.Or maybe not?
In our case we have an array with 24positions and we have the initial array which is [ 255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] and we want to shift the array 7times with step 3 so next array that we want to send is [0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] and so on.
I meant what crossrulz mentioned you initialize and close it out of the loop not for every iteration. you just nned to put your write or read inside the loop.
06-24-2014 07:49 AM
To better state what Muks is trying to say here:
It is bad to be constantly opening and closing resources, whether it is a file, a serial port, printer port, USB device, etc. It uses extra memory and wastes processing time. So you should open your resource once at the beginning of your program and then close it once at the end. This opening and closing should be outside of your main loop. You can then read and write as much as you want inside of the loop.
06-24-2014 07:52 AM
Yeah whatever he said...
06-24-2014 08:18 AM
crossrulz Thank you very for the reply.It worked and it was very close to what we were thinking but with some changes 😄
Yes we will use open and close Visa once and then use wiring.
Thank you guys for the feedback.It is a whole project in which we are working and we just wanted to focus on this small problem on the Vi that we had thats why we didnt post the whole VI.
🙂
Greetings from Sweden.
06-24-2014 08:28 AM
Hopefully you will not use those many for loops finally.