[Gambas-user] Serial port control
Carl Nilsson
nilsson at ...1979...
Mon Dec 23 05:10:40 CET 2013
Thanks Randall. I guess it's time to try it and play around a
little, which I can't do for a few days. At the moment I'm trying to
look ahead and see where problems might lie. When push comes to
shove, I don't know how these things really work! I follow
recipes! Don't really want to close the port as the data come in
continuously as fast as the device can send them and I don't want to
miss any. (It's attitude sensor data from an inertial management
unit in a light aircraft). Same in principle with another
"continuous" stream of binary GPS data with packets of 124 bytes
coming in at a slower rate of, say, 4 Hz. How "continuous" it is
would depend on the baud rate at which the port is operating. The
RThreashold property of MScomm handles this issue very well. Doesn't
trigger an event until the specified number of bytes is in the serial buffer.
Carl
At 02:47 PM 23/12/2013, you wrote:
>It has been a long while since I have used the serial component of GB but I
>have a project starting in which I will need to re-acquaint myself with it.
>The stream can be setup as blocking or non-blocking. The PC uses either
>polling or interrupt when the port is opened. So trying to manage the
>serial port at the same level you would in on uC is pointless in most
>cases. Just set up the stream and read the bytes you need from there. If
>you're concerned about buffer overflow then you may want to close the port
>once you have read the bytes you need.
>
>Perhaps someone with more recent experience can help you more.
>
>
>
>
>On Sun, Dec 22, 2013 at 7:15 PM, Carl Nilsson <nilsson at ...1979...> wrote:
>
> > Randall: Thanks for responding. OK, I have looked at the stream
> > functions: My question was, basically, how do I specify how many
> > bytes I want to take in from a given serial port at each
> > instance? For example, on one input I expect a continuous stream of
> > 31 byte packets and I want to take them in for processing 25 (say)
> > packets at a time, i.e. 775 bytes at a time. Now I don't much mind
> > if I get a few bytes more or less because I can check for a remainder
> > part-packet and put it on the front of the next nominal 775 byte
> > intake - that's part of the processing software - but I don't want
> > the CPU tied up with that port or stream between intakes of (about)
> > 775 bytes. There are other input streams and data processing to
> > attend to. I don't see how to do that with the stream functions -
> > but maybe I'm not understanding how the stream works? I can see that
> > I could (I think!) read a given number of bytes from a stream, but
> > does that relieve the CPU from being tied up with that stream until I
> > read another 775 bytes? Is a stream of indefinite length or does it
> > have some buffer limit?
> > Carl
> >
> > At 01:09 PM 23/12/2013, you wrote:
> > >As I recall gb serial is steam based and so you would handle buffers via
> > >the stream not the serial object.
> > >
> > >
> > >On Sun, Dec 22, 2013 at 3:01 PM, Carl Nilsson <nilsson at ...1979...>
> > wrote:
> > >
> > > > G'day all:
> > > > Now with Gambas 3 installed, I want to get on with porting my running
> > > > software from VB6/Windows. It requires processing multiple streams
> > > > of binary serial data from attached devices. The serial control in
> > > > gambas 3 does not seem up to the job, in so far as the available
> > > > properties lack the elements I use under VB MScomm. ...(snip)
> >
> >
> > > > Carl
> > > >
> > > > Carl S Nilsson
> > > > 137 Gordons Hill Road
> > > > Lindisfarne, Tas.
> > > > Australia 7015
> > > >
> > > >
> > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > Rapidly troubleshoot problems before they affect your business. Most IT
> > > > organizations don't have a clear picture of how application performance
> > > > affects their revenue. With AppDynamics, you get 100% visibility into
> > your
> > > > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of
> > AppDynamics
> > > > Pro!
> > > >
> > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> > > > _______________________________________________
> > > > Gambas-user mailing list
> > > > Gambas-user at lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > >
> > >
> > >
> > >
> > >--
> > >If you ask me if it can be done. The answer is YES, it can always be done.
> > >The correct questions however are... What will it cost, and how long will
> > >it take?
> >
> > >-----------------------------------------------------------------
> -------------
> > >Rapidly troubleshoot problems before they affect your business. Most IT
> > >organizations don't have a clear picture of how application performance
> > >affects their revenue. With AppDynamics, you get 100% visibility into your
> > >Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> > Pro!
> > >
> > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> > >_______________________________________________
> > >Gambas-user mailing list
> > >Gambas-user at lists.sourceforge.net
> > >https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> > Carl S Nilsson
> > 137 Gordons Hill Road
> > Lindisfarne, Tas.
> > Australia 7015
> >
> >
> ------------------------------------------------------------------------------
> > Rapidly troubleshoot problems before they affect your business. Most IT
> > organizations don't have a clear picture of how application performance
> > affects their revenue. With AppDynamics, you get 100% visibility into your
> > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> > Pro!
> > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
>
>
>--
>If you ask me if it can be done. The answer is YES, it can always be done.
>The correct questions however are... What will it cost, and how long will
>it take?
>------------------------------------------------------------------------------
>Rapidly troubleshoot problems before they affect your business. Most IT
>organizations don't have a clear picture of how application performance
>affects their revenue. With AppDynamics, you get 100% visibility into your
>Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
>http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
>_______________________________________________
>Gambas-user mailing list
>Gambas-user at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gambas-user
Carl S Nilsson
137 Gordons Hill Road
Lindisfarne, Tas.
Australia 7015
More information about the User
mailing list