UDP compilation error in State-flow

1 次查看(过去 30 天)
Hi.
I have linked an Arduino to Matlab using UDP as:
u = udp('10.0.0.177','RemotePort',8888,'LocalPort',9060); %Udp-protocol
fopen(u); %open tow
status = fscanf(u,'%s'); %read protocol as string
fclose(u); %close tow
delete(u); %delete protocol, release port
This worked fine until I wanted to call this as a function in State-flow. State-flow compiles the functions to C code and the udp function does not compile.
I tried to use compilible dsp.UDPReceiver as:
H = dsp.UDPReceiver('RemoteIPAddress','10.0.0.177','LocalIPPort',9060);
status = step(H);
release(H);
but this does not work. I found that step does not accept string, but the Arduino seems to only be able to send strings.
I also tried using the UDPReceiver block in Simulink but with very strange results. I receive numbers that dont match what is sent.
So I would like to either be able to compile the udp function or send strings via UDPReceiver, can anyone help me with that I would realy appreciate it.
/Martin

采纳的回答

Martin
Martin 2013-8-19
Answering my own question.
I was unable to get dsp.UDP working, instead I had to move the UDP communication outside State-flow into Simulink (using flags for commands) and call it as an embedded Matlab function.
Not optimal, but it seems to work.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by