Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

String read from uart

i need to receive data from uart. but i know that transmitted datas to uart are as strings. how can i read them? and also how can i convert them into integer form?

i used the codes which is given in forum;

http://www.alteraforum.com/forum/sho...ghlight=string

but i could not make it. please help me.

thanks.

Matlab codes which are read the datas from sensor is as given below;

s = serial('COM4','BaudRate',19200,'DataBits',8);

fopen(s)

fprintf(s,'H1')

oku = fgetl(s);

[x(i) y(i) z(i)]= strread(oku);

it may help.
No RepliesBe the first to reply