|
From: tomtorfs on 8 Sep 2005 14:10 Everyone, I have a virtual serial port (this actually connects to an FTDI USB device), running at 1000000 baud. In C++ I can easily open the serial port and assign a value of 1000000 to the BaudRate field of the DCB and everything will function fine. Now I have to do the same from Matlab. I tried the following code: usbserialport = 'COM7'; s = serial(usbserialport,'BaudRate',1000000); %s = serial(usbserialport,'BaudRate',115200); fopen(s) s % show serial port settings b = 0; while b~=83, % wait for sync character b = fread(s,1) end When I operate at 115200 baud this works fine, but at 1000000 baud the fread() command times out, even though data is coming. Is this a known issue, and is there a workaround? If not I will have to resort to the somewhat ugly solution of writing an external C++ function to do the interface and calling it from Matlab using the MEX system... or better suggestions? Thanks, Tom
|
Pages: 1 Prev: using GUI Next: How do I write a rk4 matlab program to solve a 1st order ODE? |