background image

 

 

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 

29

E

XAMPLE 

U

SE OF THE 

PPIO 

 

Figure 5 shows a simple use of the PPIO to create an automatic 

Heating and Air Conditioning system. The top relay controls the Air 
Conditioning system. The other relay controls the heating system. 
The top thermostat controls the Air and the bottom one controls the 
Heat. On the PPIO I/O two and three are outputs to control the 
relays. PPIO I/O zero and one are inputs that are controlled by the 
thermostats. The way the automatic system should work is that if the 
temperature is above 78 degrees the Air should be on. When the 
temperature is below 72 degrees the Heat should be on. When the 
temperature is between 72 and 78 both the Heat and the Air should 
be off. 
 

 

 

Each PPIO output can handle up to 500 mA. This means that 

the relays have to take less current than that at 12 volts. You also 
should not exceed 2.25 watts of dissipation in the PPIO. To measure 
this turn on a relay with the PPIO and measure the voltage from the 
PPIO I/O pin to your power supply ground. You should get a voltage 
around 1.5 volts. If you multiply the voltage you read above by the 
current the relay draws you will have the dissipation of that PPIO I/O 
pin. For example, if you measure 1.65 volts and your relay draws 
100 mA then 1.65*0.1 equals 0.165 watts. If you  add up all of the 
PPIO loads THAT CAN ALL BE ON AT THE SAME TIME you 
should not have more that 2.25 watts. In our example you should not 
have both relays on at the same time (you would have the Heat and 
Air both on at the same time!) so you only need to worry about the 
dissipation of one relay. 
 

 

 

Figure 6 shows some GWBASIC code for a simple way to 

control the Heat/Air system. Line 100 was explained before. Line 
120 forces all the PPIO outputs HIGH (or OFF) so that when you 
start the program both relays will be OFF. It is also needed so that 
PPIO I/O zero and one can be used as inputs. Lines 160-180 input 
the data on all eight PPIO I/O points and puts it in variable IB. Line 
190 forces all bits except the first two to ZERO. This leaves only the 
status of the two thermostats. 
 

 

 

At this point IB can only be equal to zero, one, two, or three. If it 

is ZERO then both PPIO I/O inputs are HIGH and both thermostats 
are open. This means that the temperature must be below 72 
degrees and we want the heat ON  - see line 210. The only way IB 
can equal one is if PPIO I/O bit zero is ON (LOW) and bit one is 
OFF (HIGH). If bit zero is closed the temperature should be above 
78 degrees and the other thermostat should be on also. If we get 
this condition something must be broken so we turn off both the 

Содержание Parallel Port Input/Output Converter PPIO

Страница 1: ...B Electronics Mfg Co Inc 707 Dayton Road P O Box 1040 Ottawa IL 61350 USA Phone 815 433 5100 General Fax 815 433 5105 Home Page www bb elec com Sales e mail orders bb elec com Fax 815 433 5109 Technic...

Страница 2: ...33 5104 TABLE OF CONTENTS INTRODUCTION 1 PACKING LIST 2 PC PARALLEL PORT DESCRIPTION 3 PPIO DESCRIPTION CONNECTION 7 CONTROLLING THE PPIO USING GWBASIC 9 CONTROLLING THE PPIO USING PASCAL 12 CONTROLLI...

Страница 3: ...able pins on that port You MUST use a cable that connects pins 1 through 17 of the DB 25 connector to the PPIO for it to work properly To be safe you should use a cable that connects all 25 pins from...

Страница 4: ...4 Packing List Examine the shipping carton and contents for physical damage If there is damage contact B B Electronics immediately The following items should be in the shipping carton 1 PPIO unit 2 Th...

Страница 5: ...port is done through software If you look at the hardware you find that the parallel port is connected directly to the computer bus This means that we can address these inputs and outputs in any way w...

Страница 6: ...t the data on pin 11 will be inverted if pin 11 is LOW you will get a HIGH on bit 7 The pins with the bars over them are all inverted This is done by the hardware in the parallel port over which we ha...

Страница 7: ...command For this to work properly you must first force all the outputs HIGH The way the parallel port is wired if you do not force the outputs HIGH they will interfere with the inputs To do this use...

Страница 8: ...H 0279H and 027AH With a base address of 03BCH the addresses are 03BCH 03BDH and 03BEH Check your computer manual to find out which address your parallel port has It is also possible to purchase a spe...

Страница 9: ...t 0 of port 0378H is HIGH pin 2 of the parallel port is HIGH and the PPIO output pin will be LOW and can sink 500 ma If bit 0 goes LOW pin 2 will go LOW and the PPIO transistor will go OFF To use PPIO...

Страница 10: ...8 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 Figure 1...

