+ All Categories
Home > Documents > led display

led display

Date post: 28-Apr-2015
Category:
Upload: admer
View: 77 times
Download: 0 times
Share this document with a friend
Description:
led display
9
Constructional Project R ECENTLY Dave Fisher of Display Electronics told EPE that he had acquired several thousand electro- mechanical “big digits”. These had previ- ously graced the platforms of British Rail as 6-digit 7-segment clocks. Yes, they were the familiar “click... click...” digits that surely any would-be passenger has watched mesmerised while waiting for that (where IS it?) train to arrive. In the course of conversation, the question of EPE designing a suitable electronic inter- face for these digits came up. Would Tech Ed be interested? Certainly, was the author’s timely response to a novel design idea. DISPLAY RESULTS The resulting basic design is capable of driving from one to eight digits, with expansion up to 64 digits possible, as dis- cussed later. They can be controlled via a standard 4 × 4 data entry keypad, or via a PC-compatible computer running under MS-DOS or Win95/98/ME. A PIC16F84 microcontroller is the con- trolling device between the PC or keypad and the multiplexed digits. The PC soft- ware is written in QBasic/QuickBASIC but can be run as a standalone program with- out the need for QB to be installed. The digits are ideal for use in any situa- tion that requires a large electronically controlled display where the data is to be input intermittently. Applications that come to mind are sporting scoreboards, ticket draw results, display of outdoor tem- perature in public arenas – well, you’ve seen where large digits can be used, think up your own applications! MONSTERS Since the digits were only large versions of 7-segment displays, reasoned the author before starting the design, they could be simply driven by a PIC through a minimal bit of multiplexing. No problem – or so it seemed until two arrived! The digits are monsters in several sens- es. Overall, they measure 12in high, 9in wide and 2·25in deep (30·5cm × 23cm × 5·5cm). The angled display area is effec- tively 10in high × 7in wide (25·5 × 18cm) and comprises seven bright-yellow hinged segments. In the absence of fully informative data, the first task was to establish some criteria about controlling the display segments. Basically all that was known from a rudi- mentary data sheet was that a pulse of 12V d.c. for about 0·25secs was required to turn segments on and off, and that the pinouts of a built-in connector were shown. There was no mention of the current required, although there was a warning not to con- nect d.c. to the segments for long periods otherwise damage/heating will occur. The original manufacturer’s name was printed on the rear of the digits, Bodet, along with the message Made in France. Doing a www.google.com search revealed the company at www.bodet.com, but no electronic specifications could be located, other than a schematic for one segment (see Fig.1 and Fig.2). An email to Bodet for data produced no response. Time for experiments! Briefly connecting an ammeter between a segment and a 12V power supply revealed the current required to activate the mechanical flap – around 280mA. What?! Surely not? An ohms check across the var- ious controlling coils showed a typical d.c. resistance of 439. Wow, yes indeed, that unscientific test had shown a current figure in the right ball-park! Furthermore, there were seven segments to be controlled – about 2A per digit, and users would probably need several digits. More used to dealing with liquid crystal dis- plays needing only a handful of milliamps, rather than two thousand milliamps, the PIC BIG DIGIT DISPLAY Microcontrolling giant 7-segment displays JOHN BECKER Everyday Practical Electronics, May 2002 325 ON OFF EACH COIL 43 APPROX 0V D1 AND D2 ARE BUILT INTO DIGIT UNIT D1 D2 D3 D4 +12V 1N4001 1N4001 a a a a k k k k OFF A OFF B OFF C OFF D OFF E OFF G OFF F ON A ON B ON C ON D ON E ON F ON G A B C D E F G +12V Fig.1. Basic circuit for controlling one segment. Fig.2. Each digit has 15 connections, 12V power input and two on-off con- trols for each segment.
Transcript
Page 1: led display

RECENTLY Dave Fisher of DisplayElectronics told EPE that he hadacquired several thousand electro-

mechanical “big digits”. These had previ-ously graced the platforms of British Railas 6-digit 7-segment clocks. Yes, they werethe familiar “click... click...” digits thatsurely any would-be passenger haswatched mesmerised while waiting for that(where IS it?) train to arrive.

In the course of conversation, the questionof EPE designing a suitable electronic inter-face for these digits came up. Would TechEd be interested? Certainly, was the author’stimely response to a novel design idea.

The resulting basic design is capable of

driving from one to eight digits, withexpansion up to 64 digits possible, as dis-cussed later. They can be controlled via astandard 4 × 4 data entry keypad, or via aPC-compatible computer running underMS-DOS or Win95/98/ME.

A PIC16F84 microcontroller is the con-trolling device between the PC or keypadand the multiplexed digits. The PC soft-ware is written in QBasic/QuickBASIC butcan be run as a standalone program with-out the need for QB to be installed.

The digits are ideal for use in any situa-tion that requires a large electronicallycontrolled display where the data is to beinput intermittently. Applications that

come to mind are sporting scoreboards,ticket draw results, display of outdoor tem-perature in public arenas – well, you’veseen where large digits can be used, thinkup your own applications!

Since the digits were only large versions

of 7-segment displays, reasoned the authorbefore starting the design, they could besimply driven by a PIC through a minimalbit of multiplexing. No problem – or so itseemed until two arrived!

The digits are monsters in several sens-es. Overall, they measure 12in high, 9inwide and 2·25in deep (30·5cm × 23cm ×5·5cm). The angled display area is effec-tively 10in high × 7in wide (25·5 × 18cm)and comprises seven bright-yellow hingedsegments.

In the absence of fully informative data,the first task was to establish some criteriaabout controlling the display segments.Basically all that was known from a rudi-mentary data sheet was that a pulse of 12Vd.c. for about 0·25secs was required to turnsegments on and off, and that the pinoutsof a built-in connector were shown. Therewas no mention of the current required,although there was a warning not to con-nect d.c. to the segments for long periodsotherwise damage/heating will occur.

The original manufacturer’s name wasprinted on the rear of the digits, Bodet,

along with the message Made in France.Doing a www.google.com search revealedthe company at www.bodet.com, but noelectronic specifications could be located,other than a schematic for one segment(see Fig.1 and Fig.2). An email to Bodetfor data produced no response. Time forexperiments!

Briefly connecting an ammeter betweena segment and a 12V power supplyrevealed the current required to activate themechanical flap – around 280mA. What?!Surely not? An ohms check across the var-ious controlling coils showed a typical d.c.resistance of 43. Wow, yes indeed, thatunscientific test had shown a current figurein the right ball-park!

