Here's my code...
Follow comment...

  case MainBtnUpButton:
    {
     if(SerialLink == false)
     {
      //Find serial ref num
      ThisErr = SysLibFind("Serial Library", &SerNum);

      if( ThisErr == 0)
      {
        //open serial port
       SerErr = SerOpen(SerNum, 0, 9600L);
       if(SerErr == 0)
       {
       StrCopy(toSend, "12345");
        SerSend(SerNum, toSend, 5, errPtr);
        SerialLink = true;
//everything work fine before here
       }
      }
     }
     else
     {
      SerClose(SerNum);
      SerialLink = false;
//This makes a fatal exception

     }
     break;
    }

    case MainBtnDownButton:
    {
     if(SerOpen(SerNum, 0, 9600L) == serErrAlreadyOpen)
     {
      StrCopy(toSend, "yeah");
      SerSend(SerNum, toSend, 5, errPtr);
//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/

Reply via email to