Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Interfacing with C plus plus-programing communication with microcontrolers (K. Bentley, 2006)

.pdf
Скачиваний:
192
Добавлен:
12.08.2013
Размер:
3.18 Mб
Скачать

438 APPENDIX A - HARDWARE

tools are often used if they are available, however, most readers will not have access to such equipment. To minimise any likelihood of damage to the pcb, components with more than two leads (or pins) are sacrificed during their removal. NOTE: the pcb can also be damaged if any pads (or tracks) are subject to the application of heat from a soldering iron for excessive periods of time.

Discrete components (resistors, capacitors, etc.)

If the component has pliable leads, then the simplest method to remove the component is to grip one lead using pliers and then heat its solder joint until the joint becomes molten. Once this happens, lift the lead completely from the board. Perform the same process for the other component lead(s).

If the component has stiff leads that will not allow an individual lead to be lifted from the board, the component will need to be sacrificed by snipping each of its leads using cutters.

Integrated Circuits (ICs)

IC sockets should be used for all positions on the pcb where ICs are to be placed. This allows quick and easy fitting and removal of ICs without damage to the board or the IC. Should an IC be fitted without using an IC socket, it is recommded that it be removed from the board by cutting each of its legs. Then remove each leg inturn in a similar method as for individual leads of discrete components.

Cables and Connection Leads

Table A-1 shows the components needed for all cabling. These cables are shown in Figure A-5 and Figure A-6. We recommended you fabricate only those interconnecting leads actually needed for a particular project and purchase the D25M to D25M cable as an already manufactured unit.

Table A-1 Cable Components for all Projects.

Quantity Component Description

1 One-to-one D25 Male to D25 Male cable

50Pcb pin socket, suit pin 0.9 – 1.0 mm (for interconnect cables)

7 m Hookup wire (for interconnect cables)

1 m Heatshrink tubing; 2.5 - 3 mm diameter

APPENDIX A - HARDWARE 439

2 metres

D25 Male

D25 Male

Figure A-5 One-to-one D25 Male to D25 Male cable.

Interconnect Lead Assembly

The interconnect leads are used to connect outputs of circuit blocks/elements to inputs of circuit blocks/elements. DO NOT at any time connect an output to another output - doing so will most likely damage the components involved. Each interconnect lead (shown in Figure A-6) you need can be fabricated as follows.

Solder a pcb pin socket to one end of a 25 cm length of hookup wire. Slide a 15 mm length (approximate) of heatshrink tube along the wire and onto the socket. The tube should be positioned about halfway along the socket (far enough to prevent contact between sockets when the sockets are in use connected to adjacent pcb pins on the board). Apply heat to the heatshrink tube to shrink it in place.

Slide a second 15 mm length (approximate) of heatshrink tube onto the other end of the wire. Solder this end of the wire to the second pcb pin socket. Position and shrink the second heatshrink tube tube as described above.

25 cm

Figure A-6 PCB interconnecting lead – socket to socket.

Interconnect Lead Testing

Test the mechanical strength of each lead’s solder joints by holding a socket in each hand and pulling the lead using moderate force. Should a socket come loose, repeat the assembly operation. Electrical continuity can be tested using a multimeter set to resistance mode. Resistance between sockets should be thousandths of an Ohm at most.

440 APPENDIX A - HARDWARE

Power Supply Circuitry

Assembly

Fit and solder all the components listed in Table A-2 into their position as marked on the pcb overlay and as shown in Figure A-8 and Figure A-9.

Table A-2 Power Supply - Bill of Materials.

 

 

Lead Spacing

 

Quantity

Component Description

or Footprint

Designator

2

0.1 ΠF ceramic monolithic capacitor

0.2 inch

C2, 3

2

1ΠF τ 16V tantalum electrolytic capacitor

0.2 inch

C13, 14

1

4700 ΠF, τ16V electrolytic capacitor

RB 0.5 or

C1

 

 

0.35 inch

 

1

1K resistor

¼ W

R94

1

1K8 resistor

¼ W

R52

3

1N4004 diode

 

D1, 2, 10

1

LM7805CT voltage regulator

TO-220

U1

1

LM7809CT voltage regulator

TO-220

U2

1

Power pack; +12V DC, 1A

 

 

