From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication missing bytes

Hello,

 

         All the difficulties and confusions wll be solved once you get to know the communication protocol of the tester. 

 

So in a while loop, read VISA ,wait for sometime,check read count i.e how many bytes it has received. Repeat the loop. This may give you some idea about the communication pattern. you may have to adjust the delay in such a way to achieve synchronisation so that you get repeated sequence. This is just to derive protocol of ur tester. 

Thanking you,
Sushmith
0 Kudos
Message 31 of 62
(638 Views)

Hi gnshmrthy,

                     I should not but you should make the open and close outside the Loop.

For communicating with 1 tester you are using 2 while loops. You are simply wasting the CPU resourses. This is command response protocol so in one while loop you can write and wait for timeout time to read the response.

 

You are attaching the bugged VI and asking to accept as a solution.In future if someone will face same problem and if he follows your marked solution then he will stuck as it is not complete as you only said.

 

As you wrote - '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.'

 

Why you want to enter the data which user needs to read , it should be sent by tester only. You should enter  number of byte to be read not bytes only

 

 

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 32 of 62
(617 Views)

Friends,

Using two separate while loops for reading and writing might not be a good practice. this is where i got this idea of using two while loops. http://zone.ni.com/devzone/cda/epd/p/id/1727

0 Kudos
Message 33 of 62
(612 Views)

Thats what I was telling from 1st post.

 

Hope you got your solution. Let me know if you need any further help.

 

Thanks

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 34 of 62
(608 Views)

Friend Ranjeet,

the above link shows a vi that is using two separate while loops and i am also doing the same thing.

Are you telling me to give that 2000ms timeout before each read? that my friend is not possible in my case as i cant ask the user to wait for 2 seconds after entering each character.

If you are trying to say something else and i am not getting it, then accept my apologies.

0 Kudos
Message 35 of 62
(601 Views)

Hey ArchieC,

                  What I mean to say is there is only one tester then you dont need to duplicate the VISA session. This is command response way so send command and read the response in timeout time.

 

Read the protocol in which your testert is sending data. Please read your tester protocol. There has be some standard what it is following.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 36 of 62
(596 Views)

Hello,

 

          There must be some protocol, if not I have already told you how you can derive it. without some format you cant access proper datas.

Thanking you,
Sushmith
0 Kudos
Message 37 of 62
(593 Views)

Dear sushmith_ks,

                            There is no way you can derive the protocol. It is something they need to mention. As I told before we are humans not god. 

Until they wont tell the protocol we cant derive. Even it works also it will never be relaible. 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 38 of 62
(586 Views)

Hi,

 

      Yes. U can not derive exact protocol. But you will get to know to some extenct. Its a trial and error procedure. Since other things are working fine, and he is missing out bytes in this mode,there is few more concepts he is missing in it. So its better to understand the mode first. 

 

      OP said tester will send bytes continuesly until he sends stop command. So what i said was keep on receiving the bytes, so that u may get some idea based on the no of bytes received repeatedly. . 

Thanking you,
Sushmith
0 Kudos
Message 39 of 62
(581 Views)

Friend,

           This is command protocol based communication. Tester will not respond untill you will send the command in specific manner. For ex command is 90 20 00 01 02 04 05 E0, then tell me how you guess this command using trial and error method.

 

If tester is given and there is command response communication is also should be documented. Instead of trying this he should read about protocol becasue as he metioned that number of bytes sent by tester is not fixed. See there must be some kind of firmware is running inside which is written in specific manner. If he is able to understand this then this is simple serial communiation. Inside tester there may be 1000 commands hence guessing will take ages.

 

About the pattern, if tester is sending the data continously then what is the interval, what is stop command he should know and that will come from documented manual of tester. Trial and error is vague way of programming but if you know what is the pattern then this is fun. untill you dont know what to send to stop how will you ?

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 40 of 62
(571 Views)