$compact debug pw(79) rom sbx350_mod: DO; $INCLUDE (:RMX:inc/rmxplm.ext) DECLARE SBX350$INT$LEVEL LITERALLY '75H', /* MINTR0 on J5 */ WAIT$FOREVER LITERALLY '0FFFFH', NO$WAITING LITERALLY '0', ONE$SECOND LITERALLY '100', CR LITERALLY '0DH', LF LITERALLY '0AH', MY$JOB$DIRECTORY LITERALLY 'SELECTOR$OF(NIL)', FOREVER LITERALLY 'WHILE 1', SBX350$PORT$A LITERALLY '0A0H', SBX350$PORT$B LITERALLY '0A2H', SBX350$PORT$C LITERALLY '0A4H', SBX350$CONTROL$PORT LITERALLY '0A6H', /* Set Port A for strobed input and Prot B for Mode 0 output */ SBX350$INIT$MODE LITERALLY '10111000B', ENABLE$PORT$A$INTERRUPT LITERALLY '00001001B'; sbx350$int$handler: PROCEDURE INTERRUPT REENTRANT PUBLIC; DECLARE status WORD; /* Let the interrupt task do all of the work. The time for a * context switch should help in the debounce of the interrupt * switch. */ CALL rq$signal$interrupt (SBX350$INT$LEVEL, @status); END sbx350$int$handler; sbx350_task: PROCEDURE PUBLIC; DECLARE procio$mbox TOKEN, resp$mbox TOKEN, sbx350$mbox TOKEN, status WORD, input$values (128) BYTE, actual BYTE, index BYTE, number$of$samples BYTE, sbx$init$data BYTE, sbx$init$msg (*) BYTE DATA (CR,LF,'The interrupt task is now initialized',CR,LF,0); /* Initilize the iSBX350 interface: * Port A = Input * Port B = Output * Port C = Output * Port A interrupt enabled */ OUTPUT (SBX350$CONTROL$PORT) = SBX350$INIT$MODE; OUTPUT (SBX350$CONTROL$PORT) = ENABLE$PORT$A$INTERRUPT; /* Create a mailbox for passing data, not iRMX objects. */ sbx350$mbox = rq$create$mailbox (60H, @status); CALL rq$catalog$object (MY$JOB$DIRECTORY, sbx350$mbox, @(9,'SBX350MBX'), @status); /* Install the interrupt handler */ CALL rq$set$interrupt (SBX350$INT$LEVEL, 1, @sbx350$int$handler, SELECTOR$OF(NIL), @status); /* Get the mailbox token for the I/O procedure. */ procio$mbox = rq$lookup$object (MY$JOB$DIRECTORY, @(9,'PROCIOMBX'), WAIT$FOREVER, @status); /* Send the initialization message to the I/O task. */ CALL rq$send$data (procio$mbox, @sbx$init$msg, 1, @status); /* Get the number of samples per screen update */ actual = rq$receive$data (sbx350$mbox, @number$of$samples, WAIT$FOREVER, @status); /* Loop forever, waiting for interrupts. */ DO FOREVER; /* Loop the specified number of times before updating the screen */ DO index = 0 TO (number$of$samples - 1); /* Wait to debounce the interrupt. */ CALL rq$sleep (1, @status); /* Get the input data. */ input$values (index) = NOT (INPUT (SBX350$PORT$A)); OUTPUT (SBX350$PORT$B) = input$values (index); END; /* DO index = 0 TO (number$of$samples - 1) */ /* Print the current array of data. */ CALL rq$send$data (procio$mbox, @input$values, number$of$samples, @status); actual = rq$receive$data (sbx350$mbox, @number$of$samples, WAIT$FOREVER, @status); END; /* DO FOREVER */ END sbx350_task; END sbx350_mod;