background image

34 

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 

 

Table 4 

 

Binary Numbers 

 

Binary numbers are base-2 numbers. They are written as a 

sequence of one's and zero's and end with a lower or upper case 
"B". 

Table 3

 shows how to convert any value between 0 and 15 into 

its binary representation. To easily convert a number into its binary 
number, first convert it to hexadecimal using 

Table 4

. Then convert 

the hexadecimal digit into its binary representation. Let's use the 
value 90. Its hexadecimal representation is "5Ah". The binary 
representation of "5" is "0101b", and the representation of "A" is 
"1010b". All we need to do is lay the two numbers end to end. The 
binary number representation of "5Ah" as "01011010b". 
 

Decimal to Hexadecimal Conversion 

Second Digit:

 

 

 

10 

11 

12 

13 

14 

15 

 

10 

11 

12 

13 

14 

15 

 

16 

17 

18 

19 

20 

21 

22 

23 

24 

25 

26 

27 

28 

29 

30 

31 

 

32 

33 

34 

35 

36 

37 

38 

39 

40 

41 

42 

43 

44 

45 

46 

47 

 

48 

49 

50 

51 

52 

53 

54 

55 

56 

57 

58 

59 

60 

61 

62 

63 

 

64 

65 

66 

67 

68 

69 

70 

71 

72 

73 

74 

75 

76 

77 

78 

79 

 

80 

81 

82 

83 

84 

85 

86 

87 

88 

89 

90 

91 

92 

93 

94 

95 

First 

96 

97 

98 

99 

100  101  102  103  104  105  106  107  108  109  110  111 

Digit: 

112  113  114  115  116  117  118  119  120  121  122  123  124  125  126  127 

 

128  129  130  131  132  133  134  135  136  137  138  139  140  141  142  143 

 

144  145  146  147  148  149  150  151  152  153  154  155  156  157  158  159 

 

160  161  162  163  164  165  166  167  168  169  170  171  172  173  174  175 

 

176  177  178  179  180  181  182  183  184  185  186  187  188  189  190  191 

 

192  193  194  195  196  197  198  199  200  201  202  203  204  205  206  207 

 

208  209  210  211  212  213  214  215  216  217  218  219  220  221  222  223 

 

224  225  226  227  228  229  230  231  232  233  234  235  236  237  238  239 

 

240  241  242  243  244  245  246  247  248  249  250  251  252  253  254  255 

Summary of Contents for Parallel Port Input/Output Converter PPIO

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Reviews: