How to read from serial port with matlab (timeout problem) ?

Dear all,
I want write/read to/from a serial port with matlab, to communicate with a trinamic step motor. I checked that I properly write to the port with port monitor software, but nothing comes out of the port when I attempt to read from it (I just get a timeout, even if I change the time out time to 20 sec). I've looked into the trinamic documentation, but the example they provide (a simple fread) doesn't work.
The point is I manage to read from the port with a Labview "VISA read" VI, but I can't match what this VI does with matlab... And because I'm a rookie when it comes serial port communication, I don't even know where to start...
Any suggestions ?
Thanks !

답변 (2개)

Anusha B
Anusha B 2015년 3월 17일

0 개 추천

The cause of the issue may be similar what is mentioned in this link:
One way to check this can be to see if you can read and write to serial port of any other hardware device using MATLAB.
Hope this helps.

댓글 수: 1

Thanks for your reply.
I've updated the driver but doesn't change anything.
I've seen that I may have to write all the 9 bytes at once, but I'm not sure how to do that, so far I've only managed to write one after the other...

댓글을 달려면 로그인하십시오.

Stéphane
Stéphane 2015년 3월 20일
편집: Stéphane 2015년 3월 20일

0 개 추천

Thanks for your reply.
I've updated the driver but doesn't change anything.
I've seen that I may have to write all the 9 bytes at once, but I'm not sure how to do that, so far I've only managed to write one after the other...
If I can be more accurate : I need to write 9 bytes at once (and read them), something like 01 00 06 02 00 00 00 00 07...

댓글 수: 1

Hi were you able to write and read with Matlab? I plan on doing the same thing with the tmcm1633

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Instrument Control Toolbox Supported Hardware에 대해 자세히 알아보기

질문:

2015년 3월 17일

댓글:

Dp
2018년 3월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by