05-20-2013 05:44 AM
Hi Archie C,
Try using VISA Read n Wirte in an seperate While Loop which may be an better option to read, Give th emaximum bytes in the byte count that will help you in solving the issue.
05-20-2013 06:22 AM
Hello gnshmrthy,
Can you tell me how writing VISA read and write in two different while loop will help.
What do you mean by maximum bytes ?
05-20-2013 06:28 AM - edited 05-20-2013 06:28 AM
Friends, Ranjeet and gnshmrthy,
I am using Visa read and write in two separate while loops.
05-20-2013 06:30 AM
Please check the Image which might give you what I was trying to say.
05-20-2013 06:34 AM
While we write the data in a seperate while loop with specified delay and the loop only waits for he writing the VISA not for Reading the VISA this will help in removing the Missing bytes in the serial communication. In read VISA even if it takes more time for the tester to respond it will wait and read the complete data and data doesn`t miss. Hope this cleared the concept.
05-20-2013 06:38 AM - edited 05-20-2013 06:46 AM
Hi ArchieC,
Dont ever try to write the code in this way, This is very bad code (Sorry to say that)
If you write like this then both the while loop will try to access same COM port simultanously(may) which is wrong approach as it will never work. Here you can say that this is serial communication as you cant determine the squence of operation.
One more thing this is serial communication hence one should follow the rules first write then read or vice versa. Have you ever saw any serial communication code using your method.
And you are trying to open the VISA which is already open continously as fast as possible as there is no delay inside while loop and in both the while loop you are using VISA open . May god save you.
05-20-2013 06:39 AM
Do your operation serially not parallely as this is serial communcation
05-20-2013 06:40 AM
And why number of byte read is 0 ?
05-20-2013 06:57 AM
Hi Archie C and friends ,
If you find this the correct mark the solution.
05-20-2013 07:05 AM
Hi Ranjeet Singh,
You should make the open and close outside the Loop which is an bug here in my image, so if you make it connecting it with shift register it would work. My point is since there is an delay and other function need to be processed in seperate while loop which will trouble the data read and writing the data. The 0 is nothing but you can enter the no of bytes of data which needs to be read. I made it zero in order to alow the programmer to enter the appropriate bytes of data.