3

2 way terminal block

5mm pitch

J2, 9, 10

16

Pcb pin, 0.9 - 1.0 mm diameter

 

 

2

Heatsink 12 θC/W

 

HS1, 2

2

M3 screw 6-10 mm long (or equiv.)

 

 

2

M3 nut

 

 

2

M3 locking washer

 

 

Testing

Figure A-7 shows the schematic diagram for the power supply, excluding the circuitry for generating –8V DC, that is used solely by the DAC and grouped with it. The interface board can be powered by any DC power supply capable of providing voltages in the range from 13V to 18V at currents of 1A or greater. The cheapest means of providing this power is by using a 12V DC powerpack with 1A capacity. The powerpack will usually provide voltages above 12V until current draw becomes excessive (greater than approximately 1A).

APPENDIX A - HARDWARE 441

Figure A-7 Power Supply Circuit – schematic diagram.

The input voltage to both the +5V and +9V voltage regulators should be in the range +12V to +18V (this upper value depends on the powerpack or DC supply used). If not:

Ensure the wiring between the powerpack or DC power supply, and terminal block J2 has the correct polarity.

Check that diode D10 is fitted with correct polarity.

The output voltage of the +5V and +9V regulators should be within +4.75V to +5.25V and +8.55V to +9.45V respectively, due to their voltage tolerances. If this is not the case, check:

Tantalum electrolytic capacitors C13, C14, and diodes D1, D2 are fitted with correct polarity.

Regulators are fitted in the correct orientation as marked on the pcb.

Shortand open-circuits on connecting tracks or around solder joints.

That load resistors R52 and R94 are fitted.

NOTE

Eight pcb pins connected to GND and eight pcb pins connected to +5V are located

adjacent to the power supply’s two-way terminal blocks. These pins have been provided to set input logic levels for circuits, and to facilitate testing of circuits.

442

APPENDIX A - HARDWARE

 

 

 

 

 

 

 

74HC245

 

4046

 

PINS

74HC245

 

 

 

 

 

+5V PINS

 

 

 

 

 

 

 

ADC0804

ULN2803A

4093

 

 

 

74HC157

 

 

LM358

LM358

 

 

 

 

DAC0800

LM358

 

Figure A-8 Power Supply Circuit – component positions.

Figure A-9 Power Supply Circuit – components fitted.

APPENDIX A - HARDWARE 443

Parallel Port Interface

Assembly

Fit and solder all the components listed in Table A-3 into their position as marked on the pcb overlay and as shown in Figure A-11 and Figure A-12.

Table A-3 Parallel Port Interface - Bill of Materials.

 

 

Lead Spacing

 

Quantity

Component Description

or Footprint

Designator

2

0.1 ΠF ceramic monolithic capacitor

0.2 inch

C20, 22

4

470 : resistor

¼ W

R29, 30, 43,

 

 

 

44

16

10K resistor

¼ W

R78 - 93

2

74HC245 CMOS IC

DIL20

U6, 13

2

IC socket

20 pin

 

1

D25 female right angle connector

 

J1

23

Pcb pin, 0.9 - 1.0 mm diameter

 

 

Testing

Figure A-10 shows the schematic diagram for the interface circuitry. The two ‘Buffer’ ICs are used to protect the parallel port of the PC from damage should faults occur on the interface board.

Note: Ensure that both Buffers are fully disconnected from other devices (including the parallel port) prior to testing.

The voltage at the power supply pin of each logic ‘Buffer’ (74HC245, pin 20) should be approximately +5V (the same as that output by the +5V voltage regulator). If this is not the case, check:

Incorrect IC orientation, faulty IC socket connections, short-circuits, open-circuits, a faulty IC, and the +5V internal power supply.

The input pins that control the direction of data flow and enable the output signals must be connected as follows:

DIR input (pin 1) must be at +5V, and EN (pin 19) must be at 0V.

The input data lines to the Buffers have pull-up resistors fitted. This ensures correct interfacing to any TTL logic in the parallel port. The resistors also connect any unused input pins to a high logic state. Inputs not connected to a logic level can cause unpredictable circuit behaviour. These resistors will produce +5V input voltages at each pin when the interface cable to the PC is disconnected. The output data pins from the Buffers should have corresponding high logic levels. The four resistors connected to the D25 connector help protect the BASE+2 interface at the parallel port from damage.

