Файл: Microcontroller Programming. Thi Micro Chip PIC (Julio Sanchez, 2007).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 14.06.2025

Просмотров: 8490

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

614

Appendix A

COLOR

MAGNITUDE

MULTIPLIER

TOLERANCE

Black

0

1

Brown

1

10

1%

Red

2

100

2%

Orange

3

1K

Yellow

4

10K

Green

5

100K

0.5%

Blue

6

1M

0.25%

Violet

7

10M

0.10%

Grey

8

0.05%

White

9

Gold

0.1

5%

Silver

0.01

10%

To read the resistance value first determine if it is a 4-band or a 5-band encoding. Then proceed to identify the tolerance band, which is usually either gold or silver. Starting at the opposite end, read the two or three magnitude bands and multiply this value by the multiplier band. For example, a resistor with four color bands: red, orange, brown, and gold is a 230 Ohm resistor with a 5% error tolerance.

There are several calculators on line that allow you to easily find the resistance value. You can locate these calculators by searching for the keywords: resistor color codes.


Appendix B

Building Your Own Circuit Boards

Several methods have been developed for making printed circuit boards on a small scale, as would be convenient for the experimenter and prototype developer. If you look through the pages of any electronics supply catalog you will find kits and components based on different technologies of various levels of complexity. The method we describe in this appendix is perhaps the simplest one since it does not require a photographic process.

The process consists of the following steps:

1.The circuit diagram is drawn on the PC using a general-purpose or a specialized drawing program.

2.A printout is made of the circuit drawing on photographic paper.

3.The printout is transferred to a copper-clad circuit board blank by ironing over the backside with a household clothes iron.

4.The resulting board is placed in an etching bath that eats away all the copper, except the circuit image ironed onto the board surface.

5.The board is washed of etchant, cleaned, drilled, and the components soldered to it in the conventional manner.

6.Optionally another image can be ironed onto the backside of the board to provide component identification, logos, etc.

The following URL contains detailed information on making your own PCBs :

Http://www.fullnet.com/u/tomg/gooteedr.htm

Drawing the Circuit Diagram

Any computer drawing program serves this purpose. We have used CorelDraw but there are several specialized PCB drawing programs available on the Internet. The following is a circuit board drawing used by us for a PIC flasher circuit described in the text:

615

616

Appendix B

Figure B-1 PIC Flasher Circuit Board Drawing

Note in the drawing that the circuit locations where the components are to be soldered consist of small circular pads, usually called solder pads. The following illustration zooms into the lower corner of the drawing to show the details of the solder pads.

Figure B-2 Detail of Circuit Board Pads

Quite often it is necessary for a circuit line to cross between two standard pads. In this case the pads can be modified so as to allow it. The modified pads are shown in Figure B-3.


Building Your Own Circuit Boards

617

Figure B-3 Modified Circuit Boards Pads

Printing the PCB Diagram

The circuit diagram must be printed using a laser printer. Inkjet toners do not produce an image that resist the action of the etchant. Although in our experiments we used LaserJet printers it is well documented that virtually any laser printer will work. Laser copiers have also been used successfully for creating the PCB circuit image.

With the method we are describing, the width of the traces can become an issue. The traces in the PCB image of Figure B-1 are 2 points, which is 0.027". Traces half that width and less have been used successfully with this method but as the traces become thinner the entire process becomes more critical. For most simple circuits 0.020" traces should be a useful limit. Also be careful not to touch the glossy side of the paper or the printed image with fingers.

Note that the pattern is drawn as if you were looking from the component side of the board.

Transferring the PCB Image

Users of this method state that one of the most critical elements is the paper used in printing the circuit. Pinholes in some papers can degrade the image to the point that the circuit lines (especially if they are very thin) do not etch correctly. Another problem relates to removing the ironed-on paper from the board without damaging the board surface.

Glossy, coated inkjet-printer paper works well. Even better results can be obtained with glossy photo paper. We use a common high-gloss photographic paper available from Staples and sold under the name of "picture paper". The 30 sheets, 8-by-10 size, have the Staples number B031420197 1713. The UPC barcode is: 7 18103 02238 5.


618

Appendix B

Transferring the image onto the board blank is done by applying heat from a common clothes iron, set on the hottest setting, onto the paper/board sandwich. In most irons the hottest setting is labeled “linen.” After going over the back of the paper several times with the hot iron, the paper becomes fused to the copper side of the blank board. The board/paper sandwich is then allowed to soak in water for about

10 minutes, after which the paper can be removed by peeling or light scrubbing with a toothbrush. It has been mentioned that Hewlett-Packard toner cartridges with microfine particles work better than the store-brand toner cartridges.

Etching the Board

