09-01-2022 03:43 AM
it is possible to change the input using loop counter variable of loop ??
09-01-2022 03:49 AM
Hi 123,
@newmemeber123 wrote:
it is possible to change the input using loop counter variable of loop ??
Yes.
09-01-2022 04:08 AM - edited 09-01-2022 04:21 AM
im attaching it and the subvis contains same visa read and write operation which is in the for loop same as channel 0 for 1 and 2 as shown in the measurement. i want to get a rid of subvis and i want to use loop counter variable to select the channel one after another. dont want to use other two read and write operation. is its possible ?
thanks
09-01-2022 04:39 AM - edited 09-01-2022 04:42 AM
@newmemeber123 wrote:
i want to get a rid of subvis
There is a lot of duplicated code. You should see if you can make a subvi that you can re-use multiple times.
What is the difference between the sub-vis and what stays the same?
Then you can use something like this and you dont need the channel index at all:
It is a bit confusing what you are trying to do.
09-01-2022 06:09 AM
im attaching the vi in here.. the structure before case i cant change it because its channel selection command cases. there are three inputs for every channel which comes out of case so any how i want to get rid of last two read and write FOR loops and for that i want to use loop counter variable as a channel selector input one after another.
waiting for ideas and suggestions thank you..
09-07-2022 04:50 AM
Yes i tried to use only one sub VI the problem is if i use visa read and write 3 times for three channels the im not having the same speed as im hoping because three visa read and write operation so i want to use only one visa read and write for all three channels so i can get better speed. so im thinking to use loop counter as channel selector or to give input one after another but im not getting how. I will explain the situation again.. i have channel selectors commands as you can see case number 7 or in every case. so now im using three for loops and three visa read and write for every channel.. is it possible to replace three for loops with one and have same operation so i can get better speed.. if you have any questions i will explain you..
thanks in advance
09-07-2022 07:21 AM
Sorry, I cannot open LV2021 VIs. From the screenshot, there are subVIs involved in this. You will probably have to send them, too.
Your speed issues probably come from sending a lot of empty strings and waiting for the communication timeout. The solution would be to not send empty strings.
The code looks like you first enter the loop and then try to figure your way out by trying every exit. I think it is possible to know the route beforehand, like this:
This way, If a channel is not used, you are not writing to the line and waiting for a reply (that will not come).
09-07-2022 08:05 AM
Thanks for suggestions and reply.. Now i converted it to previous version. you can check the vi now. removed subvis and made it more readable. as you can see the in the vi im using 3 for loops and 3 read and write operations for three channels. if im running only one with with same string commands then the speed is fine with single read and write if i run channel one and two then it will become slow then if i run channel 1,2 and three it become more slow. can you tell me solution for this? can i use single visa read and write operation for all three channels using loop counter so channels can be select one after another? i think im i will use only one visa read write for all three channels then speed will be improved because if i run it for one channel it is working so fast. check the case structure as well where im selecting the channel.
09-07-2022 10:05 AM - edited 09-07-2022 10:07 AM
Hi new,
@newmemeber123 wrote:
made it more readable.
No, you still forgot to use AutoCleanup (ctrl-U)…
@newmemeber123 wrote:
as you can see the in the vi im using 3 for loops and 3 read and write operations for three channels. if im running only one with with same string commands then the speed is fine with single read and write if i run channel one and two then it will become slow then if i run channel 1,2 and three it become more slow. can you tell me solution for this?
When you send more commands to your device then it has to handle more work and so I expect it to iterate slower…
Why do you need 3 FOR loops to handle 3 arrays of strings? Why not build just one array of strings and use only one FOR loop?
Do you really need only the result of the last command for each FOR loop?
Why do you even call those FOR loops with arrays of 3 empty strings? Does your device expect empty command messages???
@newmemeber123 wrote:
can i use single visa read and write operation for all three channels using loop counter so channels can be select one after another? i think im i will use only one visa read write for all three channels then speed will be improved because if i run it for one channel it is working so fast. check the case structure as well where im selecting the channel.
Yes, you can.
You just need to iumplement the communication protocol of your device correctly - as has been told to you several times before!
Btw. 128kbaud is a rather uncommon transmission speed for serial communication…
09-08-2022 03:34 AM
1, i have added the two cleaned up vi.
2, yes thats the reason its slow.. so i looking can i select the channel one after another
3, i did now understand how i can do one for loop and one array of string.. can you show me example so i can understand it in better way.
4, yes, i need the result of last command for every for loop.
5, no my device dose not need any empty string.. how can i improve it i mean case structure and how can i remove empty strings?
thanks