Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i demultiplex characters received on serial port on the basis of some special characters??

i m receiving a series of characters on serial port. these characters are basically decimal values from 0 to 255 from an ADC (from a temperature sensor and a level sensor). these values are multiplexed in such a way that before each temperature value an ASCII 1 is send then temperature value then ASCII 2 and then level value and then this sequence is repeated. i want to display temperature and level values separately. that is i want to demultiplex these values on the basis of ASCII 1 and 2.  How can i do this... Plz provide any help...
0 Kudos
Message 1 of 7
(4,245 Views)
Is there any other stop/stop characters being sent? If not and the data is constanly being sent without a spcific command requesting data, you are going to have problems synchronizing to the data stream. How are you going to differentiate between an ASCII 1 as the start and an ASCII 1 in the temperature or level value? Is this ADC something that you bought or designed? If it is your design, you might want to rethink things a bit.
0 Kudos
Message 2 of 7
(4,240 Views)
By "ASCII 1" do you mean the hex byte 01 (SOH, start of header)? If so, the match pattern primitive can handle the demultiplexing.
SULLutions.com
...when a single discipline is not enough
0 Kudos
Message 3 of 7
(4,219 Views)
what is regular expression in search and replace pattern VI... can this VI be used in my problem... if yes then how??? can u send me some examples that how to use this VI
0 Kudos
Message 4 of 7
(4,212 Views)

It depends. As Dennis commented, (at least without a lot more structure in the messages from your serial port) there is no way to reliably

decode them if your "ASCII 1" is the hex byte 31, the representative of the character for the number 1. If you instead meant the hex byte 01,

the indicator for "start of heading", then Search and Replace Pattern could be made to work, though I think I'd try the Scan String For Tokens

function instead as a much simpler approach to a robust solution. If the delimeters are the hex bytes 01 and 02, I can provide an example,

but you'll have to clarify exactly what you are looking for.

SULLutions.com
...when a single discipline is not enough
0 Kudos
Message 5 of 7
(4,192 Views)

Actually i m receiving series of bytes, which are coming from 2 different input sources, through serial port in labview.... these bytes should be actually alternate bytes from two sources like

"input1 input2 input1 input2........."

 

But to differentiate between input1 & input2, i m sending a control byte before each input data byte from source to labview like

"control1 input1 control2 input2 control1 input1 control2 input2........" 

 

Now i want to display these two different inputs separately in labview on some graghs....

ofcourse i have to first demultiplex this series of bytes to achieve inputs separately... for which i want to use control bytes...

is this method correct??

if Yes, then how can i effitiently implement this method in labview??

if No, then kindly provide me some other useful method with labview example file...

 

Thanx in advance...

0 Kudos
Message 6 of 7
(4,175 Views)
If you wire control1 to the delimiters terminal of Scan String For Tokens and use it to operate on the string from your serial port (in a while loop, as described in the detailed help for Scan String For Tokens), it will generate substrings, each consisting of input1 control2 input2. Operate on each of these (in a loop within the outer loop) with another copy of the function with control2 as the delimiters input to get input1 and input2 as separate strings. These could be steered to separate arrays, if that is what you're looking for, or autoindexed on the inner loop border into a 2-element 1-dimensional array which is then autoindexed on the outer loop to form a 2-dimensional array consisting of pairs of measurements as a function of time.
SULLutions.com
...when a single discipline is not enough
0 Kudos
Message 7 of 7
(4,169 Views)