From: Jose on
Hi guys,

Is there anybody that could help on this?

Thanks!
"Jose " <jose.araujo(a)fe.up.pt> wrote in message <i3j1qd$6md$1(a)fred.mathworks.com>...
> Dear all,
>
> I am having a problem using the packet input function on real-time. I am able to read the 17 bytes of data I am sending through the serial port in a good way BUT sometimes I end up having an extra byte in the frame which is making my buffer shifting one position every time this happens.
>
> E.g.
>
> byte 1 ... byte 17 = 17 bytes
> byte 1 ... Garbage = 17 bytes
> byte 17 (old) byte 1 ... byte 16 = 17 bytes
>
> So basically after some time I start only seeing the last bytes in the next frame, which is really bad. What I can do to fix this, in MATLAB code (http://www.mathworks.com/support/solutions/en/data/1-30N8YX/index.html?product=ML&solution=1-30N8YX) and in Labview is to Flush and Discard the Buffer (Purgecomm function in C). The thing is that I needed to use real-time simulink for this but Packet output doesnt do this automatically.
>
> Do you have any suggestions on how to do this?
>
> We have tried to do a C function S function to read the serial port in real-time, but first we used the windows.h to do this and it doesnt work as it is explained in the matlab help, and after that we built a C function based on the conio.h function which also doesnt work since it is made for pure RS232 serial communications (PORT1 to PORT4) and we are using USB (PORT5 to PORT9).
>
> Thank you!
> Jose
From: Steven_Lord on


"Jose " <jose.araujo(a)fe.up.pt> wrote in message
news:i3ohbs$7em$1(a)fred.mathworks.com...
> Hi guys,
>
> Is there anybody that could help on this?

*snip*

Determining what is causing this problem would probably require a lot more
information about what exactly your code and/or model is doing than you've
specified, so I recommend you contact Technical Support for help with this
issue.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: Jose on
Thank you Steve. Will do that.

I basically just needed to be able to call the buffer clear function somehow in real-time.

Jose
"Steven_Lord" <slord(a)mathworks.com> wrote in message <i3p02d$9ds$1(a)fred.mathworks.com>...
>
>
> "Jose " <jose.araujo(a)fe.up.pt> wrote in message
> news:i3ohbs$7em$1(a)fred.mathworks.com...
> > Hi guys,
> >
> > Is there anybody that could help on this?
>
> *snip*
>
> Determining what is causing this problem would probably require a lot more
> information about what exactly your code and/or model is doing than you've
> specified, so I recommend you contact Technical Support for help with this
> issue.
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com