444 APPENDIX A - HARDWARE

Figure A-10 Parallel Port Interface Circuit - schematic diagram.

Disconnect the PC interface cable when testing the following circuitry. Test one data input of the Buffer (74HC245, U13) at a time as follows:

The input data pin (shown as A1, A2, ..., A8) should be at +5V, and therefore, at a high logic state. The corresponding output pin (shown as B1, B2, ..., B8) should be at the same high logic state. Repeat this test for all other input pins.

Connect the input data pin (shown as A1, A2, ..., A8) to GND by first grounding one end of an interconnecting lead. Touch the other end of the lead to that pin’s pull-up resistor lead that is in-line with the pin on the board. The corresponding output pin (B1, B2, ..., B8) should be at the same low logic state. Repeat for all other input data pins.

Test one data input of the Buffer (74HC245, U6) at a time as follows:

Connect one input data pin to GND by first grounding one end of an interconnecting lead and connecting the other end to an input pcb pin. The corresponding output pin should be at the same low logic state. Repeat for all other input data pins.

Swap the lead connection from GND to +5V and connect the other end to apply +5V to an input pcb pin. The corresponding output pin should be at the same high logic state. Repeat for all other input data pins.

If any of the above tests fail, check for:

Incorrect IC orientation, short-circuits, open-circuits and a faulty IC.

APPENDIX A - HARDWARE 445

 

 

 

74HC245

4046

 

PINS

74HC245

 

 

 

+5V PINS

 

 

 

 

 

ADC0804

ULN2803A

4093

 

 

74HC157

 

LM358

LM358

 

 

 

DAC0800

LM358

 

Figure A-11 Parallel Port Interface Circuit - component positions.

Figure A-12 Parallel Port Interface Circuit - components fitted.

446 APPENDIX A - HARDWARE

LED Driver Circuitry

Assembly

Fit and solder all the components listed in Table A-4 into their position as marked on the pcb overlay and as shown in Figure A-14 and Figure A-15.

Table A-4 LED Driver Circuitry - Bill of Materials.

 

 

Lead Spacing

 

Quantity

Component Description

or Footprint

Designator

8

330: resistor

¼ W

R1, ..., R10

 

 

 

(not inclusive)

8

Red LED 3mm diameter body

 

LED1-8

1

ULN2803A transistor array

DIL18

U3

1

IC socket

18 pin

 

8

Pcb pin, 0.9 - 1.0 mm diameter

 

 

Testing

Figure A-13 LED Driver Circuit - schematic diagram.

Figure A-13 shows the schematic diagram of the LED Driver circuitry. This circuit block is ideal for testing logic levels of particular signals read or controlled by software – especially when writing and debugging a program. The circuit comprises one ULN2803A Driver IC along with eight associated resistors and LEDs. The IC contains eight separate darlington transistors, each one used to switch current through an output pin. Connecting logic level signals to the Driver will turn on and off the respective LEDs to indicate their logic state.

Note: assemble and test one series connected LED and resistor first – to check the correct polarity of the LED. Establishing LED polarity is discussed in the earlier section of this appendix titled “The Assembly Process”.

APPENDIX A - HARDWARE 447

The voltage level at the ULN2803A power pin (10) should be +5V. The LED terminals furthest from the resistors should also be at +5V. If this is not so, check:

Incorrect IC orientation, faulty IC socket connections, short-circuits, open-circuits, a faulty IC or LED, and faulty +5V internal power supply.

The ULN2803A Driver operates as follows:

3.When a Driver input pin (D0, D1, …, D7) is taken to a high logic level (use +5V), the corresponding output pin (Q0, Q1, …, Q7) will be switched internally to ground voltage (0V). This will light the corresponding LED as current flows from VCC (+5V), through the LED, resistor and the Driver output pin to its internal ground.

4.When a Driver input is driven to a low logic level (use GND), the corresponding output pin connection to GND will be broken, interrupting current flow through the LED and resistor, extinguishing the LED.

Should any LED fail to light, check:

Incorrect LED polarity, short-circuits, open-circuits and faulty LEDs or resistors.