Furthermore, there were seven segmentsto be controlled – about 2A per digit, andusers would probably need several digits.More used to dealing with liquid crystal dis-plays needing only a handful of milliamps,rather than two thousand milliamps, the

Everyday Practical Electronics, May 2002 325

ON OFF

EACH COIL 43 APPROXΩ

0V

D1 AND D2 ARE BUILTINTO DIGIT UNITD1 D2

D3D4+12V

1N40011N4001

a

a

a

a

k k

kk

OFF A

OFF B

OFF C

OFF D

OFF E

OFF G

OFF F

ON A

ON B

ON C

ON D

ON E

ON F

ON G

A

B

C

D

E

F

G

+12V

Fig.1. Basic circuit for controlling onesegment.

Fig.2. Each digit has 15 connections,12V power input and two on-off con-trols for each segment.

Page 2: led display

author recognised that the digits were morethan just monsters in size.

Having numerous data books and CD-

ROMs is always to be recommended.These days, so is Internet access. Using amixture of sources, a couple of eveningswere spent researching the type of semi-conductors that were available to handlesuch currents in a multiplexed situation. Itwas a foregone conclusion that they need-ed to be capable of being PIC-controlled.

Any idea of using any form of discretetransistor, power-FET or otherwise, wasrejected. Such techniques were fine yearsago, but hardly today’s technology whenmultiplexing – even less so regarding anysuggestion of relay control. No, it had to besemiconductors in integrated circuit form.

Anyone familiar with controlling 4-digit7-segment light emitting diode displays willknow that they can easily be controlled bymultiplexed signals – a common 7-line“bus” feeding identically to all segments ofall digits, and then separate power supplylines, each feeding to its own digit. Thetechnique required then is to send out seg-ment control data along the common bus,and to only turn on digit power lines indi-vidually at the appropriate moment.

However, data sheet browsing suggestedthat switching seven segments simultane-ously at a total of 2A or so could present asignificant problem. Perhaps switchingsegments individually at about 280mAwould be more sensible?

There are many chips that can provide1-of-8 output selection in response to a3-bit control code. Such chips include the74HC138, whose outputs are normally high,but go low individually when selected by theappropriate control code. The 74HC237operates with the opposite output logic, nor-mally low but going high when selected.

Although the outputs of these devicescannot handle the sinking or sourcing of280mA, or a voltage of 12V, they are capa-ble of driving intermediate high-currentbuffers. The question then became one ofwhich buffers were available?

After considerable research, it was

decided to use the 7-stage line driver typeULN2004A to activate the segments. Itcan sink 500mA per stage, and is capableof handling voltages up to 50V.

This device also has the benefit of hav-ing built-in diodes across each outputwhich inhibit back-e.m.f. generation whenswitching inductive loads, such as thesegment coils (see Fig.3).

Do not use any other type of L293device. The L293DN (note the DN suffix),is a 16-pin device with diode protection.Other L293 device types may not have thesame characteristics (the L293E, forinstance, has 20 pins and cannot be used).

A simplified block diagram of the con-

trol requirement is shown in Fig.5.The circuit diagram showing the multi-

plexing and digit drive devices is given inFig.6. Control data originates from aPIC16F84 microcontroller (discussedpresently in relation to Fig.7). Throughmultiplexer IC1, 3-bit control data selectswhich digit is to be powered via sourcedrivers IC2 or IC3.

As shown in Fig.6, and designed on theprinted circuit board to be described later,eight digits (one “bank”) can be controlledby these two drivers. Additional digit sourcedrivers can be added separately if required(on stripboard for example, although noconstructional details on this are offered).

If fewer that five digits are to be con-trolled, IC3 can be omitted.

The eight outputs of IC1 are common toall digit drivers, and IC1 does not need tobe repeated if additional banks of driversare added.

The software allows two additionalbanks of eight digits (a total of 24 digits) tobe controlled without modification to theprogram. Readers who are familiar withPIC and QB programming could modifythe software to cope with multiplexing upto 64 digits if an additional 74HC237 mul-tiplexer is used (see later).

Segment selection is provided by a 3-bitcode fed to multiplexers IC4 and IC5.These in turn control segment sink driversIC6 and IC7, respectively. Only seven out-puts of these multiplexers are used.

The two multiplexers are under “chipselect” (CS) control by separate CS1 lines(pins 6), so that segment On or Off controlis achieved not only in respect of the 3-bitcode, but also in terms of current-sinkingpulse duration (more later).

326 Everyday Practical Electronics, May 2002

It is a bipolar-fabricated Darlingtondevice that requires a positive voltage ateach input to turn on the respective open-collector output. Conveniently, each inputhas its own 10·5k series resistor, remov-ing the need for external resistors (such asrequired in the control line feeding into thebase of a “normal” discrete transistor). Theinputs are also diode-protected.

Using a 74HC237 multiplexer, the sevensegments can readily be controlled direct-ly through the ULN2004A driver.

That took care of current sinking

through the segments. The problem thenbecame that of providing multiplexedpower to each digit. If you relate the con-cept to a common-anode 7-segment l.e.d.matrix, the individual segment cathodeshad now been catered for – it was the com-mon-anode current control that was nowrequired. In other words, a current sourcewas needed, at a minimum of 280mA.

It had been expected that as multiplehigh-current sinking paths were availablein one i.c., as with the ULN2004A, so mul-tiple high current sourcing devices wouldbe equally common.

It was found that there were manyoptions available if a source current of nomore than 100mA were required, especial-ly as the current would be pulsed intermit-tently. However, the requirement for atleast 280mA presented a seeminglyunsolvable problem, unless discrete tran-sistors were used – which the author wasdetermined not to resort to. Quite simply,no ideal i.c. devices could be found.

Briefly, power op.amps such as theL272 dual device seemed a possible solu-tion, but that was not deemed “tidy”!Eventually, it was decided to accept a less-than-optimum option, to use an L293DNquadruple Half-H driver.

This has four devices that can each be setto sink or source a current of up to 1A at avoltage from 4·5V to 36V. It also has twoenable inputs which allow pairs of drivers tohave their outputs placed into a high-imped-ance state (see Fig.4). Additionally, it toohas in-built diode protection.

