LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data packets RS232

Solved!
Go to solution

I want to send two packets of data with a few milliseconds pause between them. Like on a picture. But packets send in same time. This did see in "NI I/O Trace" monitor. Enable write buffer to device did not effect.

0 Kudos
Message 1 of 10
(4,057 Views)

Hi Forest,

 

what's the baudrate of your serial port?

Example: Sending 4 bytes at 9600 baud takes ~4ms - but you want to send the next 4 bytes just after 1ms! No wonder those bytes are sent one after the other…

Best regards,
GerdW


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

What GerdW said plus there is no termination character between the two packets. So it will pretty much look like one long continuous data stream being sent.

 

You do realize that you are sending the same 8 bytes over and over again (without any termination) until the outer loop stops.

0 Kudos
Message 3 of 10
(4,013 Views)

I did try different baud rates, pauses and packets length. All the same. Packers starts separated after 10ms pause. But not did work on the pause for 3.5 bites transmit time. Like in modbus rtu data.
About termination character. What I understand, it is a bite on the end of packet, but I want use the pause.
Maybe port have any settings about separate|ending packet by time?

0 Kudos
Message 4 of 10
(3,966 Views)

0Forest0 wrote:

About termination character. What I understand, it is a bite on the end of packet, but I want use the pause.
Maybe port have any settings about separate|ending packet by time?


If you are sending the data in an ASCII format (you can read it in a text file), then you definitely should use the termination character.  It just makes life so much easier, especially the way most embedded systems are coded (there are commands specifically for reading until a termination character or line).  Relying on a pause will give you nothing but headaches due to race conditions on both sides of the transmission.


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 10
(3,959 Views)

I transmit data in byte format it is shortest variant. Then I don't need termination character.

0 Kudos
Message 6 of 10
(3,929 Views)

@0Forest0 wrote:

I transmit data in byte format it is shortest variant. Then I don't need termination character.


That is important information.  When using a binary/hex/raw format, then the termination character has to be turned off.  The termination character could be in the data, which would cause all kinds of issues.  Instead, your packett needs to be a set length or have a start character and data length byte or some other way to know the length of the message.


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 7 of 10
(3,914 Views)

@crossrulz wrote:

...a start character and data length byte or some other way to know the length of the message.


This is one way to separate packets in byte transmit mode?

0 Kudos
Message 8 of 10
(3,878 Views)

What are you even doing?  Do you have information on the communications protocol, or are you making this up as you go along?  (i.e., are you developing the protocol on the fly?)  What does the recipient of these messages do with the messages?

 

The more questions you can answer, the more specific the help we can give.  🙂

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 9 of 10
(3,863 Views)
Solution
Accepted by topic author 0Forest0

@0Forest0 wrote:

@crossrulz wrote:

...a start character and data length byte or some other way to know the length of the message.


This is one way to separate packets in byte transmit mode?


Probably not.  But it is used pretty much everywhere for a reason.  As I stated before, you cannot rely on breaks in transmission.  You have to have structure to your data to have reliable communication and packet separation.  Either used fixed sized packets (every packet is the same length) or add something to your protocol so the receiver knows how many bytes are in the packet.


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
Message 10 of 10
(3,846 Views)