Serial interface RS232 control

I am using Mathematica 10.3 and Windows 10 Pro 64-Bit.

I would like to test a stepper motor by simply sending strings over the serial interface.

Is the code below the right way to open the serial interface, adjust the baud rate etc., send a string, and close the interface.
In my case I have only COM3, and the setting parameters required for the motor are given below.

dev = DeviceOpen[
“Serial”, {“COM3”, “BaudRate” -> 9600, “DataBits” -> 8,
“Parity” -> None, “StopBits” -> 1}]

DeviceWrite[dev, “SEND STRING”];

DeviceClose[dev];

DeviceConfigure does not work for the serial interface (DeviceConfigure::noop: “DeviceConfigure not supported for “Serial”.)

=================

  

 

Well, it would seem to me that the most expedient way to check whether your code works would be to simply try it out. What happens when you try to execute it?
– MarcoB
Nov 6 ’15 at 17:19

=================

1 Answer
1

=================

I have successfully tested your code, it does work.

piratebus =
DeviceOpen[
“Serial”, {“COM8”, “BaudRate” -> 115200, “DataBits” -> 8,
“Parity” -> None, “StopBits” -> 1}];

Leave some time before this

DeviceWrite[piratebus, “?\n”];

FromCharacterCode@DeviceReadBuffer[piratebus]

  

 

thanks a lot …
– mrz
Nov 6 ’15 at 21:21