/*************************************************************************** * This code will generate an interrupt with a status/ID. Both parameters * * can be specified by the user. The flow of code is as follows: * * * * 1) InitVXIlibrary * * 2) Get user info on interrupt level and status/ID * * 3) AssertVXIint * * 4) closeVXIlibrary * ***************************************************************************/ #include #include #include #include static char ch; static int status_id, line, controller; static UINT32 interrupt; static NIVXI_STATUS Status; void main () { Cls(); //clear STDIO window if ( InitVXIlibrary() ) //this function must be called { MessagePopup ("Error", "Unable to initialize VXI library... exiting"); exit (0); //if can't initialize library -> quit code } /* * Allow user to specify which interrupt to assert and status/ID. */ printf ("Which interrupt would you like to assrt? (1-7) >> "); scanf ("%d",&interrupt); //get interrupt level to assert printf ("What is the status ID? 0x"); scanf ("%x",&status_id); //get status/ID to use /* * This section actually asserts the VXI interrupt. The function has * the following parameters: * * controller: specifies the logical address of the controller to use * interrupt: specifies which interrupt level to assert * status_id: specifies the status/ID to be presented during the * IACK cycle */ controller = -1; //use default controller. Status = AssertVXIint (controller, interrupt, status_id); if ( Status ) { //error asserting interrupt. printf ("\nUnble to assert interrupt %d.\n", interrupt); } else { //successfully asserted interrupt. printf ("\nInterrupt %d was successfully asserted.\n", interrupt); } printf (""); getchar (); scanf ("%c", &ch); //wait for user to hit a key to quit CloseVXIlibrary(); //close down the VXI library }