MATLAB Answers


Real Time Windows Target doesn't set the serial port configuration

Asked by Jonas
on 24 Jun 2016
iam using Matlab R2012a with Real Time Windows Target 4.0 to read and write data to a device connected over RS-232 (Serial Port). It works fine using my m-File (see below) or the Matlab Terminal but not with my Simulink + RTWT model. I installed a standard serial port (Install new Board) and configured the port with the board setup as required. (COM1, 2400 baud, 8 databits, 2 stopbits, none parity, DTR off and RTS on). Screenshots below. After some hours spending on troubleshooting I measured the voltage of each RS-232 pin using the (working) m-File and for comparison the (not working) model. It differs in the DTR and RTS. My m-File sets these pins on the right voltage (DTR -12V, RTS +12V), the model (DTR and RTS +12V) not. Then I tried different combinations of RTS, DTS, XOn on/off...and measured the voltage every time but the voltagelevel stays the same. At this point I dont know what to do next. Does someone have a good idea?
s = serial('COM1','BaudRate',2400,'DataBits',8,'StopBits',2,'Parity','None','DataTerminalReady','off','RequestToSend','on','Terminator','LF');
fopen(s); %and so on
Thank you!
kind regards, Jonas


Sign in to comment.

0 Answers