Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Faster data reading through my RS-232 port

I'm trying to read a distance with a Keyence laser displacement meter and I want to use the data to calculate the acceleration with Labview. The communication is set-up over my COM1 port (RS-232) and is working. I ran however into two problems:

1. I use the VISA write and read VI's and I read a data string of (twice the amount of byte's of the output minus one) and than distract one distance from it with a data matching VI. This is all working except that when I increase the frequency of the movement the read signal gets too "cornered" and does not look like a smooth sinus any more. How can I increase the "reading speed"? Is it at all possible with communication over my serial port or would it be better to use an anal
og output and a DAQ board?

2. With my obtained signal I want to calculate the acceleration. I want to do this by applying twice a derivation of the signal. I'm currently working with LABview 6.0 so I don't have the Pt by pt VI's. Are there other ways to plot the derivate of my input signal?

Many thanks in advance for reading and answering my question!

Grtz,
J-M
0 Kudos
Message 1 of 8
(4,746 Views)
Jan-Mark,

Some hints for your first problem:
1. Have look in the spec of your Keyence device and find out how many samples you can get. Sometimes the serial output is limited to something like 10 Samples per second.

2. Decide if that sample rate match your needs.

If so, look again in your Keyence manual and (if possible) shoose the shortes and most determend protocol. (Prefered: fixed byte lengh with termination character and continius output)
Use two while loops, one to read the data and the second to process the data (and the queue vis for data transfer)
(Use a baud rate, that is fast enough)

If the sample rate over the RS232 of your device is too slow, use the analog output and a DAQ card.
Specially when doing derivations of the descrete
signal you might get better results because your timing
(jitter) might be better.


Greetings from Germany
Henrik
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 8
(4,746 Views)
First of all thanks a lot for your answer.

A short reaction: I ask the Keyence device to send me continuous output and the data string has a fixed byte length. It should be sending it at a sufficient rate (this figure is not in the manual, so I just sent them an email) I agree that two while loops would be better. I will implement that. I never worked with the queue VI's and (hence) I don't know what you mean with "Use a baud rate, that is fast enough".

The question of the samples per second is indeed the proper question. I assumed it would be sufficient, but I'm starting to doubt.

Another thing however is that I am now reading 17 digits and I distract one distance from it (9 digits long). There must be a way to read all the data that I receive,
but I don't know how.

Do you know a better way to read the data? (One that prevents me from throwing away half of my data.)

Many thanks in advance for your reaction!
J-M

PS - Greeting from Lausanne
0 Kudos
Message 3 of 8
(4,746 Views)
Jan-Mark,

can you send a short log of the Keyence output?
(for example with Hyperterminal -> log to file)

"fast enough" means that your choosen baudrate isn't the bottleneck.

Regards
Henrik
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 8
(4,746 Views)
Hereby a logfile of the output I receive.

Regards!
J-M

PS- The baudrate should not be the problem indeed. I (just) received some information from Keyence that I'm going to study. I will let you know if I find something interesting.
0 Kudos
Message 5 of 8
(4,746 Views)
Jan-Mark,

your log-file show "+\s0.2884\r-\s0.2968\r-\s0.8060\r" for 3 values.
(I prefer the "'\' Style Display" of read strings to evaluate data extraction. right klick on the string indicator and you can choose differend display styles)

In your example code make the termination character to
0D hex (or ASCII CR or \r) and you will read only one value a time.

Regards
Henrik
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 8
(4,746 Views)
Henrik,

Thanks again for your answer. The termination character was indeed the thing I was looking for.
Furtermore I did a calculation with the baud rate and the size of the data and the conclusion is that I can read 213 distances per second as a maximum. For a 20 Hz movement this is clearly insufficient.
The analog output is also not going to work, since this output is created with a DA converter from the digital signal.

I am afraid I will have to look at another solution/sensor. Or do you maybe see another thing worth trying...

Thank you very much indeed for your help.
J-M
0 Kudos
Message 7 of 8
(4,746 Views)
Jan-Mark,

depends on the thing you want to measure.
but this might not be the right topic here.
You can send me an Email to CHVolkers@t-online.de

last hint for the sensor:
in the past I used optical sensors from µ-epsilon.
However, good luck

Henrik
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 8 of 8
(4,746 Views)