LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2 COM port swithching at once!!!

What did you change based on what you learned from your test VI? (my first suggestion in post 73)  Could you post your new version of the VI after you make these changes?

 

Also, here is an example on how to use probes (instead of creating indicators):  https://www.youtube.com/watch?v=5gEy0ef_2OU (In your case you probably shouldn't turn on "Highlight Execution" which is teh lightbulb button).

0 Kudos
Message 81 of 117
(770 Views)

Thanks for the video link. I know how to use it in development PC but in remote PC how can I see these values? So I thouht of using indicator?

 

Attached VI in which read array will show all the reposnse of arduino. read/ write arduino will show the current values

--------------------------------------------------------------------------------------------------------
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 82 of 117
(767 Views)

I tried adding 100ms delay in between two consecutive transcation(read+write). This also didnt worked.

 

One more thing I wanted to make here. I am getting timeout in VISA read but not VISA write as first I do VISA write then only I do read. String I am writing to VISA write is OK. 

 

 

--------------------------------------------------------------------------------------------------------
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 83 of 117
(742 Views)
What makes you think you could get an error on a VISA Write? Disconnect a serial cable/device and see what happens? Nothing, right? Do you understand why?
0 Kudos
Message 84 of 117
(736 Views)

May be becasuse VISA write is actually our PC buffer which is always connected? Its a job to arduino to read that buffer by polling continously or by interrupt?

Is it so? 

--------------------------------------------------------------------------------------------------------
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 85 of 117
(725 Views)

How are you connecting to the Windows XP computer?  If you have access to the block diagram on that computer then you can use probes.

 

Have you tried hardcoding just a single command to be written to the Arduino?  Simply hard code the "*AA$" write with 4 for the byte count on the VISA read.

0 Kudos
Message 86 of 117
(722 Views)

@Nathan_B. wrote:

How are you connecting to the Windows XP computer?  If you have access to the block diagram on that computer then you can use probes.

 

Have you tried hardcoding just a single command to be written to the Arduino?  Simply hard code the "*AA$" write with 4 for the byte count on the VISA read.


Yes I wrote one simple VI only write *AA$ and read response. I tested for 4000 times and it worked. here is my VI attached.  one more thing I should point out here. 

*AA$                    *A0$            *A050$

 

In this response response may very from 0 to 50. Now all time I get is 0 i.e. total 4 bytes. when I read using VISA read then I get timeout error here because I have to read at the max 5 bytes but I actually read 4 mostly. So next time it fails. Is this causing problem? I also cant use $ as termination character.

--------------------------------------------------------------------------------------------------------
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 87 of 117
(712 Views)

I know you did it in a separate VI already.  That is why I asked if you hard coded those things into your main VI.  Try this.

 

If you are supposed to be reading 5 bytes but only read 4, that will always be a problem.  The easiest way to handle this is to make sure that the output will always be the same number of bytes.  Then you simply read all the bytes.  You can do this by always requiring a 3 digit number be returned (e.g. 001, 002, 045, 050).  Otherwise, there might be a way to keep reading bytes until they are no longer available but I'm not too familiar with this technique with VISA in LabVIEW.

0 Kudos
Message 88 of 117
(708 Views)

@Nathan_B. wrote:

I know you did it in a separate VI already.  That is why I asked if you hard coded those things into your main VI.  Try this.

 

If you are supposed to be reading 5 bytes but only read 4, that will always be a problem.  The easiest way to handle this is to make sure that the output will always be the same number of bytes.  Then you simply read all the bytes.  You can do this by always requiring a 3 digit number be returned (e.g. 001, 002, 045, 050).


You want me to send each time *AA$ and read 4 bytes in this VI only right? If so will do. does this inbetween timeout can cause issue?

 

No here I am supposed to read 4 only but sometime it can be 5 bytes. The method of reading and format I cant change as this is standard for us. I can handle in other way around

--------------------------------------------------------------------------------------------------------
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 89 of 117
(695 Views)

@Ranjeet_Singh wrote:

You want me to send each time *AA$ and read 4 bytes in this VI only right?


 

Yes, I said to try that.

 

 

 


@Ranjeet_Singh wrote:

 

If so will do. does this inbetween timeout can cause issue?


 

Isn't that what we are trying to figure out?

 

 

 


@Ranjeet_Singh wrote:

 

No here I am supposed to read 4 only but sometime it can be 5 bytes. The method of reading and format I cant change as this is standard for us. I can handle in other way around


If you are unable to change the output, you need to account for that in LabVIEW.  If you only read 4 bytes and the actual return value is 6 bytes long, you will be missing information.  You need to read ALL of the bytes that are returned by the Arduino if you want to have a system that works.
0 Kudos
Message 90 of 117
(688 Views)