Please remember that the PalmOS is a single threaded OS and resources during hacks are
quite limited. Here are a few tricks to
do...
* Instead of SerCheckReceive() try SerReceivedWait() with a quicktime out and a byte
by byte level. I have found this to be more
reliable considering the project in question.
* Move to the Stream library if you don't care about backwards compatibility.
* Something like this could justify reading the hardware registers directly if there
is something falling out of scope. You would
then need to really check on the hardware that you are running on to avoid crashing.
* Make sure the app that you are running when testing this hack is not grabbing the
serial port already.
Steve
Metalle Gary-GMETALL1 wrote:
> Hi
>
> I've recently written a Hackmaster hack to perform background tasks and I
> now want to read some data from the serial port in the short period of time
> that I do my background processing.
> I thought that I could just do a :
>
> SerOpen();
> SerCheckReceive();
> if (data) {
> bla bla
> }
> SerClose();
>
> For some reason I never read in any data although my code works (tested it
> in a normal 'application'). I always receive 0 (zero) bytes from the
> SerCheckReceive function. Is the same by the way even if you use the New
> Serial Manager functions. Does SerOpen() flush out the receive port? Is
> there a better way to quickly nip in, read data from the serial port and nip
> out again? I emphasize that this is a background task, so I can't just open
> the serial port when the application starts and then close it when it shuts
> down. I have to do any initialisation every time my trap handler gets
> called.
>
> Any thoughts on this appreciated. No more late nights please swearing at the
> computer!
>
> Gary
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/