You are on page 1of 33

References

[1] Allen J. Wood and Bruce F. Wollenberg, Power Generation Operation and
Control, 2nd ed., John Wiley & Sons, Singapore, 2005, Chapter 9, pp. 328-362.
[2] John J. Grainger and Willian D. Stevenson, Jr., Power System
McGraw-Hill, Inc., Singapore, 1994, Chapter 16, pp. 695-707.

Analysis,

[3] Katsuhiko Ogata, Modern Control Engineering, 4th ed., Prentice Hall of India
Pvt. Ltd, New Delhi, 2006.
[4] Katsuhiko Ogata, Discrete-Time Control Systems, 2nd ed., Prentice Hall of
India Pvt. Ltd, New Delhi, 2005.
[5] Cyril W. Lander, Power Electronics, 3rd ed., McGraw-Hill Book Co.,
Singapore, 1993.
[6] Ned Mohan, Tore M. Undeland and William P. Robbins, Power Electronics,
3rd ed., John Wiley & Sons Inc., Replika Press Pvt. Ltd., India, 2006 .
[7] James W. Dally, William F. Riley and Kenneth G. McConnell,
Instrumentation for Engineering Measurement, 2nd ed., John Wiley & Sons
Inc., Replika Press Pvt. Ltd., India, 2006, Chapter 6, pp. 162-205.
[8] Thomas C. Hayes and Paul Horowitz, Student manual for The Art of
Electronics, Cambridge University Press, Gopsons Papers Limited, India,
2002. Chapter 2, pp. 82-140.
[9] Website, http://www.allaboutcircuits.com/vol2/chpt 12/6.html. accessed on
4/06/2008.
[10] Data sheet # DS39582B/or PIC16F87XA 28/40pin 8-bit CMOS flash,
Microcontrollers, Microchip Technology Inc., U.S.A, 2003.
[11] Data sheet # GT50J101 for 600V, 50A IGBT, Toshiba, Japan.
[12] Data sheet # PC817, Photocoupler, Sharp, Japan.
[13] Datasheet # UTC D313, NPN Switching Transistor, Unisonic Technologies
Co., Ltd.

50

Appendix 1.
The Matlab program used to find PID vales of the present synchronizer
% Estimate PID values ofpresent synchronizer, [K(s+a)*(s+b)/s]
J=250;

Wo=76.18;
C=0.8;
t=0:1:600;
Tg=0.3;
Th=3.0;
a-0.2333;
Kt=8000;
for K=0.2.-0.01:0.01; %starts the inner loop to vary the a values
for b=0.6:-0.001:0.001; %starts the inner loop to vary the a values
numl =[K (a+bj *K a *b *KJ;
denl =[0 1 OJ;
tfl-tf(numl,denl);
num2=[0 0 1];
den2=[0 Tg 1];
tf2=tf(num2,den2);
num3-[0 01];
den3=[0 Th 1];
tf3=tf(num3,den3);
num4=[0 0 1];
den4=[0 Wo*J Wo*C];
tf4-tf(num4,den4) ;
tf5=tf]*tf2*tf3*tf4*Kt;
sys=feedback(tf5,1);
y=step(sys,t);
m=max(y);
n=minfy);
ifm<1.35 & m>0.99;
break; % breaks the inner loop
end
end
ifm<1.35 & m>0.99;

51

break; % breaks the inner loop


end
end

r 1=1 ;while y(rl)<0. l,rl=rl+l ;end;


r2=l;while y(r2)<0.9,r2=r2+l;end;
RiseJime=(r2-rl) *1
s-601; whiley(s)>0.98 &y(s)<1.02; s=s-l;end;
sett I ingjime=(s -1) *1
max overshoot=m-l
plot(t,y);
grid;

title('Estimated Unit-Step response ofpresent Synchronizer')


xlabel('t Sec')
ylabel ('Amplitude')
aa=num2str(a); %string value of'a'to be printed on the plot
bb~num2str(b); %string value of'b' to be printed on the plot
kk-num2str(K); %string value of'K'to be printed on the plot
mm-num2str(max overshoot); %string value of max^overshoot to be printed on the plot
rr=num2str (RiseJime); Hstring value of RiseJime to be printed on the plot
ss -num2str (settlingJime); %string value of settlingJime to be printed on the plot
text(110,0.7, 'a='), text(150,0.7, aa)
text(110,0.5,'b='),text(150,0.5,bb)
text(l 10,0.3, 'K='),text(l50,0.3, kk)
text(l 10,0.25, 'Max
text(360,0.1,

overshoot='),text(250,0.25,mm)

'Rise time='),text(450,0.1,rr)

text(l 10,0.1, 'Settling time='),text(250,0.1,ss)


sol=[sys]
sol=[K;b]
TFj>fJresent=tfl *tf2*t/3*Kt

Appendix 2.
The program used in Matlab to estimate PI parameters
% Estimate parameters for new PI controller when Pe(s) is connected, [K(s+d)/s]
J=250;
Wo=76.18;
C-0.8;
t=0:l:90;
Tg=0.3;
Th=3;
K=0.2;
a=0.2333;
b=0.05;
Kl-8000;
Ke-6000;
for Kp=0.9:-0.1:0.1; %starts the inner loop to vary the 'Kp'values
for d=0.1. -0.001:0.001; %starts the outer loop to vary the'd' values
numl=[K (a+b) *Ka*b*KJ;
denl =[0 1 0];
tfl-tf(numl,denl);
num2-[0 01J;
den2-[0 Tg 1];
tf2=tf(num2,den2);
num3==f0 01J;
den3-[0 Th 1J;
tf3=tf(num3, den3);
1f4=tfl *tf2*tf3*Kt;
%tf of the new PI controller
num4=[0 Kp Kp*dJ;
den4-[01 0];
tf5=tf(num4,den4);
tf6=tf5*Ke;
Gc = parallel(tf4, tf6);
num5=[0 0 I];
den5=[0 Wo*J Wo*CJ;
Gp=tf(num5,den5);

53

sys=feedback(Gc*Gp,l);
y=step(sys,t);
m=max(y);
if m< 1.1 & m>0.99;
break; % breaks the inner loop
end
end
ifm<l.l & m>0.99;
break; % breaks the inner loop
end
end
rl =i .while y(rl)<0. l,rl =rl+l;end;
r2=l; while y(r2) < 0.9, r2=r2+1 ;end;
Rise_time=(r2-rl) *1
s91; whiley(s)>0.98 &y(s)<1.02; s=s-l;end;
Settlingjime=(s-l) *1
maxovershoot=m-l
plot(t,y);
grid;
title('Unit-Step response when Pe(s) is connected')
xlabelft Sec')
ylabel ('Amplitude')
kk=num2str(Kp); %string value of Kp to be printed on the plot
dd=num2str(d); %string value of d to be printed on the plot
mm=num2str (maxovershoot); %string value of max overshoot to be printed on the plot
ss=num2str(SettlingJime); %string value of Settling time to be printed on the plot
rr-num2str (Rise time); %string value of Rise time to be printed on the plot
text(21,0.9, 'Kp='), text (26,0.9, kk)
text(21,0.7, 'd ='), text(26,0.7,dd)
text(21,0.5, 'Max overshoot^'),text(42,0.5,mm)
text(21,0.3, 'Settling time='),text(42,0.3,ss)
text(21,0.1, 'Rise time='),text(42,0.1,rr)
sol=[sys]
sol=[Kp;d]
Kp=Kp
d=d
tf4

(,HZ, > 0 o

W P Z ^ p p i j

(puzp 'puinu)fi=[j~/O~JJ

Appendix 3

GT50J101

1 L+
m POWER SWITCHING APPLICATIONS.

U n i t i n mm
liigh Input Irapedance

20-5MAX

High Speed

tf=0.35us(Max.)

Low S a t u r a t i o n V o l t a g e

VCE(sat)=4.0V(Max.)

,03 30 2

Enlianc emeu t -Mode

1I

XI?
2.5
3.0

AXIMUM RATINGS (Ta=25C)

+2.5
1.0-0.25

CHARACTERISTIC

SYMBOL

RATING

bllec t o r - E m i t t e r V o l t a g e

V'CES

6D0

late-Emitter

20

Voltage

Collector Current

GES

DC

IC

Ins

iCP

100

Pc

200

lolleccor Power D i s s i p a t i o n
rc*25C)
Junction

Temperature

5.4 5 0 . 1 5

5.4 5 0 . 1 5

50

Tj

itorage Temperature Ranp,e

UNIT

I.

GATE

2-

COLLECTOR C H E A T

3.

EMITTER

SINK)

150
J EDEC

-55-150

[st_

crew Torque

EIA J

0.8

Nm

TOSHIBA

2-21FJC

Weight : 9 . 7 5 g
ELECTRICAL CHARACTERISTICS

(Ta25C)

CHARACTERISTIC

SYMBOL

Date Leakage Cu r r e n t
Collector C u t - o f f

Current

Collector-Emitter
treakduon V o l t a g e
Sate-Er.irter C u t - o f f

Voltage

Collector-Emitter
Saturation V o l t a g e

Switching Tine

500

nA

ICES

V C E=600V,

VHE-0

1.0

cA

IC~2nA, V nE =0

VGE(off) IC~50nA, VCE=5V


CE(sat)

1C-50A,

Cies

Vce=10V,

Hiermal R e s i s t a n c e

UNIT

Turn-on T i c e

on

tf
Tine

MAX.

Vce-0

tr

Turn-off

TYP.

vGE=20v,

R i s e Tine

F a i l Tine

MIN.

ICES

(BR)CES

Input C a p a c i t a n c e

' TEST CONDITION

Vcc0i

f-lMHz

3.0

6.0

3.0

4.0

3500

0.3

0.6

0.4

0.8

0.15

0.35

0.50

1.00

T ' n
'-15V

toff
Rth(j-c)

VCE=15V

600

30<)V

0.625

PF

us

GT50J101
WITCHING TIME -

IQ

SWITCHING TIME -

RG

r
COMMON

lb

EMITTER

C C

= 300 V

G E

-1SV

I r = 50 A

3
COLLECTOR CURRENT

IC

10

30

100

GATE R E S I S T A N C E

(A)

RG

300

(il)

5000
fa.
ft 3000

V
u

1000

jr

500

M
O

300

<

100

- COMMON

EMITTER
V

GE=

f=

lMHi

t Tc = 2 5 1 C
30
0.5

10

30

100

C O L L E C T O R - E M I T T E R VOLTAGE

300

1000

VCE (V)

PULSE

WIDTH

(s)

REVERSE BIAS SOA


SAFE OPERATING AREA
IC

MAX.(PULSED)

I C MAX. ( CONTI NOUS )

SINGLE
NONREPETITIVE
PULSE

Te = 25*C

CURVES M U S T
L1NEALY W I T H
IN

DERATED

INCREASE

TEMPERATURE.

.I : :: III
0.3

BE

I I I ,i i, I ill
3

10

COLLECTOR-EMITTER

.1 1, 1.1 I,
30

100

VOLTAGE

300
VCE

1000
(V)

COLLECTOR-EMITTER

VOLTAGE

VCE

(V)

GT50J101
Ic -

160
COMMON

VCE
>O

EMITTER

EMITTER

3
<

120

//

80

g
12

f/s
J.

Vnc=8V

1
4

C O L L E C T O R - E M I T T E R VOLTAGE

CE -

10

VCE

uJ

ic =

L
12

'

GATE-EMITTER

GE

w
>u

. COMMON
EMITTER

(V)

16

12

pp

10

iL
f/

12 T e = - 4 0 ' C

tm2
0>

15

20

GE

COMMON

T c 25"C

40

VCE -

16

o<

" Tc = 25"C

16

20 A
16

VOLTAGE

CE -

too

50

VG

20
(V)

GE

COMMON
EMITTER

12

Tc = 125"C

o>

PS
cc

100

100
50

3
u
I
a,

h: = 2 (
0

GATE-EMITTER

uu

12

16

VOLTAGE

50

VGE

20

160

12

GE

CE- V GE -

VCE=

>u

EMITTER

400

o<

Jr* 120
JO

0>
a
ufH
k

7i

80

RL=6X1

GATE-EMITTER

12
VOLTAGE

16
VGE

20
(V)

>o

12 w

o<
J

u:
1
cs 100
c
tu
j
rf
' 0
o

0
>

200

ko

40

16

Tc = 25*C
300

20
(V)

QG

EMITTER
.

5V

vz
u

16
VGE

COMMON
COMMON

= 20 A

G A T E - E M I T T E R VOLTAGE

(V)

IC ~

cc

JH

2
w1

100
n

/ /

H
<
O

40

80

120

CHARGE

QG

160
(nc)

200

Appendix 4.

PC817 Series

High Density Mounting Type


Photocoupler

PC817 Series

# Lead forming type ( I type ) and taping reel type ( P t y p e ) are also available. ( P C 8 1 7 I / P C 8 1 7 P
# # T U V ( V D E 0 8 8 4 ) approved type is also available as an option.

Features

Applications

1. Current transfer ratio

1. Computer terminals
2. System appliances, measuring instruments
3. Registers, copiers, automatic vending
machines
4. Electric home appliances, such as fan
heaters, etc.

M I N . 5 0 % a t I F = 5 m A ,VCE=5 V )

(CTR:

2. High isolation voltage between input and


output (Viso: 5 0 0 0 V t o )
3. Compact dual-in-line package
P C 8 1 7 : 1-channel type
P C 8 2 7 : 2-channel type
P C 8 3 7 : 3-channel type
P C 8 4 7 : 4-channel type
4. Recognized by UL, file No. E64380

5. Signal transmission between circuits of


different potentials and impedances

Outline Dimensions
PC817

Internal connection diagram

2.54J"5
CTR
rank mark

( U n i t :

PC827

Internal connection diagram


2.541

ft

M
i5?-^

y y

Anode m a r k .

ft

Mi403
1.2

7.62103
<D

0 26*0-1

0.5*

PC837
2.54 *

025

| |

sp rj? n r? n r?

SCLi > o 0-

AJLiJJ
U,
JJ Li

ft

ft


@ Anode
Cathode
Emitter
@ Collector
7.62103

0.26*

8 = 0 to 13*

N
co

ft

ft

ft

ft

7R9

1.2

o
co

y y

0.9*0.2

, 5
n
| m

fcfc
5 5

U
ui
So. I
i
< 0 . i1 CLl 0 . 1
JJ
U
JJ
li
JJ
Li
ij
@ Lb

01

y y y
ft

Internal connection
diagram

2.54*

<S>

Anode
Cathode
Emitter
Collector

8 = 0 to 13"

PC847
E

0,5

0.5*

Internal connection
diagram

14.74*0-5

0.5*

9.66 *

Anode
Cathode
Emitter
Collector

e = o to 13

'-] 2*0.3

I 7.62'

4.58*05

Io

ft

CD

m m )

"1

WoTr:
0.5*-1

@ Anode
Cathode

0 to 13"
Emitter
@ Collector

" In tie absence of confirmation by device specification sheets, SHARP takes no responsibility for any defects that occur in equipment using any of SHARP'S devices, shown in catalogs,
data boots, etc. Contact SHARP in ordertoobtain the latest version of the device specification sheets before using any SHARP'S device.*

SHARP

P C 8 1 7 Series

I Absolute M a x i m u m Ratings

( T a = 25 C)

Parameter

Symbol

Rating

Unit

If

50

mA

Ifm

Vr

Forward current
Input

"'Peak forward current


Reverse voltage
Power dissipation

Output

70

mW

Collector-emitter voltage

V CEO

35

Emitter-collector voltage

Veco

Ic

50

mA

Pc
P tot

150

mW

200

mW

Vi,o

5000

Vrm,

Collector current
Collector power dissipation
Total power dissipation
^Isolation voltage
Operating temperature

T opr

-30 to + 100

Storage temperature

T ag

-55 to+ 125

'3Soldering temperature

T sol

260

1 Pulse width <=100ns, Duty ratio : 0.001


*2 40 to 60% RH, AC for 1 minute
*3 For 10 seconds

Electro-optical Characteristics
Parameter

Output

MIN.

TYP.

MAX.

Unit

If = 20mA

1.2

1.4

Vfm

Ifm = 0.5A

3.0

1R

VR= 4V

10

|IA

Terminal capacitance

C>

V= 0, f= 1kHz

30

250

pF

Collector dark current

ICEO
CTR

10- 7

600

%
V

Peak forward voltage


Reverse current

*4Current transfer ratio


Collector-emitter saturation voltage
Transfer
characteristics

Conditions

Vf

Forward voltage
Input

(Ta= 25 C)

Symbol

Isolation resistance

If= 5mA, Vce= 5V

VcE(sB)

Cut-off frequency

fc
Rise time

tr

Fall time

tf

50

lF = 20mA,Ic= 1mA
DC500V, 40 to 60% RH

Riso
Cr

Floating capacitance

Response time

VCE = 20V

0.1

0.2

5 x 10">

10"

V = 0 , f = 1MHz

0.6

1.0

pF

Vce=5V, I c=2mA, Ri= 1000, - 3dB

80

kHz

18

(IS

18

Us

Vce = 2V, I c= 2mA, Rl = 100U

*4 Classification table of current transfer ratio is shown below.

Fig. 1 Forward Current vs.


A m b i e n t Temperature
60

Model No.

Rank mark

PC817A
PC817B
PC817C
PC817D
PC8#7AB
PC8*7BC
PC8#7CD
PC8#7AC
PC8#7BD
PC8#7AD
PC8#7

80 to 160

130 to 260

200 to 400

300 to 600

: 1 or 2 or 3 or 4

AorB

CTR ( % )

80 to 260

BorC

130 to 400

CorD

200 to 600

A, B or C

80 to 400

B, C or D

130 to 600

A, B, C or D

80 to 600

A, B,C, Dor No mark

50 to 600

40

I 30

-25

25

50

75

Ambient temperature T a (*C)

100

125

SHARP

P C 8 1 7 Series

Fig. 2 Collector Power Dissipation vs.


A m b i e n t Temperature

Fig. 3 Peak Forward Current vs. Duty Ratio

200

10000
5000
2 000
1 000

0
- 30

25

50

75

100

125

CC)

Ambient temperature T a

10

20

50

0.5

1.0

1.5

2.0

2.5

3.0

3.5

Forwaid voltage V p (V)

Fig. 6 Collector Current vs.


Collector-emitter Voltage

Fig. 5 Forward Current vs. Forward Voltage

Forward current I p (mA)

5 10 -1 2

Duty ratio

Fig. 4 Current Transfer Ratio vs.


Forward Current

5 10 "2 2

5 102

Fig. 7 Relative Current Transfer Ratio vs.


Ambient Temperature

Collector-emitter voltage V ce ( v )

- 30

25

50

75

Ambient temperature T , CC)

100

P C 8 1 7 Series

SHARP
Fig. 8 Collector-emitter Saturation Voltage vs.
Ambient Temperature

Fig. 9 Collector Dark Current vs.


Ambient Temperature
10

'

10
-25

Fig.10 Response Time vs. Load Resistance

25

50

75

Ambient temperature T , C C )

Ambient temperature T a ('C)

Fig.11 Frequency Response

Frequencyf ( k H z )
Load resistance Ri. ( k i )

Test Circuit for Response Time

Fig. 12 Collector-emitter Saturation


Voltage vs. Forward Current
>

Output
Input

Ro

Rt

Output

Test Circuit for Frepuency Response

10

Forward current I f ( m A )

Please refer to the chapter "Precautions for Use "

100

Application Circuits

NOTICE
T h e circuit application examples in this publication are provided to explain representative applications of
SHARP devices and are not intended to guarantee any circuit design or license any intellectual property
rights. SHARP takes no responsibility for any problems related to any intellectual property right of a
third party resulting from the use of SHARP'S devices.
Contact SHARP in order to obtain the latest device specification sheets before using any SHARP device.
SHARP reserves the right to make changes in the specifications, characteristics, data, materials,
structure, and other contents described herein at any time without notice in order to improve design or
reliability. Manufacturing locations are also subject to change without notice.
Observe the following points when using any devices in this publication. SHARP takes no responsibility
for damage caused by improper use of the devices which does not meet the conditions and absolute
maximum ratings to be used specified in the relevant specification sheet nor meet the following
conditions:
(i) The devices in this publication are designed for use in general electronic equipment designs such as:
Personal computers
Office automation equipment
Telecommunication equipment [terminal]
Test and measurement equipment
Industrial control
Audio visual equipment
Consumer electronics
Measures such as fail-safe function and redundant design should be taken to ensure reliability and
safety when SHARP devices are used for or in connection with equipment that requires higher
reliability such as:
Transportation control and safety equipment (i.e., aircraft, trains, automobiles, etc.)
Traffic signals
Gas leakage sensor breakers
Alarm equipment
Various safety devices, etc.
Qii) SHARP devices shall not be used for or in connection with equipment that requires an extremely
high level of reliability and safety such as:
Space applications
Telecommunication equipment [trunk lines]
Nuclear power control equipment
Medical and other life support equipment (e.g., scuba).
Contact a SHARP representative in advance when intending to use SHARP devices for any "specific"
applications other than those recommended by SHARP or when it is unclear which category mentioned
above controls the intended use.
I f the SHARP devices listed in this publication fall within the scope of strategic products described in the
Foreign Exchange and Foreign Trade Control Law of Japan, it is necessary to obtain approval to export
such SHARP devices.
T h i s publication is the proprietary product of SHARP and is copyrighted, with all rights reserved. Under
the copyright laws, no part of this publication may be reproduced or transmitted in any form or by any
means, electronic or mechanical, for any purpose, in whole or in part, without the express written
permission of SHARP. Express written permission is also required before any use of this publication
may be made by a third party.
Contact and consult with a SHARP representative if there are any questions about the contents of this
publication.

SHARP

115

Appendix 5.

UTC D313

NPN EPITAXIAL PLANAR TRANSISTOR

NPN EPITAXIAL PLANAR


TRANSISTOR
DESCRIPTION
The UTC D313 is designed for use in general purpose
amplifier and switching applications.

1:BASE 2:COLLECTOR

3: EMITTER

ABSOLUTE MAXIMUM RATINGS


SYMBOL

VALUE

UNIT

Collector-Base Voltage

PARAMETER

VCBO

60

Collector-Emitter Voltage

VCEO

60

Emitter-Base Voltage

VEBO

Ic

Storage Temperature

Tstg

-55-+150

Junction Temperature

150

Collector Current

ELECTRICAL CHARACTERISTICS(Ta=25C)
PARAMETER
Collector-Base Breakdown Voltage
Collector-Emitter Breakdown Voltage
Emitter-Base Breakdown Voltage
Collector Cut-Off Current
Emitter Cut-Off Current
Collector-Emitter Saturation Voltage
Base-Emitter On voltage
DC Current Gain

SYMBOL
BVCBO
BVCEO
BVEBO
ICBO
IEBO
VCE(SAT)
VBE(ON)
hFE

TEST CONDITIONS

MiN

IC=1mA
. IC=10mA
IE=100uA
VCB=20V, IE=0
VEB=4V, IC=0
IC=2A, IB=0.2A
VCE=2V, IC=1A

60
60
5

IC=1A VCE=2V
IC=0.1A,VCE=2V

40
40

TYP

MAX

UNIT

0.1
1.0
1.0
1.5
320

V
V
V
mA
mA
V
V

CLASSIFICATION ON hFE
RANK
RANGE

U T C

I
I

C
40-80

D
60-120

E
100-200

UNISONIC TECHNOLOGIES

F
160-320

CO., LTD.

QW-R203-001.A

UTC D313

NPN EPITAXIAL PLANAR TRANSISTOR


SATURATION VOLTAGE v.s.
COLLECTOR CURRENT

DC CURRENT GAINT
10000

1000

5-

100

1000

10000

1000

100

10

1000

10000

Collector Current (MA) lc=1 OLS

Collector Current (MA)

VBHSAT) V.S.IC
10000

1000

10

100

1000

10000

Collector Current (mA) fc=10b

10

100

Collector to Emitter V o l t a g e (v)

VB(ON) V.S. Ic
10000

1000

100
10

100

1000

10000

Collector Current (MA) VCE=2V

U T C

UNISONIC TECHNOLOGIES

CO., LTD.
QW-R203-001.A

UTC D313

NPN EPITAXIAL PLANAR TRANSISTOR

UTC assumes no responsibility for equipment failures that result from using products at values that
exceed, even momentarily, rated values (such as maximum ratings, operating condition ranges, or
other parameters) listed in products specifications of any and all UTC products described or contained
herein. UTC products are not designed for use in life support appliances, devices or systems where
malfunction of these products can be reasonably expected to result in personal injury. Reproduction in
whole or in part is prohibited without the prior written consent of the copyright owner. The information
presented in this document does not form part of any quotation or contract, is believed to be accurate
and reliable and may be changed without notice.

U T C

UNISONJC TECHNOLOGIES

CO., LTD.

QW-R203-001, A

Appendix 6.
SN5413, SN54LS13, SN7413, SN74LS13
DUAL 4-INPUT
POSITIVE-NAi\lD SCHMITT TRIGGERS

SDLS046

DECEMBER 1983-REVISED MARCH 1988

SN5413. SN54LS13 . . . J OH W PACKAGE


SN7413 . . . N PACKAGE
SN74LS13 . . . D OR N PACKAGE
(TOP VIEW)

Operation f r o m Very S l o w Edges


Improved

Line-Receiving

Charac-

teristics

1A C 1 Ul4 3 Vcc

High Noise I m m u n i t y

IB C 2
NC C 3

icC 4

description

1D C6

1Y C6
C7

Each circuit functions as a 4-input NAND gate, but


because of the Schmitt action, it has different input

GND

threshold levels for positive ( V t + ) and for negative

133 2D
12 3 2C
11 2 NC
10 2 2B
9 2 2A
S 2 2Y

going ( V f - ) signals.
SN54LS13 . . . FK PACKAGE

These circuits are temperature-compensated and can

(TOP VIEW)

be triggered from the slowest of input ramps and still


give clean, jitter-free output signals.

i > I 11 11 11l
3 2 1 20 19

The SN5413 and SN54LS13 are characterized for operation over the full military temperature range of -55C
to 125C. The SN7413 and SN74LS13 are character-

logic s y m b o l *

1B1C1D2A2B-

(11
(2)

1D

]8

&JJ

10 [ 2 C
17[ NC
16[ NC
15t NC

14 [ 2B
.X r9n 1
0 111213 /
t - i ^ n n X
>- Q O >

vjfi)

TY

(41

<

<3

NCNo internal connection

16)
<91
110)

]4

NC ] 5
1C ] 6
NC ] 7

ized for operation from 0C to 70C.

1A-

NC

logic d i a g r a m (positive logic)


VJB)

2C- (121
2 D - (131

-2Y

tThis symbol is in accordance with ANSI/IEEE Std 91-1984 and


I EC Publication 617-13.
Pin numbers shown are for 0 , J, N, and W packages.

ABCD

FROOUCTIOK DATA decumti wauin )taratfoa


eorrnt as el puUiulkm dais. Product! tirtn> to
- m i p the term* l Taiaa latfrnmenti
.:dart wirttY. f .
nKUMrilr inclooe tejonj of all (urimrton.

TEXAS
^
INSTRUMENTS
POST OFFICE BOX 655012 > OAU.AS, TEXAS 75265

SN5413, SN54LS13, SN7413, SN74LS13


DUAL 4 INPUT
POSITIVE NAND SCHMITT TRIGGERS
schematics

Supply voltage, V c c (see Note 1)

7 v
5.5 V

Input voltage: '13

7 V

'LSI3
Operating free-air temperature: SN54'

_ 5 5 c to 125C

SN74'
Storage temperature range
NOTE 1: Voltage values ere with respect to network ground terminal.

TEXAS ^
INSTRUMENTS
O S T OFFICE B O * 6 5 5 0 1 2 DALLAS. T E X A S 7 5 2 6 5

0 C to 70C
- 6 5 C to 150 C

SN5413, SN7413
DUAL 4-INPUT
POSITIVE-NAND SCHMITT TRIGGERS
r e c o m m e n d e d operating c o n d i t i o n s
SN5413
V<;c

Supply voltage

'OH

High-level output current

SN7413

MIN

NOM

MAX

MIN

NOM

4.6

5.5

4.75

'OL

Low-level output current


Operating free-air temperature

16
-55

125

5.25
-as

-0.8

T^

MAX

V
mA

16

mA

70

electrical characteristics over r e c o m m e n d e d operating free-air temperature range (unless otherwise n o t e d )


TEST CONDITIONS*

PARAMETER
vT+
v-rMysieresis
1VT4.-VT_)

MIN

TYP* MAX

UNIT

VCC'5V

1.5

1.7

VCC - 5 V

0.6

0.9

1.1

VCC - 6 V

0.4

0.8

2.4

3.4

V|K

Vcc'MIN.

If 12 mA

V0H

VCC-MIN.

V j * 0.6 V,

' O H " - 0.8 mA

VOL

Vcc = M ' N .

V|-2V,

l 0 |_ = 16mA

IT+

v C c - s V,

V, - V T +

-0.65

<T-

VCC " 5 VV C c = MAX,

V| " V T _
V|-8.8V

-0.85

'1
'|H

Vcc "MAX.

V|H-2.4V

'lL

VCC-MAX,

V|L-0.4V

V
- 1.5

0.2

0.4

V
mA
mA

1
- 1

V
V

mA

40

fA

-1.6

mA

'OS

VCC "

MAX

- 55

mA

'CCH

MAX

14

23

mA

>CCL

Vcc -

M A X

20

32

mA

c c

- 18

* f o r c o n d i t i o n * s h o w n a t M J N o r M A X , use t h e a p p r o p r i a t e v a l u e s p e c i f i e d u n d e r r e c o m m e n d e d o p e r a t i n g c o n d i t i o n s .
A l l t y p i c a l v a l u e s a r e a t V c c - 5 V , T A - 2 5 C.
N o t m o r e than one o u t p u t should be snorted at a time,

switching characteristics, V c c = 5 V , T a = 2 5 C
PARAMETEH
PLH

FROM

TO

IINPUT)

(OUTPUTI

Any

TEST CONDITIONS
RL-400n,

<PHL.

CL-15pF

TEXAS ^
INSTRUMENTS
OST OFFICE BO* 655012 DALLAS. TEXAS 75265

MIN

TYP

MAX

UNIT

18

27

ns

15

22

ns

SN54LS13, SN74LS13
DUAL 4-INPUT
POSITIVE NAND SCHMITT TRIGGERS
recommended operating conditions
SN54LS13

Vec
|QH

Supplv voltage
High-level output current

SN74LS13

MIN

NOM

MAX

MIN

NOM

MAX

4.5

5.5

4.75

5.25

-0.4

Low-level output current


Operating free-air temperature

-55

125

-0.4

mA

mA

70

'OL
T^

UNIT

electrical characteristics over recommended operating free-air temperature range (unless otherwise noted)

vT+
VTHystaresis
IVT+ - V T _ )

SN54LS13

TEST CONDITIONS^

PARAMETER

SN74LS13

MIN

TYP*

MAX

MIN

TYP$

MAX

1.4

1.6

1.9

1.4

1.6

1.9

0.5

0.8

0.5

0.8

Vcc-SV

0.4

0.B

0.4

0.8

2.5

3.4

2.7

3.4

vCc vcc -

VtK

VCC-MIN.

l| - - 18 mA

VOH

V C C " MIN.

V | = 0 . 5 V,

vol

V C C = MIN,

V| - 1.9 V

<t+

V C C " 5 V,

V, = V T +

-0.14

-0.14

lT-

V C C " 6 V,
V C C = MAX.

V| - V T _

-0.18

-0.18

V c C - MAX,
V C C - MAX,

V | H - 2.7 V

20

20

'lL

V||_ " &4 V

-0.4

-0.4

mA

loss

V C C " MAX

-100

mA

IOI_ = 4 m A

l|
l|H

-1.5

- 1.5
IQH " - - 4 mA

l0L"

0.25

0.4

8 m A

V| - 7 V

0.25

0.4

0.35

0.5

0.1

-100

-20

V
mA
mA

0.1

-20

V
V

mA
JA

CCH

V C C MAX

2.9

2.9

mA

'CCL

VCC -

M A X

4.1

4.1

mA

t For conditions shown ea MIN or MAX, t M the appropriate value specified under recommended operating condition!.
t All Typical values era et VcC = 5 V, T A - 2S5C.
5 Not more then one output should be shorted at a time, and duration of the short-circuit should not exceed ana aecond.

switching characteristics, Vcc 5 V , T a 25C


PARAMETER
'PLH

FROM

TO

IINPUT)

(OUTPUT)
Y

TEST CONDITIONS
R i - 1 l> O

C L - 15 pF

tPHL

,
TEXAS
^
INSTRUMENTS
O S T OFFICE BO* 6 5 5 0 1 2 D A L L A S . T E X A S 7 5 2 6 5

MIN

TYP

MAX

15

22

UNIT
ru

18

27

ns

SN5413,

SN54LS13,

SN7413,

SN74LS13

DUAL 4-IIUPUT
POSITIVE -NAND SCHMITT TRIGGERS
PARAMETER MEASUREMENT INFORMATION
TEST

POINT

VCC
INPUT ^ y p W f H I

FROM
OUTPUT

tsse Nota A)
W W W

