Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 communications

Hi everybody,
 
I have a RS232 communication problem between my PC and an industrial Datalogger. Some data:
 
Comnunication setup from manufacturer:
 
Serial port COM1
Data bits 7
Parity bit even
Stop bit 1
flow control none
termination character none
VISA setup to asynchronous communication.
 
Problem:
 
I upload the data request string on the DataLogger (\02A\04A), the DataLogger receives the string and answers with a data string containing the correct number of characters. At the first character however, a parity error occurs and therefore the incoming string is full of spaces among correct characters. For example, if the correct answer string is:
 
<ACK><STR>T10'C V4m/s<EOT>
 
I obtain somting like
 
<ACK>    T 0'    4m s
 
Do you have any explanation for that?  May that be do to the type of cable I am using? do I need to chek the bit flow somehow?
 
Thacks for any help,
 
    Roberto
 
0 Kudos
Message 1 of 5
(3,494 Views)
It is possible that the first character is a respons on a break signal from the pc and that is only a partial character.
So after initialising the serial port wait a few ms, and read the number of bytes available on the port.
Read those bytes and ignore the correctnes of those characters.
Than issue your command and read the respons.

PS, what speed are you communicating and how long is your cable?

greetings from the Netherlands
0 Kudos
Message 2 of 5
(3,469 Views)

Well,

the cable is about 1 meter long and the baud rate is set to 38400 (as suggested by the factory ).

I tried Albert suggestion but it seems not to work. However, I start believing it is an handshake issue (the plug has pins 7 and 8 connected), since the string I read changes as a function of the time delay between the writing operation and the reading operation.

By the way, you can see my vi in attachment.

Thanks again,

  Roberto.

0 Kudos
Message 3 of 5
(3,441 Views)

Dear Roberto,

I tested your Vi shorting TX and RX of my RS232 COM Port

( http://digital.ni.com/manuals.nsf/websearch/7DC6DDB5605E325F862570490060970C ).

Everything looks normal.

It seems that  your problem starts from the instrument or from the cable. I don't know where you work maybe a you are suffering from an anomalous noise pick-up.

Have you tried a back to back connection with your instrument using a very short cable ?

Kind Regards

FiloP

 

FiloP
It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
Richard P. Feynman
0 Kudos
Message 4 of 5
(3,414 Views)
If flow control is supposed to be set to none, then it is probably not a hardware related handshake issue.
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 5 of 5
(3,411 Views)