Serial communication between Matlab and PIC
Mostra commenti meno recenti
how can sent floating number from matlab to PIC such as 1.35 , 1.06, 1.85 ?
when i sent 1.35 received in PIC 1 when i sent 1.85 received in PIC 2
the code that used in Matlab
u=1.35; fwrite(s,u);
Risposte (1)
Walter Roberson
il 10 Set 2012
Modificato: Walter Roberson
il 10 Set 2012
precision controls the number of bits written for each value and the interpretation of those bits as integer, floating-point, or character values. If precision is not specified, uchar (an 8-bit unsigned character) is used. The supported values for precision are listed below in Tips.
Thus you need to adjust the precision argument.
However, you need to research how PIC expects floating point values to be represented, and you need to represent them the same way.
Categorie
Scopri di più su Get Started with MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!