B&B Electronics manual PPIO2899 Manual

Page 26

The function, Is_PPIO(), tests whether or not the PPIO is connected to the parallel port and functioning properly. This function should only be used if it is safe to toggle the state of the digital outputs.

int Is_PPIO (void)

{

unsigned int old_value; int status = 0x00;

/* Store the state of the digital outputs */ old_value = inp( Base_Address );

/* Check upper four digital outputs */

Output_Byte = 0xA0;

outp( Base_Address, Output_Byte );

Input_Byte = inp( Status_Address ) & 0xF0;

if( (Input_Byte & Output_Byte) == Output_Byte )

{

Output_Byte = 0x50;

outp( Base_Address, Output_Byte );

Input_Byte = inp( Status_Address ) & 0xF0;

if( (Input_Byte & Output_Byte) == Output_Byte )

{

status = 0x02;

}

}

/* Check lower four digital outputs */

Output_Byte = 0x0A;

outp( Base_Address, Output_Byte );

Input_Byte = inp( Control_Address ) & 0x0F;

if( (Input_Byte & Output_Byte) == Output_Byte )

{

Output_Byte = 0x05;

outp( Base_Address, Output_Byte );

24

PPIO2899 Manual

B&B Electronics Mfg Co Inc – 707 Dayton Rd - PO Box 1040 - Ottawa IL 61350 - Ph 815-433-5100 - Fax 815-433-5104

Image 26
Contents Not Recommended for New Installations Table of Contents Introduction Packing List PC Parallel Port Description Page BIT PPIO2899 Manual Ppio Description & Connection PPIO2899 Manual Controlling the Ppio Using Gwbasic Bit Force I/O on Force I/O OFF Low High Page Controlling the Ppio Using Pascal BeginElse Mask Value Function OutputBit BitNumberBYTE Byte Procedure SetOutputBit BitNumber,OutputBYTE XOR Controlling the Ppio Using C Void SetIRQOffvoid Outport ControlAddress Mask Value Page Page New PPIO2899 Manual Page Interfacing to the Ppio PPIO2899 Manual Example USE of the Ppio Page REM IB is the Input Byte and OB is the Output Byte Hexadecimal Numbers AppendixBinary Numbers