• AVR Freaks

Sending data from picgui block to dspic and filtering it

Author
Pablof7
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/01/02 11:50:55
  • Location: 0
  • Status: offline
2015/10/10 12:08:04 (permalink)
0

Sending data from picgui block to dspic and filtering it

Hi:
I used fdatool to generate a simple lowpass filter for simulink, and included it in my project...
The objective was to test the filter, as a didactical example, so i wanted to send the data through uart to the  dsPIC, filter it, and show it in matlab...
I used the picgui bloc to plot the data and to send the signal i want to filter, but something is not working...
This is the script for the picgui:
 
figure(50);
a=round(sin(10*t_Rn*2*pi)*100);
b(1)=round(a(length(a))/256);
b(2)=a(length(a))-16*b(1);
fwrite(SerialCOM,b(1),'int8');
fwrite(SerialCOM,b(2),'int8');
idx = find(Rn > 65535 / 2);
Rn(idx)= Rn(idx)-65536;
[Rout tout]=padr(Rn,1,t_Rn);
plot(tout,Rout/100,'.-',t_Rn,a);
axis tight;
 
What i wanted to do is to generate a sin signal, divide it's values in two bytes, and send it to the uart... my model would read from the uart the data, convert it to the corresponding number, apply the low pass filter, and send it to uart-matlab block...
 
However, the data that i convert from the bytes that arrive to the uart is not the data that i send from the picgui...
Could you help me a bit with this? I'll send you the model and a image of the picgui plot.
 
Thanks
 

Attached Image(s)

#1
Jump to:
© 2019 APG vNext Commercial Version 4.5