The device is intended for reversiblemotor and solenoid control. The term Half-H refers to the bridge configuration in whichthe pairs of drivers can be operated. Itseemed suitable for this application since noother appropriate device format could befound. Consequently, two L293DN devicesare used in the main circuit, each providingpower for four multiplexed digits. They areunder combined control of another74HC237 1-of-8 controller.

The L293DN,however, has theunfortunate sideeffect of consumingaround 20mA evenwhen the outputs arein a high impedancestate. The “enable”inputs do not placethe device into a qui-escent state in high-impedance mode,unlike many logicdevices that you maybe familiar with.Regrettably, it is notcheap.

bc

e bc

e

10k5

3k7k2

ak

a

k

a k

INPUT

OUTPUT

E

COMULN2004A

Fig.3. Schematic of one stage within a ULN 2004A 7-stageline driver.

H = HIGHL = LOWX = IRRELEVANTZ = HIGH-IMPEDANCE

OUTPUT (OFF)

INPUTS OUTPUT

A

H

H

HH

L

L

L

X

EN Y

Z

1A

2A

1Y

2Y

3Y

4Y

3A

4A

1,2 EN

3,4 EN

2

1

7

10

9

15

3

6

11

14

Fig.4. L293DN pinouts and logic table.

SELECT BANK 1

SELECT BANK 2

SELECT BANK 3

3-BIT CODE

3-BIT CODE

2-BIT CODE SELECT SEGMENT ON/OFF

SELECTDIGIT

SELECTSEGMENT

8-BIT CODE

7-BIT CODE

+12V POWERCONTROL

7-SEGMENTDIGIT

DIGITS

Fig.5. Multiplexed control logic.

Page 3: led display

Because of the multiplexing arrange-

ment, a PIC16F84 microcontroller is read-ily suitable for this design, see Fig.7. It iscapable of being user-controlled either viaa 16-key (4 × 4) data entry keypad, or via aPC-compatible computer, running underMS-DOS or Win95/98/ME.

The PIC is run at 4MHz, as set by crys-tal X1. Port pins RB0 to RB2 control digitselection via IC1 (Fig.6), pins RB4 to RB6control segment selection via IC4 and IC5,RB7 controls selection of IC4 (segment Oncontrol), and RB3 controls selection of IC5(segment Off control).

Port pins RA0 to RA2 perform “bank”selection. As shown, they can control upto three banks of eight digits. If they areused to control another 74HC237 1-of-8multiplexer, however, they could controleight banks (with suitable softwaremodification).

Port B pins are also used for inputtingdata from a 16-key keypad, or from a PC.Note that it is unwise to connect a keypadand PC simultaneously since one mightadversely affect the other. The PIC itself isprotected against its Port B pins beingundesirably affected by external PC/key-pad control by the inclusion of buffer resis-tors R1 to R8.

Pins RA3 and RB7 are used by the soft-ware to achieve “handshaking” with the PCwhen the unit is under computer control.

Pin RA4 is used in a manner possiblynot seen by readers before. It is used inoscillatory mode under software controland at a rate set by preset VR1 and capaci-tor C5. It allows the segment control pulsewidth to be varied. The controlling soft-ware routine will be discussed towards theend of this article.

As usual with the author’s PIC designs,on-board programming can be performedvia a 4-pin connection (TB1). Adverse

effects on the +5V power line are prevent-ed during programming control by theinclusion of resistor R9 and diode D1.

Power for the digits needs to be 12V d.c.

This may be provided from any sourcecapable of supplying at least 500mA (toprovide “headroom” when a segment isactivated). It does not need to be stabilised.A 12V car battery is suitable.

The prototype was found to operate witha supply voltage as low as 9V (with resul-tant reduction in current consumption).

Whilst the 13·5V (or so) of a fullycharged battery seems acceptable, it wouldappear to be unwise to allow the supply tosignificantly exceed this voltage. The volt-age, current and pulse duration limits forthe digits are not known since Bodet didnot respond to the author’s request forinformation.

The digital control i.c.s require to bepowered at +5V d.c. (which must not beexceeded). This is provided from the 12Vline via regulator IC9, which can supply upto 100mA of sustained current. Be aware,though, that on the prototype it was

Everyday Practical Electronics, May 2002 327

1

1

2

2

3

3

4

4

5

5

6

6

7

7

8

8

9

9

10

10

11

11

12

12

13

13

14

14

15

15

16

16

EN1/2

EN1/2

EN3/4

EN3/4

L293DN

L293DN

VCC1

VCC1

VCC2

VCC2

1

1

2

2

3

3

6

6

7

7

8

8

9

9

10

10

11

11

14

14

15

15

16

16

x 4

x 4

IC2

IC3

GND

GND

4,5,12,13

4,5,12,13

DIGIT 1 +12V

DIGIT 2 +12V

DIGIT 3 +12V

DIGIT 4 +12V

DIGIT 5 +12V

DIGIT 6 +12V

DIGIT 7 +12V

DIGIT 8 +12V

ALL BANKS

ALL BANKS

Y0Y0

Y0

Y1Y1

Y1

Y2Y2

Y2

Y3Y3

Y3

Y4Y4

Y4

Y5Y5

Y5

Y6Y6

Y6

Y7Y7

Y7

CS1CS1

CS1

A0A0

A0

A1A1

A1

A2A2

A2

LELE

LE

CS2CS2

CS2

+VE+VE

+VE

GNDGND

GND

11

1

22

2

33

3

44

4

55

5

66

6

77

7

88

8

99

9

1010

10

1111

11

1212

12

1313

13

1414

14

1515

15

1616

16

74HC23774HC237

74HC237

IC4IC1

IC5

ON A

ON B

ON C

ON D

ON E

ON F

ON G

OFF A

OFF B

OFF C

OFF D

OFF E

OFF F

OFF G

INT.

INT.

DIODE

DIODE

ULN2004A

ULN2004A

IC6

IC7

RB0

RB1

RB2

SELECTDIGIT

FROM IC8

BANK SELECTRA0 FOR BANK 1RA1 FOR BANK 2RA2 FOR BANK 3

RB7

RB3

RB5

RB6

RB7

ON/OFFFROM IC8

SEGMENTSELECT

FROM IC8

1 2 3 4 5 6 7 8

DIGIT POWER CONTROLTO IC2/IC3 OF OTHER BANKS

NC

NC

a

a

k

k

0V

+12V +12V

+5V +5V

x 7

b

b

c

c

e

e

Fig.6. Circuit diagram for the multiplexed control of the digits, basically for eight, but can be modified to control 64 digits.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

