I open the serial library and keep it open for the life of the application,
then open and close the serial port as necessary.  Also try using
SerSendWait.

----- Original Message -----
From: "Patrick Ouellet" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Tuesday, August 08, 2000 3:23 PM
Subject: Simple question about my serial code


> Here's my code...
> Follow comment...
>
>   case MainBtnUpButton:
>     {
>      if(SerialLink == false)
>      {
>       file://Find serial ref num
>       ThisErr = SysLibFind("Serial Library", &SerNum);
>
>       if( ThisErr == 0)
>       {
>         file://open serial port
>        SerErr = SerOpen(SerNum, 0, 9600L);
>        if(SerErr == 0)
>        {
>        StrCopy(toSend, "12345");
>         SerSend(SerNum, toSend, 5, errPtr);
>         SerialLink = true;
> file://everything work fine before here
>        }
>       }
>      }
>      else
>      {
>       SerClose(SerNum);
>       SerialLink = false;
> file://This makes a fatal exception
>
>      }
>      break;
>     }
>
>     case MainBtnDownButton:
>     {
>      if(SerOpen(SerNum, 0, 9600L) == serErrAlreadyOpen)
>      {
>       StrCopy(toSend, "yeah");
>       SerSend(SerNum, toSend, 5, errPtr);
> file://this make a fatal exception
>      }
>      break;
>     }
>
>
> why is the first time I open the serial link I can send data
> ( and they are received on the pc )
> and not the second time or when i use the DownButton??
>
> Do you see something wrong with my code ???
>
>
> --
> 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/

Reply via email to