Hello All, 

I have an application that continously talks to a device through the serial
port. I started to have some issues when sending and receiving large amounts
of data. After many hours of "process of elimination" type coding I have
found out that when sending serially using SerSend, it stops sending after
about 2500 iterations. Yes, I was desperate and built a loop to do this.
If I close the port and exit the program it will give me another 2500
iterations.

If I close the serial port and then try to send again it seems as though
program flow does not return from SerSend.

What I don't know is, is this a constraint or am I sending my information
incorrectly? If it is a constraint, can one code around it. If it is not a
constraint, what am I doing wrong? 

Code is below:

case ContactDetailStart1Button:
{
        err = SysLibFind( "Serial Library", &gSerialRefNum );
        ErrNonFatalDisplayIf( err!=0, "Can't find serial library" );
                                        
        err = SerOpen( gSerialRefNum, 0, 9600 );
        if( err!=0 )
        {
                if( err == serErrAlreadyOpen )
                {
                        FrmAlert(SerialInUseAlert);
                        SerClose( gSerialRefNum );
                }
                else
                        FrmAlert(CantopenserialAlert);
                return false;
        }
        do
        {
                chsendvalue = 0xF8;
                                        
                err = SerSend( gSerialRefNum, &chsendvalue, 1, &err );
                SerSendWait( gSerialRefNum, -1 );
                                        
                SerSendFlush(gSerialRefNum);
                htext = MemHandleNew( HTEXT_SIZE );
                if( htext == NULL )
                        return false;
                ptext = MemHandleLock( htext );
                StrPrintF( ptext, "1.%ld", gcount );
                MemHandleUnlock( htext );
                index = FrmGetObjectIndex( gform, ContactDetailStatusField
);
                field = FrmGetObjectPtr( gform, index );
                FldSetTextHandle( field, htext );
                                                
                FldDrawField( field );
                                                        
                gcount++;
                                                        
        }while(true);
}
break;

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