UNDEH '
TEST

C Cl
bee Nora B)

3V
V) re<(L>

0V

K'fl-H

>k

OUTPUT

Vow
j^TTv
VQ-el
-C
VOL
(See Note CI

VOLTAGE WAVEFORMS
LNOTES:
O A D C I RA.C UAll
I T diodes ere 1 N3064 or ectuivelent.
8 . Cj_ i n c l u d e s p r o b e e n d j i g capacitance.
C. G e n e r a t o r characteristics a n d reference voltages are:

Generator Characteristics
z

SN547SN74*

out
SO n

R
1 MHz

SNS4 LS7SN74LS'

50 n

1MHz

tr
10 ns
15 ns

Reference Voltages
v

tf
10 ns
6 ns

l reflHI
1.7 V

V , ref(L)
0.9 V

1.6 V

0.8 V

O raf
1.5 V
1.3 V

TYPICAL CHARACTERISTICS OF '13 CIRCUITS


POSITIVE-GOING THRESHOLD VOLTAGE
vs
FREE-AIR TEMPERATURE
> 1.70
V"
Vc< - 6 V
Jl.
|

NEGATIVE-GOING THRESHOLD VOLTAGE


vs
FREE-AIR TEMPERATURE
>
i 0.90
VC c - 5
0.89

1.68

0.88

2 '.7

0.87

J 166

1.66

X
(-

164

s'

|
1

163

0.86
O.BS
084
0 83

| 1*2
I

0.B1

1.61

I
080
-75 50 25 0 25 50 75 100 125
Free-Air Temperature C

4 r so

-SO
0 26 60 76 IDS 125
T a - Free-Air Temperature - C
FIGURE 1

FIGURE 2

HYSTERESIS
vs
FREE-AIR TEMPERATURE
5V

820
810

f .
I
I 790

780

i
+
770
>i760
750

-It

-50 - 25 0 26 50 75 100 125


Ta Free-Air Temperature 'C
FIGURE 3

D a t a f o r t e m p e r a t u r e s b e l o w 0 C ana 7 0 C e n d s u p p l y voltages b e l o w 4.7S V a n d above 5 . 2 5 V ere e p p l i c a b l e f o r S N 5 4 1 3 o n l y .

TEXAS
INSTRUMENTS
OACT / ' C t i f t ortv .

AC 7C!CC

SN5413, SN7413
DUAL 4 INPUT
POSITIVE-NAND SCHMITT TRIGGERS
TYPICAL CHARACTERISTICS OF '13 CIRCUITS
THRESHOLD VOLTAGES
vs
SUPPLY VOLTAGE

DISTRIBUTION OF UNITS
FOR HYSTERESIS

2.0

Vcc-6 V

(\

TA 25<

1.8

1.6
> 1.4
I
f *

'

OKtlV. Goinj Threi hold Voltagc . VT+

99% ARE
ABOVE
735

J
720

>

1.0

0.6

Neg(>e- joins "hreth >ld Vc Itaga, V T -

OA
0.2

740 780 780 800 820 840 860


VT+ - V f _ - Hysteresis - mV

MO

4.6

FIGURE 4

5-5

FIGURES

HYSTERESIS
vs
SUPPLY VOLTAGE

2.0
1.8

4.75
5
5.25
VT+ - V r _ - Hyrterasii - oiV

OUTPUT VOLTAGE
vs
INPUT VOLTAGE
1
1
Vcc " S V
.TA-26'C

TA

T+"

>
1
1 1-2
f ,
0.8
'

06

>0.4

0
4.5

4.76

6.25

5-5

V c c - Supply Voltage ~ V

FIGURE 6

0.4
0.8
1.2
1.6
V c c - Supply Voltage - V

FIGURE 7

D a t e f o r t e m p e r a t u r e s b e l o w 0 C a n d 7 0 C a n d s u p p l y voltages b e l o w 4 , 7 5 V and above 5 . 2 5 V ere applicable f o r S N 5 4 1 3 o n l y .

TEXAS
^
INSTRUMENTS
POST OFFICE SOX 55012 DALLAS. TEXAS 7S265

SN54LS13, SN74LS13
DUAL 4-INPUT
POSITIVE-HAND SCHMITT TRIGGERS
TYPICAL CHARACTERISTICS OF 'LS13 CIRCUITS
POSITIVE-GOING THRESHOLD VOLTAGE
vs
FREE-AIR TEMPERATURE
I"
v C (: - s \

NEGATIVE-GOING THRESHOLD VOLTAGE


vs
FREE-AIR TEMPERATURE
0.90
r
V C C - 5 1/
0.89
0.88
0.87
0.86
0.85
0.84

0 82
0.81
-75

-SO -25

28

BO

75

100

125

T * Free-Air Temperature _ C

0.80
0
25
50
75 100 125
75 -SO - 2 5
TA Free-Air Temperature - C

FIGURE 8

FIGURE 9

HYSTERESIS
vs
FREE AIR TEMPERATURE

DISTRIBUTION OF UNITS
FOR HYSTERESIS

>
E

I
S

i
i

>

V T + - V T - - Hysteresis _ M V

T a Free-Air Temperature - C

F I G U R E 11

FIGURE 10

D a t e f o r t e m p e r a t u r e s b e l o w 0C a n d a b o v e 7 0 C a n d s u p p l y v o l t a g e s B e l o w 4 , 7 6 V e n a a b o v e 6 . 2 5 V a r e a o o l i e e b l e f o r S N 5 4 L S 1 3 o n l y .

TEXAS ^
INSTRUMENTS
OSTOFFICE BO* 655012 DALLAS. T E X A S 75265

SN54LS13, SN74LS13
DUAL 4-INPUT
P0SIT1VE-NAND SCHMITT TRIGGERS
TYPICAL CHARACTERISTICS OF XS13 CIRCUITS

THRESHOLD VOLTAGES A N D HYSTERESIS


vs
SUPPLY VOLTAGE

OUTPUT VOLTAGE
vs

INPUT VOLTAGE
ir
Vcc " 5 V

0
Vcc - Supply Voltage - V

0.4

0.8
1.2
1.6
V| - Input Voltage - V

FIGURE 13

FIGURE 12

D a t a f o r t e m p e r a t u r e s b e l o w 0C a n d a b o v e 7 0 C a n d s u p p l y v o l t a g e s b e l o w 4 . 7 5 V e n d a b o v e 5 . 2 5 V a r e a p p l i c a b l e t o r S N S 4 L S 1 3 o n l y .

,
TEXAS
^
INSTRUMENTS
OST OFFICE B O * 655012 DALLAS. TEXAS 75265

SN5413, SN54LS13, SN7413, SN74LS13


DUAL 4-INPUT
POSITIVE-NAND SCHIVHTT TRIGGERS
TYPICAL APPLICATION DATA

)
I TTL SYSTEM

n r

CMOS

SINE-WAVE
OSCILLATOR

>

JT

TTL SYSTEM INTERFACE


FOR SLOW INPUT WAVEFORMS

PULSE SHAPER

0.1 H i to 10 MHz

INPUT

OUTPUT

THRESHOLD DETECTOR

MULTIVIBRATOR

Open-collector
outpu r
INPUT

I
|

Y oOUTPUT
u-

INPU

-I--I

PULSE STRETCHER

TEXAS
INSTRUMENTS
P O S T OFFICE S O X 6 5 5 0 1 2 D A L L A S . T E X A S 7 5 2 E 5

Appendix 7.
MICROPROCESSOR PROGRAM FOR 'PI' CONTROLLER STRATEGY II
config _LVP_OFF & _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF & _BODEN_OFF & _DEBUG_OFF
; for PID
listp=16F877A
Sinclude pl6F877a.inc
cblock
0x40
CEBPulselengthH
CEBPulselengthL
GENPulselengthH
GENPuIselengthL
errorL
errorH
errorfrequ
INT TERM_H
INTTERML
PROP_TERM_H
PROP_TERM_L
PID_RES_H
PID_RES_L
PWM
flags

;0-low frequency 1 -error neg 2-cal over 3-start new cycle


;4-gen ok 5-ceb ok

endc
AARGBO
AARGB1
AARGB5
BARGB0
BARGB1
REMB0
REMB1
TEMP
LOOPCOUNT
TEMP2
org
goto

equ 0x50
equ 0x51
equ 0x52
equ 0x53
equ 0x54
equ 0x55
equ 0x56
equ 0x57
equ 0x58
equ 0x59
0x00
start

org
banksel
bcf
btfss
goto
retfie
bcf
banksel
btfss
goto
btfsc
goto
banksel
bsf
bsf
goto

0x04

banksel
bsf
bsf
call
retfie

flags

INTCON
INTCON,0
INTCON,2
chk_Iow_fteq
INTCON^
flags
flags,4

;chk gen ok
setlowfreq
flags,5
setoutput

flags
flags,0
flags,3
setoutput

setlowfreq
flags,0
flags,3
calculate

setoutput
call
banksel
bsf
;chk_low_freq
;
banksel
;
btfss
;
retfie
;
Banksel

calculate
flags
flags,3
PIR1
PIR1,0
flags

bsf
retfie

flags,0; low frequency or

start
configprocessor
banksel
PR2
movlw
0xC7 ;199
movwf
PR2
banksel CCPR1L
movlw
0x00 ;at initilize 0
movwf
CCPR1L
bcf
CCPlCON,CCPlX
bcf
CCP1 CON,CCP 1Y
banksel
TRISC
bcf
TRISC.2
banksel
T2CON
movlw
b'00000100' ; TMR2 = on, prescale =1:1
movwf
T2CON
banksel
CCP ICON
movlw
b'OOOOllH' ; and enable PWM mode
movwf
CCP1CON
banksel TRISB
; bit 5 for desable CEB reading
movfw
b'l 1100000' ;B,7 B,6 and B,5 are input
banksel
INTCON
bsf
INTCON,7
bsf
INTCON,6
bsf
INTCON,5
banksel
T1CON
bcf
TlCON,4
bcf
TICON,5 ;PS 1:1 minFz=16Hz
BSF
STATUS, RPO
CLRF
PIEl
bcf
PIE 1,0
; timer 1 interupt enable desabled
BCF
STATUS, RPO
CLRF
PIRl
banksel
bcf
bcf
bsf
bsf
bsf
bank3el
bsf
bsf
bsf
bcf

OPTION_REG
OPTION_REG,5
OPTION REG,3
OPTION~REG,0
OPTION_REG,l
OPTIONREG^
INTCON
INTCON,7
INTCON,6
INTCON,5
INTCON,2

banksel
clrf
clrf
clrf
call

INT_TERM_H
INTTERMH
INT_TERM_L
flags
setdefoultpwm

Banksel
btfsc
goto

flags
flags,4
gen_read_ok

main

clrf
flags;
new cycle
banksel
TMRO
clrf
TMRO
banksel
OPTION_REG
bsf
OPTION_REG,0
bsf
OPTION_REG,1
bsf
OPTION_REG,2
call
banksel
btfss
goto

readGEN
PIRl
PIR1,0
$+6

;
;
;timerO ps= 1:256

;check if the timer lx>0ms

Banksel
bsf
bcf
goto
genreadok
nop
nop
call
btfsc
bcf
btfsc
goto
goto

flags
flags,0; low frequency flag
PIR1,0
setdefoultpwm
; goto set defoult pwm

readCEB
flags ,2
flags,2
flags,3
main
$-2

goto main

readCEB
Banksel
bcf
banksel
btfsc
goto
banksel
CLRF
CLRF
banksel
clrf
clrf
banksel
btfsc
goto
btfsc
goto
btfsc
goto
btfss
goto
BSF
btfsc
goto
btfsc
goto
btfsc
goto
btfss
goto
BcF
banksel
movfw
banksel
movwf
banksel
movfw
banksel
movwf
banksel
bsf
bcf
nop
return
CEB_freq_set
movlw
banksel
movwf
movlw
banksel
movwf
banksel
bsf
bcf
nop
return

flags
flags,3;: ; flag for new cycle
PORTB
PORTB,5
CEB freq_set
TMR1H
RIH
TMR1L
CEBPulselengthH
CEBPulselengthH
CEBPulselengthL
PORTB
flags,3
main
PORTB,7
$-3
flags,3
main
PORTB,7
$-3
TICON,
flags,3
main
PORTB,7
$-3
flags,3
main
PORTB,7
$-3
TICON,
TMR1H
TMR1H
CEBPulselengthH
CEBPulselengthH
TMR1L
TMR1L
CEBPulselengthL
CEBPulselengthL
flags
flags,5
flags,0

;flag for low frequency

0x4E
CEBPulselengthH
CEBPulselengthH
0x20
CEBPulselengthL
CEBPulselengthL
flags
flags,5
flags,0

;flag for low frequency

readGEN
banksel
CLRF
CLRF
banksel
clrf
clrf
banksel

TMR1H
TMR1H
TMR1L
GENPulselengthH
GENPulselengthH
GENPulselengthL
PORTB

btfsc
goto
btfsc
goto
btfsc
goto
btfts
goto
BSF
btfsc
goto
btfsc
goto
btfsc
goto
btfss
goto
BcF
btfsc
return
banksel
movfw
banksel
movwf
banksel
movfw
banksel
movwf
banksel
bsf
nop
return

flags,3
main
PORTB,6
$-4
flags,3
main
PORTB,6
$-3

calculate
TimeError ;(ceb-gen)
btfsc
goto
banksel
movfw
subwf
movwf
btfsc
goto
comf
incf
sublw
movwf
incf
goto
movfw
subwf
movwf
btfss
goto
nop
errorfre
movfw
movwf
movfw
movwf
movlw
movwf
call
nop

TICON.
flags,3
main
PORTB,6
$-3
flags,3
main
PORTB,6
$-3
TICON,
flags,2
TMR1H
TMR1H
GENPulselengthH
GENPulselengthH
TMR1L
TMR1L
GENPulselengthL
GENPulselengthL
flags
flags,4

flags,0
setdefoultpwm
GENPulselengthH
GENPulselengthL
CEBPulselengthL.w
errorL
STATUS,0
$+5
errorL, 1
errorL,0
Oxff
errorL
GENPulselengthH,0
$+2
GENPulselengthH
CEBPulselengthH.w
errorH
STATUS,0
;if error is minus
setdefoultpwm
;error minus
;error ok
errorH
AARGBO
errorL
AARGB1
0x08
BARGBO
UDIV1608L

movfw
addlw
btfsc
goto
movfw
movwf

AARGBO
Oxff
STATUS,0
setdefoultpwm
AARGB1
errorfrequ

movfw
sublw
btfsc
goto
nop
movlw
MOVWF
CALL

INT_TERM_H
0x01
STATUS, Z
PLD add

integral

OxOA
BARGBO
UDIV1608L

;;add to previous results


MOVF
AARGBl.W
ADDWF INT TERM L,
BTFSC
STATUS, C
INCF
INT TERM H,
MOVF
AARGBO, W
ADDWF INT TERM H,
GOTO
PID add
SUME_NEG
BTFSS
GOTO
MOVLW
ADDWF
MOVWF
BTFSS
GOTO
GOTO
CHECK_2 BIG
~ MOVLW
ADDWF
MOVWF
BTFSC
GOTO

flag,
1
A D D J N T TERM
B'00010100'
INT_TERM_H,
TEMP2
TEMP2, 7
ADDJNTTERM
PIDadd
B'l 1101100'
INT_TERM_H,
TEMP2
TEMP2, 7
ADD INT TERM

PID_add
clrf
clrf
;set intigeal term
movfw
movwf
movfw
movwf
movlw
MOVWF
call
movfw
addwf
movfw
addwf

PiDRESH
PID_RES_L
INT_TERM_L;
AARGB1
INTTERM H
AARGBO
0x05
BARGBO
UDIV1608L
AARGB1
PID_RES_L,1
AARGBO
PID RES H,1

clrf
movfw
movwf
movlw
movwf
call

AARGBO
errorfrequ
AARGB1
0x02
BARGBO
UDIV1608L

movfw
movwf
movlw

AARGB1
AARGBO
0x05

F
F
F

movwf
call

BARGBO
UMUL0808L

movfw
movwf
movfw
movwf

AARGBO
PROP_TERM_H
AARGB1
PROP_TERM_L

addwf
BTFSC
INCF
movfw
addwf

PID_RES_L,l
STATUS, C
PID_RES_H,
PROP_TERM_H
PID_RES_H,1

movfw
banksel
movwf

PIDRES L
CCPR1L~
CCPR1L

banksel
bcf
bcf
return

flags

flags,5
flags,4

set_defoult_para
movlw
movwf
banksel
movwf
return

0x20
PWM
CCPR1L
CCPR1L

PID
btfsc
goto

flags,0
setdefoultpwm

setdefoultpwm
banksel
BSF
movlw
movwf
return

T2CON
T2CON,2
0x28 ; L= duty*2
CCPR1L

=div
UDIV1608L

MOVLW
MOVWF

GLOBAL
UD1V1608L
CLRF
REMBO
8
LOOPCOUNT

RLF
AARGBO,W
LOOPUI6O8A
RLF
REMBO, F
BARGBO,W
MOVF
SUBWF
REMBO, F
STATUS,0
BTFSC
GOTO
UOK68A
REMBO, F
ADDWF
STATUS,0
BCF
AARGBO, F
UOK68A
RLF
DECFSZ
GOTO

LOOPCOUNT, F
LOOPUI6O8A

CLRF

TEMP

MOVLW

MOVWF

LOOPCOUNT

LOOPUI6O8B
RLF
AARGB1,W
RLF
REMB0, F
TEMP, F
RLF
BARGBO,W
MOVF
SUBWF
REMB0, F
AARGB5
CLRF
CLRW
BTFSS
STATUS,0
INCFSZ
AARGB5,W
SUBWF
TEMP, F
BTFSC
GOTO
MOVF
ADDWF
CLRF
CLRW
BTFSC
INCFSZ
ADDWF
BCF
UOK68B

RLF
DECFSZ
GOTO

STATUS,0
UOK68B
BARGBO,W
REMB0, F
AARGB5
STATUS,0
AARGB5,W
TEMP, F
STATUS,0
AARGB1,F
LOOPCOUNT, F
LOOPUI6O8B
return

UMUL0808L
CLRF AARGB1
MOVLW 0x08
MOVWF LOOPCOUNT
MOVF AARGBO,W
LOOPUMO8O8A
RRF BARGBO, F
BTFSC STATUS,0
GOTO LUM0808NAP
DECFSZ LOOPCOUNT, F
GOTO LOOPUMO8O8A
CLRF AARGBO
RETLW 0x00
LUM0808NAP
BCF STATUS,0
GOTO LUM0808NA
LOOPUMO8O8
RRF
BARGBO, F
BTFSC STATUS,0
ADDWF AARGBO, F
LUM0808NA
RRF AARGBO, F
RRF AARGB1, F
DECFSZ
LOOPCOUNT, F
GOTO
LOOPUMO8O8
return

You might also like