OSC1/CLK IN

OSC2/CLK OUT

RA0

RA1

RA2

RA3

TOCKI/RA4

INT/RB0

RB1

RB2

RB3

RB4

RB5

CLK/RB6

DI0/RB7

GND

+VE

IC8PIC16F84

IC1 PIN 1

IC1 PIN 2

IC1 PIN 3

IC5 PIN 6

IC4/5 PIN 1

IC4/5 PIN 2

IC4/5 PIN 3

IC4 PIN 6

SELECTDIGIT

SEGMENT OFF

SELECTSEGMENT

SEGMENT ON

IC2/3 PINS 1/9 BANK 1

IC2/3 PINS 1/9 BANK 2

IC2/3 PINS 1/9 BANK 3

PC HANDSHAKE (SK1 "ERROR")

MCLR

0V MCLR DATA CLK

78L05IC9

VR1100k PULSE

LENGTH

10p

10p

C3

C4

4MHzX1

R91k

C2,C6,C7

100n100nC1

IN OUT

COM

+12V

0V

+5V

+12V

100nC5

1N4148D1

0V

R1 TO R81k

1102

23

34

45

56

67

78 9

GNDPIN

TO 4 x 4 MATRIX KEYPAD

TB1

a k

*SEE TEXT

*

ORPC PARALLEL PORT DATA (DA) PINS

Fig.7. Circuit diagram showing the PIC16F84 control connections, plus power supply.

Page 4: led display

required to constantly provide around40mA (due to the two L293DN devices). Itis thus likely to get a bit warm, especiallyif the source power is 12V or greater.

If it is found to shut down through exces-sive heat (it is thermally regulated), change itto a standard 7805 +5V 1A device. It is per-haps prudent to switch off power during longperiods of digit inactivity.

Note that the digits themselves only con-sume power during the brief pulse thatchanges their segment display position.

Capacitors C1, C2, C6 and C7 help tomaintain powerline stability.

Printed circuit board component and

track layout details are shown in Fig.8.This board is available from the EPE PCBService, code 341.

Assemble in order of link wires first,including the one marked “Bank 1 Link” –this will be discussed under “Expansion”.Note that some links go under the i.c.

positions. Follow with the d.i.l. (dual-in-line) i.c. sockets and then continue in anyconvenient order. Insert 1mm terminal pinsat the external connection points, but omitthose alongside IC1 which are only neededif more than eight digits are to becontrolled.

There are two choices of data input, assaid earlier. They are connected to theboard at the pins to the left of resistors R1to R8.

If using the data entry keypad, connectits pins, as shown in Fig.9, to the similarlynumbered points on the board. Keyboard

328 Everyday Practical Electronics, May 2002

ResistorsR1 to R9 1k (9 off)

All 0·25W 5% carbon film

PotentiometerVR1 100k min.

preset,round

CapacitorsC1, C2,

C5 to C7 100n ceramic, 0·2in pitch(5 off)

C3, C4 10p ceramic, 0·2in pitch (2 off)

SemiconductorsIC1, IC4,

IC5 74HC237 1-to-8multiplexer (see text)(3 off)

IC2, IC3 L293DN 16-pin Half-Hdriver (see text) (2 off)

IC6, IC7 ULN2004A 7-wayDarlington line driver (see text) (2 off)

IC8 PIC16F84microcontroller,preprogrammed(see text)

IC9 78L05 +5V 100mA (or7805 +5V 1A) regulator (see text)

MiscellaneousX1 4MHz crystal

Printed circuit board, available fromthe EPE PCB Service, code 341; RW4410-inch 7-segment electromechanicaldisplay (big digit), quantity to suit (seetext); 4 × 4 data entry keypad (optional –see text); stranded colour-coded con-necting wire (individual wires or ribboncable); 12V d.c. power source, min.500mA output; 1mm terminal pins or pinheaders; 16-pin d.i.l. socket (7 off, seetext); 18-pin d.i.l. socket; printer port con-nectors to suit (optional – see text); sol-der, etc.

SeeSSHHOOPPTTAALLKKppaaggee

3.1IN (78.7mm)

4.0I

N (

101.

6mm

)

A ON

ERROR LINE SK1

SEGMENTS

B ON(RA1)

(RA2)BANK 3 CTLBANK 2 CTL

KBD1/DA0KBD2/DA1KBD3/DA2KBD4/DA3KBD5/DA4

KBD6/DA5KBD7/DA6KBD8/DA7

KBD9/0V

0V

0V

+5V

1 2 3 4 5 6 7 8

+12V TO DIGITS

TO IC2/3 OFOTHER BANKS

+12V+12V

C OND ONE ONF ONG ON

A OFF

B OFFC OFFD OFFE OFFF OFFG OFF

IC8

IC4

IC6

IC5

IC7

IC2

IC1

IC3

IC9OUT COM

IN

1

2

345

678

D1

R9

C4 C3

X1

C7

C1

C2

C6

C5

VR1

TB1

R1R2R3

R4R5

R6

R7

R8

a

k

BANK 1LINK

X

Y

0VCLK RB6

DATA RB7

MCLR

Fig.8. Component layout and full-size underside copper foil master track pattern.

Approx. CostGuidance Only ££2200

excluding hardware

341

Page 5: led display

pin 9 is a ground (0V) connection for thepad’s frame.

If using a PC as the data source, it needsto be connected from its parallel printerport to the board. The easiest way is to usea standard printer cable with pre-attachedconnectors. The “printer end” of the cablehas a 36-way male D-type Centronics con-nector which requires a matching femaletype at the unit end. The latter should behardwired to the board at the designatedpoints using short lengths of insulatedstranded wire. The pinouts for a right-angled female connector are shown inFig.10.

Alternatively, the unit can be hardwiredto a separate 25-way D-type male connec-tor plugged into the back of the computer– 10-way ribbon cable would be ideal. Theconnector’s pinouts are shown in Fig.11.Note that the “Error” line connects to theboard pin situated near IC8. (“Error” is thename given in respect of that line’s normalpurpose when interfaced to a printer.)

Before inserting the d.i.l. i.c.s, do a thor-ough examination of the board for faultyassembly and soldering. Then only insertthem after you have established that regu-lator IC9 is correctly supplying +5V at itsoutput. Check this again once the i.c.s have

been inserted.Be aware that they

