Does Matlab recognize express card 54 to R232

1 次查看(过去 30 天)
I have a laptop and it doesn't have serial port. I found there is express card which can transfer to R232, they said it's the same with physical serial card. But I don't know whether it will work with matlab and buy or not. Any comments?
Thanks, Julio

采纳的回答

Walter Roberson
Walter Roberson 2011-11-6
MATLAB will recognize such a card as being a serial port if the OS considers it to be a serial port the first time in the MATLAB session that you ask the OS for information about (or to connect to) the serial ports. If the device comes with a proper serial port driver (nothing special, just the regular driver) then it should be usable with MATLAB.
ExpressCard is "hot-pluggable", so if the card is not plugged in when you start MATLAB and first request serial operations, then you will have to restart MATLAB to make the card visible. MATLAB does not currently support any mechanism to re-ask the operating system what ports are available.
ExpressCard ports (that MATLAB knows about) should be as usable as hardwired serial ports or serial port cards.
In your situation, many people would tend to use a USB to Serial convertor. That is supported by MATLAB as well (again with the limitation that the device has to be connected when you first do a serial operation). USB to Serial convertors, though, have a minimum 40 ms latency (this is part of the USB standard; MATLAB does not provide support for the USB mechanism to reduce the delay), so USB<->Serial is quite restricted in the number of serial interrupts per second. To the best of my current knowledge, the latency for the ExpressCard solution should be much lower and the number of supported interrupts per second should be much higher, making the ExpressCard solution more usable.
  2 个评论
Sun
Sun 2011-11-8
Thanks for the answer.
Right now I am planning to use the expressed serial port to connect to a spirometer. The spirometer has the standard RS232 port. I guess matlab can directly read the real-time signal through the port? Is that the truth matlab can read any kind of physical serial port?
Walter Roberson
Walter Roberson 2011-11-8
MATLAB's limitations are the same as the OS limitations: the OS driver has to be in place, the use of the port is only as reliable as the driver. The setting limitations are the same as the OS setting limitations (e.g., as far as I know, MATLAB allows a serial port to be set to any baud rate that the port itself supports.)
However, "real time signal" can become a problem. Different people mean different things by "real time signal".
If you need MATLAB to be able to read chunks of data at high speed ("high bandwidth") and respond to each chunk quickly ("low latency") and to do that response reliably within a certain time window, then MATLAB on MS Windows is not an appropriate tool.
The scheduling of MATLAB is at the mercy of MS Windows, and MS Windows is permitted to do other things at random times and for indefinite lengths of time. If MS Windows decides to suspend MATLAB for three week because it decides that running the "Flying Windows" screen-saver is more important, then you had better hope you have a cat or kitten around to jump up on the table and accidentally jostle the mouse to interrupt the screen saver. MS Windows doesn't care. MS Windows is not a real-time operating system. (There are some people who maintain that MS Windows is not an operating system at all in the technical definition of "operating system.")
Both Linux and OS-X have the ability to raise processes to real-time priorities. A program so elevated has to be written to consciously give up control at time so background tasks can be done; MATLAB is not written with that kind of yielding in mind. You never know when MATLAB might decide to reorganize its free memory or how long it might take to do so.
Real Time on MS Windows => impossible without hacking the OS.
Real Time on Linux or OS-X => possible but must be used with caution that is not generally built in to MATLAB.
Because of this, if you need to write your program to have a guaranteed response time, you should not be writing it to run in MATLAB. Instead, you should use the product formally known as Real Time Workshop, which is currently a combination of MATLAB Coder and Simulink Coder. Those products produce C code that can be compiled for a stand-alone computer that incorporates an RTOS (Real Time Operating System) (e.g., QNX) or that uses hardcoded drivers and no real OS as such.
If your program does not need responses within a fixed time window, but does need to handle high bandwidth (lots of data), then _often_ MATLAB programs can be written that work "well enough" and which record the data to memory (and dump it to disc or process it after the burst of data has been transfered.)
A program that needs low latency (data must be read very quickly after it is generated) often also requires quick responses; as explored above you cannot promise quick responses. There is a variety of program, though, that needs low latency but does not need to respond quickly. One of the uses is if the data transfer is from a source that has little or no buffering; another of the uses is if the program is expected to "time-stamp" the incoming data accurately. MATLAB is not really suited to low-latency needs especially in combination with higher bandwidth. When time-stamping is the issue, it is usually much *much* better to instead use a D/A board that does on-board time-stamping and then transmits the time-stamped data over as quickly as MATLAB can handle it.
Earlier I spoke about MATLAB eing able to handle serial ports provided there was the right OS driver and so on. That was really only true for RS232 and RS442 serial ports. There are a lot of other kinds of serial ports that MATLAB is not expected to be able to handle directly. For example, data communications lines such as the venerable T1 are serial communications devices but MATLAB is not designed to be able to drive the mux signals directly. MATLAB is also not designed to be able to *directly* signal BISYNC (which is still in use in some IBM equipment) or Token-Ring or 10BaseT or 100BaseT (1000BaseT is really parallel rather than serial.) Basically, if the serial port requires direct waveform output then MATLAB is not designed to be able to provide that output. But MATLAB can talk to devices that act as RS232-type serial ports that are connected to controllers for those other devices and do the waveform generation based upon the character data.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by