07-01-2007 09:27 PM
NCTYPE_STATE _NCFUNC_ MyCallback (
                                    NCTYPE_OBJH       ObjHandle,
                                    NCTYPE_STATE      State,
                                    NCTYPE_STATUS     status,
                                    NCTYPE_ANY_P      RefData)
{
     if ( (State & NC_ST_WRITE_MULT  ) || (status == CanErrFunctionTimeout) )
          status = ncWrite(ObjHandle, sizeof(Transmit), &Transmit);
     else if  (State & NC_ST_READ_MULT)
      status = ncReadMult(ObjHandle,  sizeof(ReceiveBuf), (void *)ReceiveBuf, &ActualDataSize);
..... some other codes....
}
my calls to callback:
Transmit :      Status = ncCreateNotification (TxRx, NC_ST_WRITE_MULT, 100, NULL, MyCallback);
Receive:        Status = ncCreateNotification (TxRx, NC_ST_READ_MULT, NC_DURATION_INFINITE, NULL, MyCallback);
I provide two buttons to call either transmit or receive and when I run my program and call either one of these functions ONCE, the ncCreateNotification run continuously till my whole debugger hangs. I am using borland Cand USB-CAN. Can someone help me on this?
 
07-02-2007 04:35 AM
Well guys. My ncCreateNotification works for Transmit and Receive if I dont call them together. However, when I perform the followings, my ncWrite cannot work at all.
1) calling ncCreateNotification to do ncWrite.
2) Switch to ncCreateNotification to do ncReadMult.
3) calling ncCreateNotification to do ncWrite to transmit another frame.
my program runs smoothly if i only perform step 1 and step 2 (in either way).
07-02-2007 01:51 PM
07-02-2007 09:09 PM