Once the paper has been removed and the board washed it is time to prepare the board for etching. The preliminary operations consist of rubbing the copper surface of the board with Scotchbrite plastic abrasive pad and then scrubbing the surface with a paper towel soaked with Acetone solvent.

When the board is rubbed and clean, it is time to etch the circuit. The etching solution contains Ferric Chloride and is available from Radio Shack as a solution and from Jameco Electronics as a powder to be mixed by the user. PCB Ferric Chloride etchant should be handled with rubber gloves and rubber apron since it stains the skin and utensils. Also, concentrated acid fumes from Ferric Chloride solution are toxic and can cause severe burns. These chemicals should be handled according to cautions and warnings posted in the containers.

The Ferric Chloride solution should be stored and used in a plastic or glass container, never metal. Faster etching is accomplished if the etching solution is first warmed by placing the bottle in a tub of hot water. Once the board is in the solution, face up, the container is rocked back and forth. It is also possible to aid in the copper removal by rubbing the surface with a rubber-gloved finger.

Finishing the Board

The etched board should be washed well, first in water and then in Lacquer Thinner or Acetone; either solvent works. It is better to just rub the board surface with a paper towel soaked in the solvent. Keep in mind that most solvents are flammable and explosive, and also toxic.

After the board is clean the mounting holes can be drilled using the solder pads as a guide. A small electric drill at high revolutions, such as a Dremmel tool, works well for this operation. The standard drill size for the mounting holes is 0.035". A #60 drill (0.040") also works well. Once all the holes are drilled, the components can be mounted from the backside and soldered at the pads.

The Backside Image

The component side (backside) of the PCB can be printed with an image of the components to be mounted or with logos or other text. A single-sided blank board has no copper coating on the backside so the image is just ironed on without etching. Probably the best time to print the backside image is after the board has been etched and drilled but before mounting the components.

Building Your Own Circuit Boards

619

Since the image is to be transferred directly to the board, it must be a mirror image of the desired graphics and text. Most drawing programs contain a mirroring transformation so the backside image can be drawn using the component side as a guide, and then mirrored horizontally before ironing it on the backside of the board. Figure B-4 shows the backside image of the sample circuit board, before and after mirroring.

+9-12v

Gnd

C2

C1

O1

R1

L1

L1

R1

1.0

R2

L2

L2

R2

6

Flasher

R3

L5

L5

R3

R9

L3

L3

1

R4

L4

L4

R4

R5

R5

F

Led

R7

R7

4

8

R6

L6

L6

R6

L7

L7

Skipanon

R8

L8

L8

R8

Gnd

+9-12v

O1

C1

C2

1.0

Flasher

R9

1

6

Led

F

4

8

Skipanon

Figure B-4 Graphics and Text for Board Backside Image

Note on the left-side image in Figure B-4 that a lighter copy of the circuit diagram was used to lay out the image of the backside. Once drawn, the backside drawing was mirrored horizontally, as shown in the right-side image.


Appendix C

Mid-range Instruction Set

This Appendix describes the instructions in the PIC mid-range family. Not all instructions are implemented in all devices but all of them work in the specific PICs discussed in the text, that is, the 16F84A and the 16F877.

Table C.1

Mid-range PIC Instruction Set

BITS

MNEMONIC

OPERAND

DESCRIPTION

CYCLES

AFFECTED

BYTE-ORIENTED OPERATIONS:

ADDWF

f,d

Add w and f

1

C,DC,Z

ANDWF

f,d

AND w with f

1

Z

CLRF

f

Clear f

1

Z

CLRW

-

Clear w

1

Z

COMF

f,d

Complement f

1

Z

DECF

f,d

Decrement f

1

Z

DECFSZ

f,d

Decrement, skip if 0

1(2)

-

INCF

f,d

Increment f

1

Z

INCFSZ

f,d

Increment, skip if 0

1(2)

-

IORWF

f,d

Inclusive OR w and f

1

Z

MOVF

f,d

Move f

1

Z

MOVWF

f

Move w to f

1

-

NOP

-

No operation

1

-

RLF

f,d

Rotate left through carry

1

C

RRF

f,d

Rotate right through carry

1

C

SUBWF

f,d

Subtract w from f

1

C,DC,Z

SWAPF

f,d

Swap nibbles in f

1

-

XORWF

BIT-ORIENTED OPERATIONS

BCF

f,b

Bit clear in f

1

-

BSF

f,b

Bit set in f

1

-

BTFSC

f,b

Bit test, skip if clear

1

-

BTFSS

f,b

Bit test, skip if set

1

-

LITERAL AND CONTROL OPERATIONS

ADDLW

k

Add literal and w

1

C,DC,Z

(continues)

621