LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication Problem

Solved!
Go to solution

Hi,

I want to communicate with my device (a CARD) equipped with a serial port.

First i must Open a com with 300 Baud rate, send a command and verify the response.

Second: Sent a command

Third: Open a second com with a Baud rate 9600 in the same Port

Fourth: Use Visa READ, and i must read a chain of character that confirm that open session is OK.

The problem is I don’t receive any response when i use visa READ in the Fourth Step and Bytes at Port = 0.

The picture below:

Capture.PNG

0 Kudos
Message 1 of 11
(3,992 Views)

What does that second command do?  Is it causing the device to change its baud rate?  You are only waiting 200 milliseconds after re-configuring the port for the new baud rate and checking the number of bytes at port.  Is that enough time for the device to react to the command for changing the baud rate and sending out a new message?

0 Kudos
Message 2 of 11
(3,988 Views)

@RavensFan wrote:

What does that second command do?  Is it causing the device to change its baud rate?  You are only waiting 200 milliseconds after re-configuring the port for the new baud rate and checking the number of bytes at port.  Is that enough time for the device to react to the command for changing the baud rate and sending out a new message?


Most of the equipment I communicate with serially requires the unit to be rebooted/reset to use the new baud rate.  (It remains at the original baud rate until you reboot so you can send the reboot/reset command.)  Are you sure you don't need to reboot/reset the equipment? 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 11
(3,965 Views)

i have a assembly which i can use to communicate with the device, but i am trying to develop a module (library) to communicate with the device using Visa Serial.

i an snipping the serial port to watch the commands and te replys when using the assembly.

After that i trying to do the same thing using Visa Serial:

IRP_MJ_WRITE DOWN   2f 3f 21 0d 0a  /?!..
IRP_MJ_READ UP STATUS_SUCCESS 2f  /
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 45 E
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 44 D
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 69 i
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 35 5
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 31 1
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 41 A
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 35 5
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 45 E
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 34 4
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 45 E
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 34 4
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 31 1
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 31 1
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 30 0
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 30 0
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 30 0
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 30 0
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 30 0
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 30 0
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 30 0
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 0d  .
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 0a  .
IRP_MJ_WRITE DOWN   06 30 35 31 0d 0a  .051..
IRP_MJ_WRITE UP STATUS_SUCCESS 06 30 35 31 0d 0a  .051..
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 1 .
IRP_MJ_READ DOWN      
IRP_MJ_READ UP STATUS_SUCCESS 50 30 02 28 41 38 45 33 33 34 33  P0.(A8E3343

and i tried more than 5000 ms but i don't receive any reply.

0 Kudos
Message 4 of 11
(3,951 Views)

@RavensFan wrote:

Is that enough time for the device to react to the command for changing the baud rate and sending out a new message?


I actually worry about the opposite.  Did the instrument change its baud rate and send out the data before VISA reconfigures the serial port?  Though, I would expect an error if that were the case.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(3,950 Views)

Yes i am sure i dont need to reboot the device.

0 Kudos
Message 6 of 11
(3,949 Views)

Is there a reason you need to communicate with it at 2 different baud rates?

 

You never answered my question about whether that command was what told it to change the baud rate.

 

 

0 Kudos
Message 7 of 11
(3,936 Views)

@RavensFan wrote:

Is there a reason you need to communicate with it at 2 different baud rates?

 

You never answered my question about whether that command was what told it to change the baud rate.

 

 


Yes i need to communicate with it at 2 different baud rates.
i ithnk this command Slect Work Mode: below the manual of the communication

Capture 1.PNG

0 Kudos
Message 8 of 11
(3,934 Views)

Is this a really ancient device?  I haven't heard of anything needing to communicate at 300 baud since the 1970's.

 

It's a shame they are giving you a really complicated scenario here.  The fact it can route itself back to 300 baud without warning is a concern.  It would be nice if that flowchart gave you some guidance on the timing for when it switches from one baud rate to another.

 

I'd suggest looking at it with an oscilloscope.  Even use a DAQ device and record the transmit and receive lines.  You might be able to see by the bit pattern when it changes from the slow baud rate to 9600 baud.

0 Kudos
Message 9 of 11
(3,922 Views)

Maybe the echo to the Select Work Mode command is to be received at 300 baud as well, as an acknowledge to raise the baud rate?

I'm not sure if it makes much difference, however I would use a VISA property node to change the baud rate only.

Don't use Bytes at Port: you already set 0xA as termination character, so configure a proper timeout in the VISA Configure Serial Port and input a large number into the byte count terminal.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 10 of 11
(3,899 Views)