Serial read - way to get a millisecond timestamp resolution ?
2 views (last 30 days)
Show older comments
Hi everyone,
I'm currently developping a custom high end serial communication API for various in-house purpose.
I need for this a resolution of the millisecond or tens of milliseconds when reading data.
The simpliest method to do this along the matlab documentation is to set a Callback on BytesAvailableFcn serial object property which fire event when specific terminator is read.
Thus according to the same documentation, the BytesAvailableFcn callback parameters are:
BytesAvailableFcn_Callback(this,serialObj,evt)
The event parameter contains :
Type: 'BytesAvailable'
Data: [1x1 struct]
with Data a one field structure AbsTime: [YYYY m dd HH MM SS]
Therefore, the resolution of the time monitoring is the second.
However using the record property of the serial object, the automatic log performs a millisecond resolution!
My question is: is there anyway to get a millisecond resolution in the BytesAvailable event ?
----------------------------
p.s.
The automatic record way is not suitable for my purpose and there s no possibility to subclassing/modify this (built-in ?) function.
I've also compared the accuracy of time acquisition between automatic record (serial data ready) and a manual now in the BytesAvailable Callback (serial data ready + callback call).
There is a gap in the order of the thousands ms at the first read, then there is a millisecond interval between each method, so it's seem to be a lack of accuracy for me.
0 Comments
Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!