home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1996 / ARCHIVE_96.iso / discs / mag_discs / volume_9 / issue_03 / 24bitio / ConstDtls next >
Text File  |  1995-09-27  |  12KB  |  120 lines

  1. Construction Details for 24Line I/O Card
  2.  
  3. 1. Circuit Description
  4.  
  5. Figure 1 shows the circuit diagram for the I/O card.  IC 1 is the 74HC245 octal tri-state buffer used to connect the data lines DB0-DB7 from the back plane connector to the card.  Output Enable (OE) of this buffer is controlled by the Podule Select (PS) line from the backplane.  That is, until our card is selected (PS goes low), IC 1 is not connected to the data bus.  The Send/Receive (S/R) pin is controlled by the Podule Read Not Write (PR/W) line.
  6.  
  7. The five control and three address lines used by the card are buffered by IC 2.  This is also a 74HC245 but configured as input buffer by connecting its S/R and OE pins to 0 Volts.  The address lines LA2 and LA3 are used to access the individual registers within the PIA while LA13 is used by the address decoder.
  8.  
  9. IC 3 is a 74HC00 and forms the address decoder circuit as detailed above. It produces two active low outputs, CS to control the PIA and OE to control the ECId.
  10.  
  11. IC 4, R1-R4 and S1-S4 form the ECId byte. IC 4 is another 74HC245 and is configured as an output device by tying its S/R pin to +5 Volts.  The OE pin is controlled by the address decoder.  Only when OE goes low will the values set by the switches S1-S4 and links be transferred to the data bus.
  12.  
  13. IC 5 is the PIA.  Its Chip Select (CS) pin is driven by the address decoder and will only connect to the data bus when this goes low.  The register to read from or write to is selected by the address on pins A0 and A1, driven by LA2 and LA3 via IC 2.  Read and write controls are also driven from the expansion bus via IC 2.  Reset is an active high input to the chip which will return all ports to their power on state.  The reset signal from the expansion bus is however and active low signal so TR1, R5 and R6 form an inverter for this signal.
  14.  
  15. 2. Construction
  16.  
  17. All parts are available via mail order from Maplin Electronics on 01702 554161 and the table below gives the order code and cost of each item from their September '95 to August '96 catalogue.  If you have one of their shops in your area then you should be able to get everything but the PIA data sheet over the counter.
  18.  
  19.    +----------------------------------------------------------------------------+
  20.    | Parts List                                                                 |
  21.    +-----------+-------------------------------------+---------+-------+--------+
  22.    | Part      | Description                         | Order   | Each  |  Total |
  23.    +-----------+-------------------------------------+---------+-------+--------+
  24.    | IC 1,2,4  | Octal Bus Transceiver - 74HC245     | UB67X   | 112p  |  ú3.36 |
  25.    | IC 3      | Quad 2 Input Nand     - 74HC00      | UB00A   |  51p  |  ú0.51 |
  26.    | IC 5      | 24 Line Parallel I/O  - 8255A       | YH50E   | 429p  |  ú4.29 |
  27.    |           | Data Sheet for above                | XK97F   |  99p  |  ú0.99 |
  28.    | R1-R4     | 2k2 0.6Watt 1% Min. Res.            | M2K2    |   4p  |  ú0.16 |
  29.    | R5,R6     | 10k 0.6Watt 1% Min. Res.            | M10k    |   4p  |  ú0.08 |
  30.    | TR1       | BC549 (BC109c equivalent)           | QQ15R   |  11p  |  ú0.11 |
  31.    | S1-S4     | Piano DIL Switch (4 Way)            | JW75S   |  69p  |  ú0.69 |
  32.    | Connect   | Right Angle Plug 64AC (DIN 41612)   | FJ51F   | 143p  |  ú1.43 |
  33.    | O/P Sock  | 26 Way IDC Header                   | FJ15R   | 139p  |  ú1.39 |
  34.    | IC Skts   | 14 Pin DIL (1 off)                  | BL18U   |  12p  |  ú0.12 |
  35.    |           | 20 Pin DIL (3 off)                  | HQ77J   |  14p  |  ú0.42 |
  36.    |           | 40 Pin DIL (1 off)                  | HQ38R   |  22p  |  ú0.22 |
  37.    | Wire      | Bell Wire Black                     | BL85G   |  52p  |  ú0.52 |
  38.    |           | Bell Wire Red                       | BL92A   |  52p  |  ú0.52 |
  39.    |           | Ribbon Cable (10 Way)               | XR06G   |  72p  |  ú0.72 |
  40.    | Vero Brd  | Strip Board 3962                    | JP50E   | 229p  |  ú2.29 |
  41.    +-----------+-------------------------------------+---------+-------+--------+
  42.  
  43. 2.1  Instructions
  44.  
  45. As stated at the being of this article the card is built on Vero board.  If you have not seen this before it is similar to a PCB with holes punched on a 0.1" grid and copper strips running on one side.  By cutting these strips at strategic points and soldering in links and components it is possible to construct simple circuit layouts.  It is not difficult to use but requires care when cutting the strips as it is easy to leave a small piece of copper intact.  It is advisable to check each cut with a meter to make sure the strip has been cut cleanly.  Using a spot face cutter (or very carefully a small drill bit) and the diagram provided (Figure 2), cut all the indicated tracks on the copper side of the Vero board.  There are a lot of them so work methodically and check every one as you go, see above.  Only when satisfied that all tracks have been broken correctly should you proceed to install the components.
  46.  
  47. Figure 3 shows the component layout on the Vero board and figure 4 shows the pin outs for all the semiconductors used in this project.  First solder in all the wire links and resistors on the component side of the board.  Try to keep all links tight to the board, especially those that run under IC sockets.  Where a number of tracks are linked, such as under IC4, the holes in the Vero board will have to opened slightly to take the two wires.   All links should be made of bare tinned copper wire (strip insulation off some of the bell wire), except the following which should be left insulatedá:-
  48.  
  49. a) The 8 links from the connector to IC 1 pins 11 to 18 inclusive,
  50. b) The link that runs within the connector (a1 to +5V rail),
  51. c) The link that runs in front of connector (c32, to 0V rail).
  52.  
  53. Next fit all IC Sockets noting orientation, the notch on each socket should be pointing to the bottom of the board as shown in figure 3.  The 4 way DIL switch can also be fitted at this time by soldering it directly to the board.     
  54.  
  55. We now come to the connectors.  The output socket is a 26 way IDC header. Using short (50mm) lengths of ribbon cable, solder 26 wires to it.  Now bolt the socket to the board making sure that no tracks are shorted together by the bolts.  If so then cut extra tracks around bolts to prevent it.  Solder each wire to the board in the appropriate position.  It is up to you exactly how the output socket is arranged.  I put Port B on pins 1-8, Port C on 9-16, 0 Volts on 17, +5 Volts on 18 and Port A on 19-26.
  56.  
  57. The expansion bus connector needs some modification before it can be soldered to the board.  The following pins on row C have to be cut off, 4C and 24C to 32C inclusive.  Pins 14C and 15C have to straightened, shortened to about 6mm in length and have 50mm lengths of insulted wire soldered to them.  After modification the connector should be soldered in and the two flying leads soldered to the appropriate place, see Figure 3.  Finally solder in TR1 noting orientation.  This completes the initial construction of the board.   
  58.  
  59. 2.2  Testing
  60.  
  61. Check every solder joint for quality and ensure there are no bridges between tracks.  Next set all switches to off and check the resistance between 0V and +5V rails with a meter set to Ohms.  There should an open circuit.  If not check all solder joints, links, and track cuts.  When satisfied apply a +5V supply to the card and check that 0V and +5Volts are correctly present at each IC Socket (refer to figures 3 and 4).  Please do not rush these tests as the safety of your computer is at risk and I CANNOT TAKE ANY RESPONSIBILITY IF IT ALL GOES WRONG.  You have been warned.
  62.  
  63. 2.3 Installation
  64.  
  65. To install the card inside your computer you will first have to modify one of the blanking plate at the back to allow the connector to come through.  I used a drill and a small file to make a 52mm x 8mm rectangular hole in the blanking plate at the point where the connector would be.  This size is a nice push fit over the 26 way IDC header plug and no further fixing was required. 
  66.  
  67. When you are sure that all is ok and the card fits securely inside, fit all IC's taking care as they are all CMOS types and are thus easily damaged by static.  Make sure that each is inserted the correct way round and that no legs are bent underneath.  Finally set a Podule ID Number on the DIL switch.  The podule ID should be number between 1 and 15, ie you must not have an Id of zero.
  68.                                                                                                    
  69. 3. Software.
  70.  
  71. Although the 8255A PIA is a very flexible chip it is quite simple in its operation.  To set the mode of operation one has to write a control word to the control register (located at &200C in this card).  The format of this control word is as follows :-
  72.  
  73.        Bit 7      = 1 : Mode control active
  74.        
  75.        Bits [5:6] = 0 : Port A set to mode 0 - Basic I/O
  76.                   = 1 : Port A set to mode 1 - Strobed I/O
  77.                   > 1 : Port A set to mode 2 - Bidirectional Strobed I/0
  78.                   
  79.        Bit 4      = 0 : Port A set as output
  80.                   = 1 : Port A set as input
  81.                   
  82.        Bit 3      = 0 : Port C upper 4 bits set as output
  83.                   = 1 : Port C upper 4 bits set as input
  84.                   
  85.        Bit 2      = 0 : Port B set to mode 0 - Basic I/O
  86.                   = 1 : Port B set to mode 1 - Strobed I/O
  87.                   
  88.        Bit 1      = 0 : Port B set as output
  89.                   = 1 : Port B set as input
  90.                   
  91.        Bit 0      = 0 : Port C lower 4 bits set as output
  92.                   = 1 : Port C lower 4 bits set as input
  93.                   
  94. So to set the I/O chip up as Port A mode 0 output, Port B mode 0 input, Port C upper as input and Port C lower as output the control word would be %10001010 in binary or 138 in decimal.  The data sheet contains tables of valid control words and their effects on each port.  It is also possible to use the control register to set or clear individual bits of Port C. The format of this is as follows :-
  95.  
  96.       Bit 7      = 0 : Altering Port C bits active
  97.       
  98.       Bits[4:6]  = x : Unused in this mode 
  99.       
  100.       Bits[1:3]  = n : n is bit to change
  101.       
  102.       Bit 0      = 0 : Clear bit n
  103.                  = 1 : Set bit n
  104.  
  105. Accessing the PIA on the card can be done with the two SWIs Podule_RawRead and Podule_RawWrite (&40287, &40288).  These take the offset into the cards I/O space in R0 in WORDS not bytes, the number of bytes to read or write in R1, a pointer to a buffer for the data in R2 and the slot number the card is in in R3.  The slot number can be obtained by using the SWI Podule_ReadId (&40280) to read the Id of each installed card and checking the ECId against the one set on our card.  On entry R3 contains the slot number to check and the Id is returned in R0.  If no card is present in the slot then an error is raised in the usual way.  Listing 1 gives a simple demonstration of the above.  The program first searches for the card, sets all ports to outputs and finally switches each line on Port A on in turn.
  106.  
  107. Listing 2 contains the source code for a relocatable module which provides SWIs which simplify access to the PIA and make programs more readable.  When the module loads it automatically searches for the card and stores the hardware address of the PIA.  The SWIs are :-
  108.  
  109. a) PIA_SetMode             - Takes the Mode Control Word in R0.
  110. b) PIA_ReadPort            - Takes the port to read in R0 (0 to 2) and returns the value
  111.           read also in R0.
  112. c) PIA_WritePort           - Takes the port to write to in R0 and what to write in R1.
  113. d) PIA_SetReset_C_Bits     - R1 = the bit to alter in port C
  114.           R0 = 1 means set the bit and anything else means clear it.
  115. e) PIA_Reset               - Takes nothing and resets the PIA to Mode 0 all outputs.
  116.  
  117. Listing 3 shows how to use some of the SWIs in the module.  Note that you do not have to find the card first as this is done as the module loads.  This program assumes that ports A and B have been linked together then sends a value down port B and reads in back from port A.  Not very useful but it shows how to use the SWIs to set the mode and read and write data via the PIA. 
  118.  
  119.  
  120.