Mail Archives: djgpp/2002/01/07/12:22:59
Roland wrote:
> Could you give me some sort of example of how to do
> this? I'm not sure on how to do this...
>
Here's a simple example of how to do this:
typedef BOOL unsigned char
typedef BYTE unsigned char
#define TRUE 1
#define FALSE 0
#pragma check_stack (off) //IMPORTANT! Make sure to put this macro before
the Rx handler function's definition
void RxHandler (int Event)
{
BYTE CharRcvd;
if( Event == evCOMRx )
{
if( COMReadChar(COM1, (char *)&CharRcvd, 0) != 0)
return;
}
else
return;
//Put your code here...
return;
}
END_OF_FUNCTION(RxHandler); //IMPORTANT! Make sure to put these lines at
the end of the function's definition
#pragma check_stack ()
//Example of the com-port opening code
BOOL OpenPort( void )
{
if( COMPortOpen(COM1, 19200, 8, 'N', 1, 0, RxHandler) == 0 )
bPortOpen = TRUE;
else
bPortOpen = FALSE;
return bPortOpen;
}
> Well, at some point a graphical window comes up (not
> mine, because my program is text-based) with the
> following error-message:
>
> The instruction at "0x0f00115e" referenced memory at
> "0xffffffff". The memory could not be "read".
>
Looks like you're using Windows' DOS box. Sorry, I don't have experience
working with this combination. Maybe PMCOM pulls some triggers here while
trying to access COM-Ports, I don't know...
> Maybe you could tell me if there's a new version of
> PMCOM, which has some improvements over this version?
>
Yes, I've got PMCOM v1.1 with some extras in it (e.g. flow control is
working). I also did some fixes on the library code, so if you don't mind
using it I can send you the sources and debug release (this is what I'am
currently using myself).
- Raw text -