In document NetDCU_DeviceDriver.pdf configuration of digital I/O driver starts at pin 2. No information is given how to configure pin 1. This is because pin 1 is dedicated low level interrupt input (IRQ). At the moment it is not possible to use pin 1 of J5 as output.
The following code shows the usage of pin 1:
Code
- extern "C" BOOL InterruptInitialize(DWORD idInt, HANDLE hEvent, LPVOID pvData, DWORD cbData); extern "C" VOID InterruptDone( DWORD idInt );
- #define SYSINTR_FIRMWARE (8+8)
- #define SYSINTR_PIFIRQ (SYSINTR_FIRMWARE+15)
- #define SYSINTR_EXTIO (SYSINTR_FIRMWARE+16)
- static HANDLE hIsrEvent = NULL;
- // craete event which will be fired when interrupt occurs
- hIsrEvent = CreateEvent( NULL, FALSE, FALSE, _T("DIOINTF") );
- if( NULL == hIsrEvent )
- {
- DWORD dwLastError = GetLastError();
- ERRORMSG(1,(_T("Can't craete event (%d)\r\n"), dwLastError));
- }
- else
- {
- if (!InterruptInitialize(SYSINTR_EXTIO,
- hIsrEvent,
- NULL,
- 0 ))
- {
- CloseHandle( hIsrEvent );
- hIsrEvent = NULL;
- DEBUGMSG(1,
- (TEXT("Error initializing interrupt, InitInterrupt() failed\n\r")));
- return (FALSE);
- } /* end-if */
- InterruptDone( SYSINTR_EXTIO );
- // CeSetThreadPriority( GetCurrentThread(), 1 );
- while( TRUE )
- {
- // wait for interrupt (event)
- WaitForSingleObject( hIsrEvent, INFINITE );
- RETAILMSG(1,(_T("Event triggered\r\n")));
- // acknowledge interrupt
- InterruptDone( SYSINTR_EXTIO );
- }
- }