NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial ports communication in batch model

I.m using batch model to test several UUTs with seperate device serial ports
when i configure the serial communication step  as serial step it works fine
but when it configure as parallel step all the communication mixed up it seems like it running at the same procces
0 Kudos
Message 1 of 12
(4,514 Views)
Sorry I forgot send the code
Download All
0 Kudos
Message 2 of 12
(4,499 Views)
Hi,

It is not surprising that the information seems to be getting mixed up when you are trying to run all the threads in parallel.  The serial port can only handle serial communication and cannot handle parallel information coming through.  Therefore, when you are trying to talk to an instrument through serial communication, you will need to send the information serially.  Thus, you send each set of information one at a time.  And this is accomplished using a serial thread step synchronization.  The mix of information happens as each step tries to access the serial port all at once instead of serially as it is designed to handle. 

Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 3 of 12
(4,478 Views)

Perhaps you didn't understand me I am using in each thread different serial port

 
0 Kudos
Message 4 of 12
(4,465 Views)
Hi,

Thank you for the clarification.  It looks like you have set up your sequence correctly so we should try some basic debugging steps.  Try placing a breakpoint ans stepping into the CVI code to determine if the correct COM ports are being set and in what order the functions are executing for each port.  This will give you a better idea of what may be causing the unexpected behavior.
Also, can you describe to me what typeof communication information you are expecting and what information you see when you run serially.  Then tell me what you see when you run in parallel.  Please be specific about what you are seeing and what you are expecting.

Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 5 of 12
(4,446 Views)

Hi

This is a small part of my code where I isolate the problem I double check this and it can run

in every computer that has two serial port at least.

in this code I do 3 operation   1- open com  , 2 - send data ,   3 - close com

when this code run in serial mode it is working fine and the parameter to success

is comparing the return value of the function 'ComWrt' with the count parameter (sbuffer)

it has to be equal in case the device is working good.

You can run this code in your computer and see the problem when running this sequence

in Batch model step parallel .

 

 

 

0 Kudos
Message 6 of 12
(4,435 Views)
Hi,

It sounded like you meant to add some code to your post and I think you may have forgotten to attach it =).  Also, in my last post I asked you to tell me what you were expecting to see and what you are seeing that makes you think that the program is not working.  What does the information look like?  The more specific detail you can give me the better I can solve your issue.

Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 7 of 12
(4,423 Views)

Hi

The code was attached in 'reply 2'.

I write all the information you need in 'reply 6' and explain the attached code. 

0 Kudos
Message 8 of 12
(4,401 Views)

Hi,

Should your pre-expression "Step.Com = RunState.TestSockets.MyIndex + 1" be looking for the MyIndex value from one level down eg

"RunState.Caller.RunState.TestSockets.MyIndex".

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 9 of 12
(4,393 Views)
Hi
 
No , This is the correct expression .
 
I'm running this step in the main sequence and in each thread the "step.com"
is changed via "RunState.TestSocket.MyIndex".
I checked this code and verified that the parameter 'com' is changed in each thread.
 
Thanks Asaf
0 Kudos
Message 10 of 12
(4,262 Views)