Serial communication through Matlab

1 回表示 (過去 30 日間)
Jim
Jim 2013 年 5 月 31 日
回答済み: Kiran Kintali 2021 年 7 月 1 日
Hi,
I am doing VHDL project using nexys2 board.
I need to read the sensor readings using matlab through serial communication.
My Code:
nexys = serial('COM1', 'BaudRate', 9600, 'Parity', 'odd', 'Terminator', '', 'Timeout', 1);
fopen(nexys);
s = 's';
fwrite(nexys,s,'uchar');
scan_s1 = fread(nexys,1,'uint16');
t = 't';
fprintf(t,'nexys')
scan_s2 = fread(nexys,1,'uint16');
I am able to read the sensor values from nexys2 board. But the problem is that I geeting the sensor readings like
55352,45232 like this. But the maximum range of sensor is 400. It should not exceed this value.
Is this because continuous reading of data?
Can you please help me in solving the problem.
Thanks in advance Vivek Alaparthi

回答 (1 件)

Kiran Kintali
Kiran Kintali 2021 年 7 月 1 日
This page can be helpful for this topic.
https://www.mathworks.com/help/supportpkg/xilinxfpgaturnkeyboards/index.html

Community Treasure Hunt

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

Start Hunting!

Translated by