> When I'm using my own application, sometimes I'm able to retreive the
> messages but
> mostly I get random behaviour like timeouts, fatal exceptions 
> or the Palm
> just hangs.

without your source its difficult to say. i have no problems with the serial
port of the palm (III). 

i am opening the serial port after receiving sysAppLaunchCmdNormalLaunch
all the communication is done after a button press.


opening

---
#define SERIAL_BUFFER_SIZE              256
UInt    gSerialRefNum;
char    gSerialBuffer[SERIAL_BUFFER_SIZE];
unsigned int nSerialCount;

        err = SysLibFind("Serial Library", &gSerialRefNum);
        ErrNonFatalDisplayIf(err != 0, "Can't find serial library");

        err = SerOpen(gSerialRefNum, 0, 19200);
---

sending to the device

---

        char b[20];
        Err      err;

        //0100L010031
        b[0] = xxx;
        b[1] = xxx;
        b[2] = xxx;
        b[3] = xxx;
        b[4] = xxx;

        SerSend(gSerialRefNum, &b, 5, &err);

        if (err != 0) {
                FormPtr         frm = FrmGetActiveForm();
                FieldPtr        StatusFld=(FieldPtr)FrmGetObjectPtr(frm,
FrmGetObjectIndex(frm, MainFormStatusFieldField));
                FldSetTextPtr(StatusFld, "error sending!");
                FldDrawField(StatusFld);
        }

---

waiting for response from the device

---

int Wait4Answer(void)
{
        Err err;
        ULong rec;
        char read;
        int loop = 0;

        do {
                rec = SerReceive(gSerialRefNum, &read, 1, 100, &err);
                if (err == 0) gSerialBuffer[loop++] = read;
        } while ((err == 0) && (read != END_DESCRIPTOR));
        if (err != 0) return ERR_TIMEOUT;
        loop--;                             // loop is now last value in
array (END_DESCRIPTOR)

        return NOERROR;
}

---

which compiler do you use (mw or gnu)? can you debug the application using
pose? i have no problems in debugging serial port communication software
with pose - just make sure that you use a adapter which crosses rxd and txd
lines.


good luck, roland

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|              Roland Aigner - Skidata Austria                  |
|                  airo at skidata dot com                      |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
all men like good head. president clinton fell for monica-head, 
 but as for me, i'll take mot�rhead and day - ron jeromy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to