Can I reduce the serialport 's write function call time
0 Commenti
Risposte (1)
2 Commenti
If you must use a serial port then switch hardware to a computer that has a serial port or has an expansion port that a serial port can be added to.
In some cases the best approach is to switch to Ethernet, possibly wifi.
There is no possibility of using serial() or serialport() for sustained high speed serial communication over USB. The design of USB 1 and USB 2 and USB 3.0 and USB 3.1 do not allow for the possibility. (USB 3.2 had changes that I have not studied yet but I know serial() and serialport() were not designed for that.)
To do sustained high speed data transfer over usb then the device needs to identify itself as providing audio or video or similar, in which case the USB controller will schedule time every controller cycle (1000 times per second) and will support sending multiple packets; the overhead per-frame buffer size would have to be set in advance. This would not be individual samples, this would be (for example) 2048 samples per cycle... samples that would not be time-tagged (unless the device tagged them and sent that information along with the samples). serial() and serialport() do not support this process.
You could also consider using a daq and the daq toolbox. The daq toolbox does support internal management of bulk usb transfer, and these days can time-tag each buffer-full.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!