are CMOS devicesand require the nor-mal handling precau-tions, discharging sta-tic electricity fromyour body by touch-ing the bare metal ofsomething earthedbefore handling them.

Adjust preset VR1to a fully-clockwisesetting (maximumpulse length) beforetesting the system.

Monstrous is again a term that can be

used in respect of the digit connectionrequirements. The digits need to be wiredin parallel back to the control board.However, although the manufacturers haveprovided a single connector on each digit,this only allows for one set of the 15 con-nection wires needed.

One would have expected two connec-tors, one for the cable harness arrivingfrom the control board, another for the har-ness that then has to be connected to thenext digit.

The author offers no recommendationsabout using the digit’s own connector,although for the sake of good order, itspinouts are shown in Fig.12.

It was decided that it was easier to hard-wire the connections to solder pads at var-ious positions on the back of the digits.They are the pads to which the manufac-turer’s rectifier diodes (mounted inside thedigit box) are soldered. The correct con-nection points were found experimentallyand are shown in Fig.13. Ignore the unusedpads.

Whereas the 14 segment wires of eachharness are connected in parallel to eachdigit, each digit needs its own separate+12V power supply wire, originating fromthe control unit p.c.b. as shown in Fig.8.Make the +12V connections in numericalorder in relation to the digit positions inthe proposed display.

Before you fully interwire the digits,though, it is recommended that you justwire-up for the first one and check out thesystem.

Everyday Practical Electronics, May 2002 329

Prototype display controller board during development testing using a plug-inbreadboard to temporarily connect a data keypad and a PC via a Centronics con-nector (mounted on the p.c.b. used with Teach-In 2000 Part 4 – Feb ’00).

1

1

1

2

2

2

3

3

3

44

4

55

5

66

67

7 78

8

89

9

0

A

B

C

D

PIN 9 - CONNECT TO 0V

REAR VIEW

TOP

TOP

A) B)

DA0DA1

DA2DA3

DA4

DA5DA6

DA7

IC8 RA3(ERROR)

HANDSHAKE

0V

36

18

19

1

SK1

UNDERSIDE VIEW LOOKING AT PINS

Fig.9. Keypad connection details.

Fig.10. Connections to a 36-way D-type Centronics femaleconnector used in conjunction with a standard PC parallelport cable.

15

16

1

2

ARROW ON CONNECTORDENOTES PIN 1

VIEW LOOKING INTO 16-WAY CONNECTOR

A ON

B ON

C ON

D ON

E ON

F ON

G ON

A OFF

B OFF

C OFF

D OFF

E OFF

F OFF

G OFF

NCNC1

23456789

10111213141516

PIN FUNCTION

Fig.12. Pinouts for the connectormounted as part of the digit assembly.

GND ERROR

13

25

1

15

D7D6

D5D4

D3D2

D1D0

VIEWED FROM REAR OF SOCKET PLUGGED INTO COMPUTER PARALLEL PORT

Fig.11. Alternative connections via a 25-way male D-typeconnector.

Page 6: led display

The software has been written so that on

power being switched on the PIC sets itsPort B for input with the input pull-upresistors active. A check is then made tosee if the inputs are connected to anysource that pulls them low.

Under keypad control (with no keyspressed) there is nothing to pull the pinslow and so the PIC assumes that a keypadis the data entry source.

Having established that fact, the soft-ware goes into a perpetual loop scanningthe keypad for keypresses. The softwareroutine used is a variant of that described inthe author’s Using PICs with Keypads ofJan ’01.

In response to any keypresses, look-uptables are used to relate that input value tothe data to be sent to the digits. The firsttable (VALUE) allocates the keypress datato a numerical value between 0 and 15.Another table (TABLE) then relates thatvalue to a binary sequence in respect of thedigit segments to be turned on.

The sequence is in the right-to-left order(bit 0 to bit 7) of segment A to segment G.For example, binary 01111111 turns on allsegments, resulting in the 7-segment dis-play of numeral 8. Binary 00000110, onthe other hand, only turns on segments Band C, resulting in numeral 1 being dis-played. The full table is shown in Listing 1.

TABLE:addwf PCL,Fretlw %00111111 ; 0retlw %00000110 ; 1retlw %01011011 ; 2retlw %01001111 ; 3retlw %01100110 ; 4retlw %01101101 ; 5retlw %01111101 ; 6retlw %00000111 ; 7retlw %01111111 ; 8retlw %01100111 ; 9retlw %01110111 ; 10 Aretlw %01111100 ; 11 bretlw %00111001 ; 12 Cretlw %01011110 ; 13 dretlw %10000000 ; 14 blankretlw %01000000 ; 15 -

GFEDCBA

Note that bit 7 in the 14th jump is set at1. This prevents the PIC from returning azero value from this location, which wouldotherwise be recognised as “no dataentered from keypad”.

Whilst it is suggested that decimal dis-play values from 0 to 9 are retained, othersegment arrangements could be providedfor the other six positions by readers hav-ing their own PIC assembly-programmingfacilities, such as the author’s ToolkitMk3/TK3 (Oct/Nov ’01).

It is also worth recognising that 7-seg-ment displays cannot in many instances beused to represent alphabet characters. Forexample, capital letter A can be represent-ed, but lower case a cannot. Conversely, bcan be, but B cannot (it would just look likean 8).

Also note that any letters having diago-nals cannot be represented, such as K, M,N, Z, nor can T. It is worth experimentingto see what characters can be represented,and what compromises you might have to

make. You may recall that the author’sTeach-In 2000 series demonstration soft-ware illustrated the principle of 7-segmentcontrol.

Having established the segment coderequired, the PIC then has to send the cor-responding data to the segments individu-ally. From within a loop, the PIC readseach data bit position to see whether a seg-ment should be On or Off. At each positionit uses another look-up table (TABLE2 –see Listing 2) for the code needed to sendto multiplexers IC4 and IC5 in order tocontrol that bit.

The code also takes into account that thep.c.b. tracks are connected to the three con-trol pins in the opposite order than mightnormally be expected (this was done forp.c.b. design simplicity). Only bits 6 to 4are of importance in this table.

TABLE2:addwf PCL,Fretlw %01000000 ; aretlw %00100000 ; bretlw %01100000 ; cretlw %00010000 ; dretlw %01010000 ; eretlw %00110000 ; fretlw %01110000 ; gretlw %00000000 ; -

