Effacer les filtres
Effacer les filtres

Serial read - way to get a millisecond timestamp resolution ?

1 vue (au cours des 30 derniers jours)
Cedric Gilbert
Cedric Gilbert le 19 Août 2014
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.

Réponses (0)

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by