Serial port is not working

1 次查看(过去 30 天)
Hello,
I am working with the USB-RLY82 from robot-electronics.co.uk
I have connected this device to the computer and it is available on COM3. But when i make a serial and open the port, it is not responding. I have a C++ program to control the device and this program works, so the device is not broken. But i want to control the device via matlab. How can i fix the serial?
this script is used to open the serial:
s=serial('COM3');
fopen(s);
fprintf(s,'100');
  2 个评论
Ameer Hamza
Ameer Hamza 2020-9-30
Have you configured the baud rate? Default rate is 9600.
Stijn Haenen
Stijn Haenen 2020-9-30
yes i tried many different baud rates, but without any result

请先登录,再进行评论。

采纳的回答

Stijn Haenen
Stijn Haenen 2020-9-30
Oh i solved my own problem, i should use int8 commands:
fwrite(s, [hex2dec('64')], 'int8');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by