The code is output on the 3-line com-mon bus feeding to IC4 and IC5. Which ofthese i.c.s is activated depends on whetherthe segment needs to be turned on or turnedoff. To turn on IC4 (segment On), bit 7 inthe code is set high. If IC5 is required (seg-ment Off) bit 3 is set high.

330 Everyday Practical Electronics, May 2002

FROMSEGMENTCONTROLI.C.s

A ON

A ON

B ON

B ON

C ONC ON

D OND ON

E ONE ON

F ONF ON

G ONG ON

A OFF

A OFF

B OFF

B OFF

C OFFC OFF

D OFFD OFF

E OFFE OFF

F OFFF OFF

G OFFG OFF TO

OTHERDIGITS

IGNORE UNMARKEDCONNECTION POINTS

+12VFROM SELECTED

POWER CONTROL I.C.

ON FROMIC6

OFF FROMIC7

CONNECTOR

Fig.13. Wiring details for a single digit.

Interwiring between the two digits used during development.

Page 7: led display

It is also necessary to specify which ofthe digits is the target for the segmentinformation. This data is set into the code’sbits 0 to 2, representing the number (1 to 8)of the digit in the allocated bank, and des-tined for IC1 (see Fig.6).

Because the digits might be locatedaway from the controlling keypad, and notbe visible to the user, it was decided toallocate two keypad keys as digit steppingcontrols. At switch-on digit 1 is the defaulttarget, and any numeric data keyed in con-tinues to be routed to it.

To choose Digit 2 instead, press keypad“D” (Digit step). This changes the controlcode fed to IC1, incrementing it frombinary 000 to binary 001, so selecting digit2. Display data is now repeatedly fed tothis digit. Pressing “D” repeatedly stepsthrough each digit position in turn, irre-spective of whether the digit physicallyexists in the system.

To return to Digit 1 at any time press “C”(Clear back to start). It is not possible to stepback individually from digit to digit. This,though, is a facility for which PIC-wise userscould write a software routine. In this case itis suggested that key “B” is intercepted(Backwards) in a similar way to which letters“C” and “D” are intercepted.

Each time the digit number is stepped for-ward, the software increments a 24-valuecounter (rolling over to 1 again following24). This not only provides information onwhich digit is selected (from 1 to 8), but alsoon which Bank it is in (Bank 0 to 2), usingyet another look-up table. This results in PortA pins RA0, RA1 or RA2 being selected asappropriate (in Bank order).

Referring back to Fig.6 again, it will beseen that IC2 and IC3 are shown to be underselection control by pin RA0. If additionalIC2 and IC3 devices are used they would beallocated to one of the other Port A pins,RA1 or RA2, in that order of Bank.

In this way, 24 digits can be steppedthrough by pressing key “D” the requirednumber of times. Yes, it tests the user’scounting ability, but seemed the best solu-tion considering the limited number ofkeys available.

The provision of monitoring via analphanumeric liquid crystal display wasconsidered, but was rejected on thegrounds of adding complexity to a moder-ately simple design.

PIC-knowledgeable readers could prob-ably add l.c.d. facilities if needed. Thereare numerous examples of l.c.d. control inmany of the published EPE PIC projects(especially in the author’s designs). Such aroutine could be integrated almost as a“library” file.

It is suggested that l.c.d. control is basi-cally via Port B with the exception of thel.c.d. E line, which is better suited to con-trol by the otherwise unused pin RA3 (it isonly used when under PC control).

Line E cannot be satisfactorily con-trolled by Port B as all pins are in use forother purposes, which would cause unde-sirable l.c.d. response. It is only Line E thatis critical in this context.

When under computer control, data is

fed to the PIC via the same connections as

the keypad (but preferably in the keypad’sabsence). It is in a different coding formatto that used with the keypad, however.

Because of the full range of keys on aPC keyboard, is it is possible to send amuch greater variety of data to the digits.On recognition by the PIC that a PC is con-nected to it (see earlier), it goes into a dif-ferent monitoring routine (COMPROG).

Synchronisation between the PIC andPC is maintained by using two handshakelines at the PIC end of the system, pinsRA3 and RA7 as mentioned earlier. Port Bpull-up resistors are turned off in thismode.

The first significant handshake actionthe PIC takes following switch on for PCmode, is to set pin RA3 high. This indi-cates to the PC that the PIC is ready toreceive data. The PIC then sits in a holdingloop until acknowledgement from the PC isreceived.

The PC software in its turn holds itsprinter port output DA7 low and waits forthe RA3 = high signal to arrive via itsprinter port “Error” line. Having receivedthis signal, however, it takes no immediateaction, but waits for a keyboard key to bepressed.

Having received a keypress, the PCrelates it to a lengthy look-up table thatholds segment data in respect of keypress-es. If segment data has been allocated tothat key, it is output as seven bits (samerelationship as with keypad data) plus bit 7set high. It then remains in another holdingloop until the “Error” line goes low.

The PIC, recognising that its RB7 pinhas gone high, accepts the incoming 7-bitsof RB0-RB6 data as valid. It immediatelyacknowledges this to the PC by setting lineRA3 low.

The PC, having accepted this acknowl-edgement, is now free to wait for anotherkeypress, but will not send it until the PICsignals that it is ready.

Between accepting bytes of data, thePIC sends the segment data serially to theselected digit in a similar fashion to thatdescribed earlier. On completion of eachdigit’s output, the PIC again sets hand-shake line RA3 high, asking for more PCdata.

The PC program has been written so thatit can be set to the exact number of digits inuse, unlike the keypad software whichalways expects 24digits. It also providesthe facility to selectwhich printer portregister address isused.

On running theprogram, the screenshown in Fig.14a willbe displayed. Thethree possible printerport registers address-es are displayed at thetop. It is necessary toselect the one appro-priate to your PC’sconfiguration. Mostlikely it will beaddress 378 hex, butcould be hex 278 or3BC. Select the

address by pressing 0, 1 or 2 (pressing anyother key, including <ENTER>, alwaysselects 0, i.e. address 378).

If you do not know which address yourPC uses, try all three. The system willshow you have the correct one when itproves that it can send data to the displays.(The PIC board must be free of assemblyerrors of course!)

Having selected the register, the screenchanges to that in Fig.14b. Underneath themain title you are asked to enter the num-ber of digits that you wish to be controlled,with a range of 1 to 24. Values outside thisrange are not accepted.

At the bottom of the screen are dis-played the characters which can be sent fordisplay via the 7-segment digits. With theexception of the control keys mentionednext, this represents the full range of keysthat are functional. Any others will beignored by the program (although you canadd to the range as discussed later).

To either side of the screen are quotedthe commands available when the programis in full control mode. The <ESC>(escape) key causes the program to restartfrom its beginning and may be used at anytime. Pressing the <CTRL> and <BRK>keys simultaneously causes the program toend. This is the only way in which it can behalted and exited.

Otherwise, all keyboard charactersshown in the bottom line are available foroutput to the digits. Acceptable keypressesare responded to immediately, and data isoutput to the digits in sequence, the PIC’sdigit count being incremented followingreceipt of each character. When the finaldigit in the sequence has been triggered,the count automatically recommences fromDigit 1.

When entering data for output to the dig-its, pressing <ENTER> causes the PIC toreset the digit count back to Digit 1.Pressing the space bar causes the next digitto be cleared (no segments showing).

In the mid-screen area you are told that

you should switch on the PIC unit “now”.As said earlier, when the PIC program isfirst switched on, the PIC examines Port Bto see whether its pins are high or low. Ifhigh, keypad control is assumed. On run-ning the PC program, however, its firstactivity is to set its printer port lines low.On reading Port B being low, the PICknows that PC control is required.

Everyday Practical Electronics, May 2002 331

Fig.14. Sections of Big Digit PC program setup screens, (a)printer port selection, (b) digit quantity selections.

Page 8: led display

Consequently, do not switch on the PICunit until you see the screen now being dis-cussed. When you have switched on thePIC, then enter the number of digits to becontrolled and press <ENTER>.

The program then enters its full opera-tional mode, first drawing on screen thesame number of boxes as the number ofdigits specified. These boxes represent the7-segment digits and display the samecharacters.

Next the program sends data for numer-al 8 to all digits required. It then sends areset command to the PIC, resetting it forDigit 1, after which it sends data to clear allrequired digits, again followed by a resetcommand.

This action has three functions, to syn-chronise the PIC with the computer’sorder of digits, to prime the PIC so that itknows which segments are in which state,and thirdly to clear any existing displaydata.

In the latter context it is worth recog-nising that the segments can be set byhand without damaging them. They areonly balanced on light-duty pivots, freelyresponding to the electromagnetic fieldsgenerated by their coils. It is quite possi-ble that someone could have set them byhand to random positions. (In a “field”situation, it is advisable to enclose thedigits to prevent this happening – and ofcourse to protect them from the“elements”.)

From this point onwards, pressing anyrecognised key causes the data to be dis-played sequentially, with the count return-ing to zero (Digit 1) after the final digit (oron pressing <ENTER> as describedearlier). An example PC screen display isshown in Fig.15.

Because of the greater variety of seg-

ment codes that can be generated via thePC than with the keypad, there is theoption to program the PC software withany segment combination required.

The data is held in a look-up tablewhich can be added to by readers whohave QBasic or QuickBASIC resident ontheir PC. The data is held as in the formatextract example shown in Listing 3, in thebit order of segments ABCDEFG (theopposite order used by the PIC software’stable).

DATA 01111110DATA 10110000DATA 21101101DATA C1001110DATA c0001101DATA D0000000DATA d0111101DATA K0000000DATA k0000000DATA “ 0000000”DATA “^1100011”

When the programis started, all datastatements are “Read”

and analysed. The first character in eachdata string holds the keyboard characterthat represents the following 7-bit segmentdata. Its ASCII value is taken and theremaining seven bits in the data are storedin a string array, seg$(x), at the addresscorresponding to the ASCII value.

For example, in the first case,“01111110”, the leading “0” is the firstcharacter. Its ASCII value is 48 and so therest of the data string (“1111110”) is storedat string array position seg$(48). In thefourth case, “C” is the character, having theASCII value 67, so its 7-bit string data isstored at seg$(67).

Note that some data statements have hadto be enclosed in quotes so that the pro-gram recognises the associated charactercorrectly (the last character in the abovelist cause the “degrees” symbol to be dis-played when the “^” is pressed (as in20oC). The one before it is for the space bar(turns off all segments in a digit).

You will see instances where the charac-ter may be in upper or lower case, and insome cases both. If the value following thecharacter contains one or more “1”s, theequivalent character can be generated on a7-segment display. In the other cases, allzeros, the character cannot be formedusing a 7-segment display.

If a character is not included in the table,a value of zero is returned if its key ispressed. All unacceptable keypresses areignored.

For such “unacceptable” keys, however, a

segment or PIC control code can be allocat-ed separately. For instance, the program allo-cates the code “00000001” when the<ENTER> key (ASCII 13) is pressed. ThePIC has been programed to recognise this bitcombination as the command to reset thedigit number count to Digit 1, in a similarway to that in which it responds when the“D” key on the 4 × 4 data keypad is pressed.

You could, for example, allocate specif-ic codes for the PC’s forwards/backwardscursor keys. The PIC could then be told tostep the digit count value backwards orforwards without causing the display datato change. Then, on pressing another key,its character would be displayed at the newdigit address.

Such a facility would be of help in a dis-play having many digits and where onlyone or two might need to be changed at anytime. This would remove the need to key indata for all digits in the full display whenonly a few might need changing.

Another option open to those who arefamiliar with QB programming is to writea code routine that allows a string of char-acters to be entered via the keyboard as asentence (using INPUT instead ofINKEY$). This would not be transmittedto the PIC until the <ENTER> key hadbeen pressed. Each character would thenbe sent automatically in sequence to suc-cessive digits as required.

So far the discussion has assumed that

the length of the control pulse that activatesthe segment coils is correct. Setting presetVR1 earlier to a fully clockwise positionsets the length to the maximum designlimit. It is likely that the pulse can be short-ened, so speeding segment changes.

The simple data sheet received indicatedthat a pulse length of about 0·25 secondswas required. Experiments with the digitsshowed that it could be much shorter.Although there was a slight variation inminimum operational pulse length for thevarious segments, the requirements weretypically found to be about 70 millisec-onds, but cannot be guaranteed in otherassemblies (hence the need for user-adjust-ment rather than specifying the length asan accurate timing within the software).

A 70ms pulse length is generated withpreset VR1 at a roughly midway setting.The maximum pulse length that can be setis about twice that. These figures are basedon the PIC being run at 4MHz.

Once you have ascertained the correctresponse of the segments using a longpulse set via VR1, it is worth experiment-ing to find the lowest VR1 setting at whichthe segments will respond. This will speedthe rate at which the displays can bechanged.

The digits will not respond if the resis-tance is set too low. An intermediate stagemay also be found in which some digitsrespond but not others. Avoid setting VR1to a nil resistance position which will over-load RA4 when it is in output-low mode(the PIC is internally protected againstbrief overloads – but do not sustain thiscondition).

It is worth noting that the software hasalso been written to speed segmentchanging. The status of each segment isrecorded in the PIC’s memory. When a newcharacter is to be displayed on a particulardigit, the digit’s current segment status ischecked against the segment requirementfor the new character. If any segmentsmatch, they are ignored by the output rou-tine, so saving one pulse duration – whichcan be a significant saving when manydigits are in use.

This now brings us to a software/hard-

ware aspect that has not been used beforein an EPE project – analogue control offrequency via a digital input.

You are no doubt familiar with the typeof circuit in which a single Schmitt triggerinverter is used with a resistor and capaci-tor in order to generate a frequency (an RCoscillator). The technique used in Big Digitis similar.

The PIC16F84 has a Schmitt triggerinput, pin RA4. Referring to Fig.7, the

Fig.15. Example of PC screen duringdigit control.

332 Everyday Practical Electronics, May 2002

Page 9: led display

resistance is provided by preset VR1, andthe capacitance by C5. Initially softwaresets RA4 as an output set for logic 0. Thisdischarges C5. RA4 is then set as an input,allowing current to charge up C5 via VR1.

When the Schmitt threshold is reached,the software responds to this as an inputchange from logic 0 to logic 1. It immedi-ately sets RA4 as an output at logic 0again, discharging C5, and then resets RA4as an input once more, and so the cycle cancontinue for as long as the softwarerequires it.

In this design, 16 waveform cycles areused, which allows a lower value capacitorto be used than with a single cycle. It alsoincreases the capacitor’s discharge rate andreduces current flow when RA4 is brieflyset low. Listing 1 shows the full pulse delaygeneration routine.

The frequency of oscillation can bechanged by varying VR1 or by using adifferent value for C5.

As said earlier, additional banks of eight

digits can be controlled. In this case IC2and IC3 need to be duplicated on a strip-board layout. Their pins should be con-nected identically to those in Bank 1, refer-ring to Fig.6. The connection points on thep.c.b. are those alongside IC1, previouslyleft unused.

The difference is that their enable pins (1and 9) need to be controlled by a differentPort A pin, RA1 for Bank 2, and RA2 forBank 3. It is permissible to omit IC3 in thefinal bank if the digit count does notrequire it.

If more than three Banks are needed(more than 24 digits), pins RA0 to RA3should be wired into another 74HC237,mounted on stripboard, at its pins A0 toA2. The outputs would then be used as theBank Select lines for up to eight pairs ofIC2 and IC3.

If using the extra 74HC237, remove thep.c.b. link wire marked Bank 1 Link.Connect point Y to pin Y0 of the new mul-tiplexer. Point X then becomes the point tobe regarded as the RA0 connection.

The software for the PIC and the PC willneed to be modified to cope with more thanthree banks of digits. For this reason, onlyreaders highly familiar with programmingin both PIC and QB languages shouldundertake this option.

To such experi-enced programmers,the changes requiredshould be obvious,but the author cannotoffer advice on it. Norcan advice be offeredon a breadboard lay-out for any additionalchips added.

Note that it will benecessary to changeregulator IC9 to astandard 7805 +5V1A type if additionalcopies of IC2/IC3 areadded (each extrachip adds about20mA to the powerdrawn from the +5Vline – see earlier).

QB programmerswill recognise that the multiplexing circuitcould be controlled directly from the PC’sprinter port data lines, omitting the PICentirely. The port’s other control linescould then be used in place of the RA0 toRA2 connections. The QB software wouldlargely need to be rewritten, of course.

Two digits were sent to the author forexperimentation. As described in this arti-cle, the resulting design is intended to driveup to at least 24 digits, and up to 64 withmodification. Obviously this ability has notbeen fully proved in practice. However,extensive bench-tests and simulations havebeen made using the two digits and it isbelieved that the claims are valid. If youfind any aspect that does not justify thisbelief, let the author know via EPE HQ(NOT via the Chat Zone as messages post-ed there may be overlooked).

The author hopes that readers will findways in which the PIC and QB programs canbe enhanced and write additional routines tosuit their own needs. His intention has beento show with this design how the Big Digitscan be controlled, and to provide an elemen-tary framework within which readers canwork to suit their own needs and the numberof digits actually used.

Readers who do not wish to tailor the pro-grams, though, will find that the software isperfectly usable as it stands, and that it

provides a reasonable method of controllingthe digits, whether just one is used, or manymore. We would be interested to know howmany you use and in what applications.

The software for this design is available

on 3·5in disk (for which a nominal han-dling charge applies) from EPE Editorialoffice, or free via the EPE ftp site (pathPUB/PICS/bigdigit). The easiest route tothe ftp site is via the link at the top of themain EPE web page at www.epemag.wimborne.co.uk.

The PIC software is supplied as a sourcecode (ASM – TASM grammar), HEX code(MPASM) and OBJ code (TASM). It wasdeveloped using EPE Toolkit Mk3/TK3.The PC program is supplied as a stand-alone program (EXE) and asQBasic/Quick-BASIC source code (BAS).

The PIC configuration required is XTALXS, POR on, WDT off. This is embeddedin the ASM and HEX codes, but readersusing the TASM OBJ code must configurethe PIC in the usual separate manner.

Ensure that you read this month’sShoptalk page for details of componentbuying for this project.

The author thanks Display Electronics

(www.distel.co.uk) for providing the BigDigits for experimental use in the develop-ment of this project.

Everyday Practical Electronics, May 2002 333

!"#

PULSEIT:movlw %00010000 ; number of cycles requiredmovwf PULSECNT

PULSE2:btfss PORTA,4 ; has bit 4 gone high (cap charged

up enough)?goto PULSE2 ; no, repeat checkbcf PORTA,4 ; yes, set bit 4 low to discharge cap

againPAGE1bcf TRISA,4 ; set bit 4 as outputPAGE0nop ; brief wait discharge capacitorPAGE1bsf TRISA,4 ; set bit 4 as inputPAGE0decfsz PULSECNT,F ; repeat for set delay loop timegoto PULSE2return


Recommended