Communication issue with a laser measurement device, using a serial port (RS232C), for signal acquisition.

5 views (last 30 days)
Hello all,
I’m currently developing a Matlab interface in order to configure a laser sensor (KEYENCE), for vibration analysis. But I still have some issues when I try to send orders to the device.
I already exposed the situation in French in another topic, but since there are no answers, I try in English.
To make it more understandable, find below a scheme of my measurement setup. (in French, sorry). ‘Confirmations = response of the device’, ‘commandes de paramétrage = configuration order’
Graphique_mesures.png
And now, a part of my code which shows the issue + the window command and some explanations / hypotheses.
Captureanglais.JPG
Line 13: the command ‘Q0’ is written in the sensor documentation. It is used to set the ‘communication mode’ (first step to be able to send orders like sampling rate, filter type…). The sensor in supposed to answer ‘Q0’ to confirm, but I have something like ‘x x x€x…’
I tried to use fread and asci conversion (line 20/21), but I get the same response, with line breaks.
Line 24 or 25 give the same results in the window command.
The terminator is ‘CR’, as written in the documentation. (I tried LF also).
So, I don’t understand the error, and I really need your help! (I never used serial port before, there may be some mistakes…)
Thank you in advance!

Answers (0)

Categories

Find more on Acoustics, Noise and Vibration in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!