LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication works in Debug / highlight Execution mode but not in standard execution

Hello!
 
I got a strange problem with my serial communication:
 
When I send Strings via the Comm Port in Debug Mode / Highlight Execution, then the Strings are transmitted correctly, otherwise the Strings are not transmitted.
 
If i activate the "NI Spy" and run the Programm in non Highlighte Exec, than it also works....all my strings are send correctly...
 
All Settings of Visa are correct, I can transmitt all the Data in the Highlight Exec, also a 10 ms wait after writing the Serial Port is implemented....
 
The VISA Comm is not Inited in the loop and only once in the programm...
 
If I programm it in such a manner, that there are send strings in a loop until my strings is send back (of the other side of communication, then it works, but I generate an bufferoverflow there....)
 
The settings of VISA are "Char Termination = Enabled", "termination char (0xA = '\n' = LF)" and "Timeout 1 s...."
 
 
Does anybody have an idea why that happens? I got a Win2k System with Labview 7.1 and an AMD Athlon Processor, the Board is with VIA-Chipset.
 
Regards
 
 
cand. Ing. Sebastian Neumeyer

Message Edited by Seppfish on 04-20-2006 09:01 AM

0 Kudos
Message 1 of 24
(4,164 Views)
1 problem is that you might have race problems
0 Kudos
Message 2 of 24
(4,155 Views)
Hi Sepp,

generally problems of this kind are due to timing problems.

Have you tried flushing the serial receive and send buffers.  If you don't do this, Windows decides when the buffers are actually sent and this can be significantly longer than 10ms.

Look under the VISA palette in the "Interface specific" part and you should find the "flush serial buffer" VI.  This helps greatly when trying to implement time-critical communication.

Hope this helps

Shane.

EDIT: vivi has since posted, and is correct.  Are you sure you have linked everything together via data flow?

Message Edited by shoneill on 04-20-2006 04:18 PM

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 3 of 24
(4,156 Views)

Thanks for fast answer, but that´s not the problme....

 

The Problem occurs while writing on serial....(sorry I ddin´t wrote)

 

To flush the write buffer will erase my string, the read buffer is empty (get the error message...), there´s a loop that stop, when a string is written by the counterpart of Communication. (That´s why the timeout is so low)

I also checked the Version of Serial Port (it´s 3.2)

There´s only one Init of the VISA resource (and one close) outside my loop....

There´s a hughe difference between LabView 6.1 and 7.1 (I got a Computer with LabView 6.1)? perhaps that works...

 

Greetings

 

cand. Ing. Sebastian Neumeyer

 

 

0 Kudos
Message 4 of 24
(4,145 Views)
post some code and maby we will be able to tell you what is wrong.
0 Kudos
Message 5 of 24
(4,138 Views)
Sebastian,

flushing the serial buffer does NOT neccesarily delete the contents.  It also contains the option to "push" the contents of the buffer to the instrument.

Please read the help file associated with the function.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 6 of 24
(4,128 Views)

Hey there!

I flush my buffer to write after each writing action, I tried another Computer (P Celeron 600Mhz with LV 6.1 and LV 7.1 Win2K SP4)...

I got a while loop for reading, if there is nothing to read, then it continue....so it's not necessary to flush there anything...

If I set a Breakpoint, then it works....

So it can´t be my machine (2 Systems tested), it can´t be LV 7.1, I tried 6.1 too....

I integrated wait for action from 2000ms up to 20000ms....

Is it possible that LV takes all ressources from Windows so the System isn´t able to control the E/A´s for the Serial Port? (that should not be the Problem, other I/O Operation also work....)

Ideas to solve the Problem are welcome....

 

Greetings

cand. Ing. Sebastian Neumeyer

 

 

0 Kudos
Message 7 of 24
(4,114 Views)
it sill sounds like you have timing issues
0 Kudos
Message 8 of 24
(4,114 Views)

Hello!

Thanks for reply, i tried to wait after sending serial string from 0,2 s up to 20 s , but the string does not arrive at my destination.

Or do you mean with "timing issues" that I shouldm reduce the Baud rate?

Greetings

Sebastian

0 Kudos
Message 9 of 24
(4,092 Views)
Hi Seppfish
what are you transmit specs?
As suggested prior -post some code

xseadog
0 Kudos
Message 10 of 24
(4,090 Views)