Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Hello guys....i am working on embedded project for that i want to display the result generated from Matlab using serial port through LCD already programmed with microcontroller.

1 回表示 (過去 30 日間)
SUMEET
SUMEET 2014 年 9 月 19 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I want to display the Matlab result which is in decimal format and getting generated continuously like:
Output=1, Output=2, .........
I used the Matlab Inbult functions for serial communication s=serial('COM7') fopen(s) fwrite(s,'output') but i am getting the output on LCD as "output"(in form like [o] [u]...[t]) not the one which i want (on LCD it should display 1,2,3,4,...)
How to do that??? Please help me out..
Thankx in advance Sumeet Saurav

回答 (1 件)

Geoff Hayes
Geoff Hayes 2014 年 9 月 19 日
Summet - please see serial write for details. According to the documentation (found at this link)
fwrite(obj,A) writes the binary data A to the device connected to the serial port object, obj.
So when you invoke
fwrite(s,'output')
the code is writing out the string output rather than the numeric data of the variable Output.
I think that what you want to do instead is
fwrite(s,Output)
and/or specify the precision of the data as (for example)
fwrite(s,Output,'uint8')

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by