LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing bytes to serial port in each iteration of loop

Hello everyone,

                  Well I am new to labview, my question might of beginner's level but i have searched the forums and didnt find content regarding it. Kindly help me through it as i am really stuck in it for last three days. 

                  I have to make a packet of bytes in each iteration depending upon the bytes i get from array which is input to for loop. Taking five bytes and then making packet according to protocol. Once packet is made i have to send it to serial port in the same iteration. So for each iteration i have to send packet to serial port. I have tried the shift registers, local variables, and also the autoindexing which returns the array at the end of loop. But these things dont solve my problem. Kindly help me solvng this issue.

 

Many many thanks in advance

 

Engr. Yasir Amin 

0 Kudos
Message 1 of 4
(2,563 Views)

Having the array outside the for loop with your VISA Write inside should work just fine. You need to post your code if this is not working and you want help with it.

0 Kudos
Message 2 of 4
(2,553 Views)

LoopingComPortWrite.png

Omar
0 Kudos
Message 3 of 4
(2,550 Views)

First of all thanks alot for your reply.

                         The problem is that i have made separate subVI for this protocol stuffing and the output of that subVI is attatched to the serial visa write in another main  VI in which i am using this VI. I have sent parameters to subVI which makes the packet and then send the output, the output is then sent to visa serial write. Actually that visa serial write is common to many subVIs, On the interface its user's choice to select the request he wants to send. The based on the request the particular subVI is chosen and then that subVI generates the string which is in main VI. which is written to serial port. All other subVis are working fine becoz they dont have loop they simply make the string and send it to port. But this subVi with the loop has the problem as it sends only the last iteration string to port.

 

I cant post the code as i am using my laptop in my room and the code is in office laptop But tomorrow i can share it from office

 

Thanks

Yasir

0 Kudos
Message 4 of 4
(2,543 Views)