Access IOD-144 Microscope & Magnifier User Manual


 
DIGITAL INPUT/OUTPUT CARD IOD-144 USER MANUAL
6-9
{to wait to be re-armed}
end.
TURBO-C PROGRAM
#define BASEADDR 0x300 /*declare base address for IOD card*/
#define ON 1 /*create useful constant*/
#define OFF 0 /* " " " */
#include "stdio.h"
#include "conio.h"
#include "time.h"
#include "dos.h"
int sensors_at_arm[15];
int sensors_now[15]; /*bit-by-bit status of sensors at current time. When*/
/*compared against status of sensors at arm, indicates
*/
/*break-in if there is a change.*/
int arming_stations; /*variables representing all four arming stations. If the*/
int_old_arming_stations; /*value changes, toggle alarm ON/OFF*/
char key; /*useful temporary variable*/
int i; /*useful temporary variable used in loops*/
int j; /*useful temporary variable*/
initialize(){
outportb(BASEADDR+3,0x93); /*outportb(addr,byte) is C's method of */
/*accessing port memory. This procedure sets*/
/*cPort A, B, and C LO as inputs and Port C Hi as*/
/*outputs. Address hex 303 is the control register */
/*The bit pattern needed to set the desired mode */
/*and port designation is 10010011, 93 hex */
} /*procedure initialize*/
read_sensors(int *ary){
unsigned char tempA;
unsigned char tempB;
tempA = inportb(BASEADDR);
tempB = inportb(BASEADDR+1);
for(i-0;i<8;i++){
if((tempA>> i) & ON){ /*this determines if bit #i is on and sets the
corresponding*/
*ary++=ON;} /*array element to ON if it is. If not, sets the array */
else{ /*to OFF*/
*ary++=OFF;
}
for(i=0;i<8;i++){