LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i use low level functions for serial communication RS232?

Hello,
 
i am using LabWindows/CVI 8.0.1 and i have seen, that the standard functions for serial communication take a lot of time.
 
After I have sent the startbyte, I have to close the port and open it with a different baud rate and receive 3 bytes. This takes 500ms with standard functions.
 
Is there a possible solution to achieve this faster than 100 ms ??
 
 
With kind regards
 
Savvas Georgiadis
0 Kudos
Message 1 of 9
(4,091 Views)

Do you have any flexibility in the choice of the start byte that you need to send? I have seen applications in the past which deliberately transmit data at the wrong baud rate, but with carefully chosen binary patterns of 1's, 0's, start and stop bits, so that the receiver thinks it is a valid pattern of bits at a different rate. What is your data and what rates are involved?

JR

0 Kudos
Message 2 of 9
(4,084 Views)
Hello jr_2005,
 
thank you for your answer.
 
I want to send one byte with the value 0x45 , 300 baud, 8 databits, 1 stopbit and no parity
 
not later than 100ms i have to receive three bytes with tha same parameters but the baudrate is 9600baud...
 
now i am looking if the visa- and ivi-functionality can be fast enough to receive the trhee bytes that my slave sends
 
are you familiar with the visa functionality??
What is necessary to program a standard serial driver for the RS232 port??
Is it possible to communicate asynchronous??
 
With kind regards
 
Savvas Georgiadis
0 Kudos
Message 3 of 9
(4,080 Views)

OK there is a obviously a very significant difference in the rates, here - looks like a different approach is needed. How about opening two serial com ports, one at 300 and the other at 9600, and simply wiring the transmit line of one with the receive line of the other into the single cable that connects to your device? Open them both in CVI at the same time and you can have TX and RX at different rates, simultaneously.

JR

0 Kudos
Message 4 of 9
(4,077 Views)

HI,

 

i also considered this approach. But this approach is not so easy as it seems. The problem is that if you connect two txd wires then you have not -3 Volt on the line. The two TxD have then -6 Volt and if you want to send a high level than you have a problem with the supplementary - 3 volt....

 

Therefore I hope to finde a software solution with low level functions 🙂

I do not want to use external hardware if it is not necessary...

With kind regards

Savvas Georgiadis

0 Kudos
Message 5 of 9
(4,074 Views)
Not sure I understand the problem. If you take just the TXD wire from the first port (300), and the RXD wire from the second (9600), is this not sufficient? Plus a 0V wire from either port - with such small data transfers you probably don't need to worry about the CTS/RTS wiring at all.
0 Kudos
Message 6 of 9
(4,072 Views)
Hi  jr_2005,
 
i think you have understood the problem but you didnt consider that my second byte that i want send, i have to send with a different baud rate(9600baud). Therefore the asynchronous transmission is no solution for the problem.
 
With kind regards
 
Savvas Georgiadis 
0 Kudos
Message 7 of 9
(4,044 Views)
Hi Savvas ,
I found this problem in Windows years ago when I was using a 16-port digiboard. I found if I left 1 COM port opened, I could open and close another port very quickly (<100ms) to change baud or any other parameter. I also found that Windows really slowed down when I had more than 20 COM ports open.
Regards Jay
0 Kudos
Message 8 of 9
(4,022 Views)
Savvas I think you did not understand jr_2005's reply.
 
He is suggesting you to use 2 separate com ports like COM1 and COM2. Not wiring the same TX line to 2 ports.
 
For example the TX line of COM1 will be connected to the RX line of the slave. You will open COM1 with 300 baud.
And the RX line of COM2 will be connected to the TX line of the slave. You will open COM2 with 9600 baud.
 
You may install a callback for COM2 not to miss the incoming bytes (use InstallComCallback with appropriate parameters) or you may start a separate thread polling the input queue length (GetInQLen) to receive from COM2.
 
If your computer does not have 2 COMs (which is the case with recent office desktops) you may use USB connected COM port adapters which carry 4 or even 8 COM ports on them and they are programmed just like built-in COM ports.
 
Hope this helps.

Message Edited by ebalci on 04-13-2007 03:59 PM

S. Eren BALCI
IMESTEK
0 Kudos
Message 9 of 9
(3,791 Views)