LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Protocol Decode

Solved!
Go to solution

Hi All,

I'm trying to decode the Waveform (from Oscilloscope) back to the strings(abcdef) what I sent to the serial port.

 

1.Could you help to give me some advice for the attached program? it should not perform efficiently for the decode. how should I modify the program to make it better?

 I don't know how to use Digital Waveform Graph to get 0 or 1 for each bit, so I go back to the the Y array of waveform again......

 

2.Is there any exist VIs or libraries to do protocol decode well? 

 

3.How to know the stop bits only according to the waveform? because the Oscilloscope could detect the stop bit (1 ,1.5 or 2) automatically without addtional setting. if I don't set the stop bit, the decode make have issues in my program.

0 Kudos
Message 1 of 11
(2,364 Views)

The bit width calcualtion is wrong, it seems we have to calcualte according to baud rate.

0 Kudos
Message 2 of 11
(2,332 Views)

Are you trying to communicate to an instrument via RS-232? What is the model of the instrument? You might be able to find an existing library for that instrument in Instrument Driver Network (IDNet)

-------------------------------------------------------
Control Lead | Intelline Inc
Message 3 of 11
(2,293 Views)
Solution
Accepted by topic author yeah

Hi yeah,

 

Try the attached code.
Do you really need the 1.5 stop bit option? It will be more complicated...

Message 4 of 11
(2,284 Views)

Hi ZYOng,

No, I just trying to learn how to decode the analog signal from the oscilloscope, it can be uart, spi, CAN and so on, but uart seems a little easier than others, So I try the RS232.

0 Kudos
Message 5 of 11
(2,256 Views)

Hi diman27,

Thanks for the code.

It seems the first data bit have the chance to be same as the start bit,and the last data bit may have the same level with the stop bit, so we may not delete last transtion directly. but the code give me the mind to get number of bits between transitions.

 

1.5 stop bit seems not an nomal operation, but the oscilloscope (with uart decode license) could auto detect the stop bit no matter 1 or 2, don't know how it works.

 

Not sure if there are LabVIEW projects a little like sigrok

0 Kudos
Message 6 of 11
(2,248 Views)

Sorry,the last transtion seems to be a single point, so it could be deleted.

 

is there an easier way to decode using digital waveform "bus"? I didn't the example for the bus functions.

 

1.png

0 Kudos
Message 7 of 11
(2,153 Views)

The "Bus" property nodes sets the appearance of the bus plots on the graph.

This is similar to the standard plot properties, but only applies to "bus type" plots.

I can`t see any way to read back displayed data in "numeric (boolean)" form via graph property nodes.

2 line Bus for example2 line Bus for example

 

Basically, the concept of a "Bus" refers to parallel data transmission (multiple lines with binary signals).

In your case, serial RS-232 transmission is used, which means you have only one "binary" RX line and the concept of "Bus" does not make sense here.

 

If your oscilloscope can pick up transitions between signal levels, and not the entire analog signal, then it is better to use it in this mode.

At the moment you have 25000 analog points, most of which are useless.

 

A cheap "made in сhina" logic analyzer will be more suitable for your task (Saleae, etc...)

Message 8 of 11
(2,132 Views)

Hi diman27,

Thank you too much. Do you know in which condition the setting(LabVIEW digital waveform-Y scale property- expand digital buses) is not grey out?I tried but the check box is always disable.

I was trying to see how can we do the decode in LabVIEW instead of decoding current specific signals.  it seems not too much discussion about these topics in the forum.

I have learned about the 24M logic analyzers with sigrok pusleview. 

 

0 Kudos
Message 9 of 11
(2,106 Views)
Solution
Accepted by topic author yeah

Hi yeah,

 

First you need to create a Digital Waveform with multiple signals (not just single signal as in your example).

Connect this Waveform to the Group Digital Signals Express VI. There you can group your signals into one Digital Bus.

Connect the output of this VI to your Digital Waveform Graph.

image.png

 

To enable Expand Digital Buses checkbox LabVIEW help requires: "Y Scale»Expand Digital Buses is available only if Advanced»Show Buses With Lines is disabled and the plot legend is in standard view".

https://www.ni.com/docs/en-US/bundle/labview/page/lvhowto/digi_wfg_customizing.html

Message 10 of 11
(2,080 Views)