ASSEMBLY LANGUAGE DRIVERS FOR SEALEVEL SYSTEM PIO48 BOARD C INTERFACE (c)Copyright Sealevel Systems Incorporated, 1993 - 1995 ------------------------------------------------------------------------------- >>>>>>>>>>>>>>>> File: PIO48_C.OBJ <<<<<<<<<<<<<<<<<<<< ------------------------------------------------------------------------------- SETBIT - Sets a bit (0-7) on a specified PIO48 port. Syntax: SETBIT(PORT,BIT,ONOFF) Where: PORT = desired port BIT = bit to set or reset (0-7) ONOFF = 1 to turn bit on 0 to turn bit off Returns: ERROR CODE = 1 - bit out of range 0 - no error The following C example would set bit 2 on port 300 Hex: extern int setbit(int,int,int); main() { int port,bit,onoff,error; port=0x300; bit=2; onoff=1; error=setbit(port,bit,onoff); } =============================================================================== TESTBIT - Reads the status of a bit (0-7) on a specified PIO48 port. Syntax: TESTBIT(PORT,BIT) Where: PORT = desired port BIT = bit to test (0-7) Returns: STATUS = 0 - bit low 1 - bit high 3 - bit out of range The following C example would check bit 0 on port 300 Hex and loop until the bit was high: extern int testbit(int,int); main() { int port,bit,status; port=0x300; bit=0; test:status=testbit(port,bit); if (status != 1) goto test; } =============================================================================== RDBYTE - Reads a byte value from a specified PIO48 port. Syntax: RDBYTE(PORT) Where: PORT = desired port Returns: PORT STATUS The following C example prints the status of port 300 Hex: extern int rdbyte(int); main() { int port; port=0x300; printf("The status of 300 Hex = %d",rdbyte(port)); } =============================================================================== SETBYTE - Sets a byte on a specified PIO48 port. Syntax: SETBYTE(PORT,BV) Where: PORT = desired port BV = byte value Returns: Nothing The following C example writes a 55 Hex (1010101) to port 300 Hex: extern int setbyte(int,int); main() { int port,bv; port=0x300; bv=0x55; setbyte(port,byte); } =============================================================================== CLBYTE - Clears a byte on a specified PIO48 port. Syntax: CLBYTE(PORT) Where: PORT = desired port Returns: Nothing The following C example clears port 300 Hex: extern int clbyte(int); main() { int port; port=0x300; clbyte(port,byte); } ===============================================================================