Страница 11: ...REM This combines them 480 REM into one Input Byte Figure 2 The above assumes that you are using a parallel port located at 0378H If you are using a different port you will have to replace the hex ad...

Страница 12: ...OFF without disturbing any of the other PPIO Bits You may also use the PPIO with some pins as inputs and some pins as outputs There can be any number of each and in any order Remember that before you...

Страница 13: ...ome back the same when you input A good way to test for shorts is by outputting a HAA 10101010 binary and checking to see that the input is the same Then output a H55 01010101 binary and check the inp...

Страница 14: ...Register Address Control_Address WORD Control Register Address No function outside the Unit can directly access these variables Functions outside the Unit call functions within the Unit to modify and...

Страница 15: ...l port The function Read_Input_Bit reads the port The function Out_Byte returns the value of the variable Output_Byte It is defined as FUNCTION Out_Byte Byte BEGIN Out_Byte Output_Byte End Out_Byte No...

Страница 16: ...twise AND it with 0Fh 15 decimal 00001111 binary This sets the upper nibble of the byte to zero Now combine both bytes into one value by bitwise ORing them together This value is stored in the variabl...

Страница 17: ...twise ANDed with Input_Byte If the resulting value is non zero the line is ON and a boolean TRUE is returned otherwise a boolean FALSE is returned For example Line_Number 3 Status Register Value 01010...

Страница 18: ..._Output_Bit Bit_Number Output BYTE BEGIN Output_Byte Output_Byte AND 1 SHL Bit_Number XOR FF OR Output SHL Bit_Number Port Base_Address Output_Byte END Set_Output_Bit The variable Output_Byte stores t...

Страница 19: ...te 01010101b Line_Number 3 Status 1 00000001b 1 decimal shift right 3 Line_Number 00001000b XOR 11111111b 11110111b mask 1 AND 01010101b Output_Byte 00000001b Status 01010101b shift right 3 Line_Numbe...

Страница 20: ...Base_Address 1 define Control_Address Base_Address 2 typedef enum false 0 true 1 boolean The module PPIOFUNC C handles communication with the parallel port It defines three variables that all functio...

Страница 21: ...int In_Byte void return Input_Byte Notice that this does not read the value of the parallel port The function Read_Input_Bit reads the port The function Out_Byte returns the value of the variable Outp...

Страница 22: ...twise AND it with 0Fh 15 decimal 00001111 binary This sets the upper nibble of the byte to zero Now combine both bytes into one value by bitwise ORing them together This value is stored in the variabl...

Страница 23: ...gister Value 10101010b 01010101b Status Register AND 11110000b F0h mask 01010000b 10101010b Control Register AND 00001111b 0Fh mask 00001010b OR 00001010b 01011010b 00000001b 1 decimal shift right 3 L...

Страница 24: ...is set to a one its corresponding output line is ON when it is set to a zero the line is OFF To set a bit to the specified status the bit must first be cleared To do this 00000001b is shifted right f...

Страница 25: ...ggle the status of an output line If the specified line is ON it will be turned OFF If it is OFF it will be turned ON The function is defined as void Toggle unsigned char Line_Number Output_Byte Outpu...

Страница 26: ...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 Inp...

Страница 27: ...four digital outputs and verifies that the digital outputs are in set properly The lower four digital outputs are checked in a similar manner with the values 0Ah and 05h NOTE If the PPIO is connected...

Страница 28: ...se if you use a 24 volt relay you will need a 24 volt power supply The PPIO will control devices up to a maximum of 50 volts DC Figure 3 Each input of the PPIO works with voltages up to 50 volts DC wi...

Страница 29: ...28 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 Figure 4...

Страница 30: ...ill have the dissipation of that PPIO I O pin For example if you measure 1 65 volts and your relay draws 100 mA then 1 65 0 1 equals 0 165 watts If you add up all of the PPIO loads THAT CAN ALL BE ON...

Страница 31: ...Heat and the Air See line 230 If IB is equal to two then the 72 degree thermostat is on and the 78 degree one is off At this time we want both the Heat and the Air off See line 260 If IB is equal to 3...

Страница 32: ...ITS HIGH OFF 150 REM TO TURN EVERYTHING ELSE OFF 160 A1 INP H37A AND HF 170 A2 INP H379 AND HF0 180 IB A1 OR A2 190 IB IB AND H3 REM ONLY LEAVE THE TWO 200 REM THERMOSTAT CONTACTS 210 IF IB 0 THEN OB...

Страница 33: ...end of it to indicate that it is a hexadecimal number Table 4 can be used to convert a number between 0 and 255 into its hexadecimal representation Let us use 90 as an example Find 90 in the middle o...

Страница 34: ...igit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 3 48 49 50 51 52...

Отзывы: