LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sending hex data to com port

Solved!
Go to solution

Hi friends,

 

I have try to send hex data to the transmitter which have PIC microcontroller via usb serial port.

It has 9600baud rate, 8 bits, 1 stopbit, noparity.

the protocol is data, data, data, check sum. When the data is right, the green led in the device will blink once.

 

I have been able send it to the device using C++ to the device, and using realterm as well.

but when I try using labview, the device didnot blink at all.

 

I have check the data and displayed the value using virtual port to real term, send it with labview and c++ the value is the same. but why labview cannot send the data?

 

is there any setting do I have to set?

0 Kudos
Message 1 of 4
(4,011 Views)
Solution
Accepted by topic author limavolt

Hi limavolt,

 

closing the serial port just after writing data into the VISA send buffer is a NO-GO!

 

Using VISAWrite you only transfer data into a send buffer, but you are not sending those data immediatly over the COM port. Closing the COM port will also stop any sending of the data. Using 9600baud you need ~1ms to send a byte but you close the port within microseconds after VISAWrite…

 

Did you check the example VIs coming with LabVIEW? Did you try your task with the "Basic Serial Read and Write" example?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,975 Views)

As GerdW stated, you need to wait to allow your data to be sent before closing down your serial port.

 

And since you are using all default settings for your serial port, you can get rid of the controls for the serial port settings.

 

I would recommend something like this.


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 3 of 4
(3,965 Views)

Thank you,

 

I never think about the delay before.. and It work...

 

 

0 Kudos
Message 4 of 4
(3,917 Views)