Mail Archives: djgpp/2002/01/08/08:58:50
--- Alex Oleynikov <alex AT compuweigh DOT com> wrote:
> 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 ()
Haven't tried this yet, but I don't really think this
is needed. What I need (after some research today) is
a way to make the COMReadBuffer to wait with the
reading until a message arrives... The error from
Windows was generated (I guess) because the program
kept on reading and reading from COM1.
On UNIX the program reads the port and when it is
empty it blocks until something is written to the
port.
Is there a way to do this??
> //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;
> }
This is not the problem, because I already had a
similar piece of code that opened the port, and that
did not give me an error before...
> 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).
I do not know if you have already tried to send it,
but if it is to big for this mailbox (max. 3MB),
please send it to roland DOT asmann AT nl DOT thalesgroup DOT com...
Thanks!
Roland
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
- Raw text -