[Gambas-user] Serial port control

Randall Morgan rmorgan62 at ...626...
Mon Dec 23 08:35:33 CET 2013


I think the RTheshold of VB simply sets the byte count that must accumulate
in the receive buffer before a comm event is triggered. It doesn't do
anything else. In the background VB is still polling the buffer and looking
at the byte count. You can do this in GB but you will have to write it
yourself. You would need to simply use the read event on the comm object to
test the byte count. I believe it triggers at 1 byte. Then use that to
trigger your own custom event when your 124 bytes have arrived.

You might also be able to talk Benoit into adding an RThreshold property.
Seems like it might be handy.... At the very least 4Hz is very very slow
for most computers. And setting up a 4Hz polling of the port wouldn't be
hard at all.


On Sun, Dec 22, 2013 at 8:10 PM, Carl Nilsson <nilsson at ...1979...> wrote:

> 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
>
> ------------------------------------------------------------------------------
> 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?



More information about the User mailing list