Вы находитесь на странице: 1из 358

1

..

Qucs FlowCode

Qucs

1. Qucs .................................................. 5
............................................................................................................................................ 5
1. ..................................................................................................................... 7
1. ............................................................................................ 7
.................................................................................................................................... 7
, .......................................................................................................................18
, ...................................................................................................................24
, .......................................................................................................29
, ...................................................................................................................32
, ....................................................................................................................39
, .........................................................................................................48
, ...................................................................................................55
, .........................................................................................................................58
, ..................................................................................................................61
2. ..............................................................................62
Qucs ......................................................................................................62
..............................................................................................................................65
...........................................................................................................................67
...............................................................................................................................68
Qucs ....................................................................................................69
.............................................................................................................................................70
............................................................................................................................................72
3. ..............................................................................................................................74
.......................................................................................................................................74
.................................................................................................................................84
.........................................................................................................................................87
2. ..................................................................................................................92
1. .............................................................................................................................92
..................................................................................................................92
.........................................................................................................................................102
...............................................................................................................107
..............................................................................................111
2

..

Qucs FlowCode

Qucs

2. ....................................................................................................................114
............................................................................................114
..........................................................................................118
.......................................................................................125
.......................................................................................................................134
.............................................................................................................139
3. Qucs ..................................................................................................................145
..........................................................................................................................................145
..................................................................................................................................149
...........................................................................................................................................154
3. Qucs.....................................................................................................................157
1. ...................................................................................157
.........................................................................................................................................157
.........................................................................................................................................160
...................................................................................................................168
.....................................................................................................................176
..............................................................................................................192
2. .................................................................................................................195
..................................................................................................................................................196
( ) .....................................................................................................199
.......................................................................................................................................202
3. ............................................................................................................................208
, , ...............................................................................................................208
..........................................................................................................209
....................................................................................................................211
.........................................................213
........................................................................................................................213
.............................................................................216
..............................................................................................................220
..................................................................................................................222
, ......................................................................................................................226
..........................................................................................................................................228
2. FlowCode.................................................................................................230
........................................................................................................................................230
FlowCode ...............................................................................232
3

..

Qucs FlowCode

Qucs

...............................................................................................................235
..................................................................242
.................................................................................................251
Calculation...................................................................257
FlowCode....................................................................................258
.......................................................................................................258
.................................................................266
.........................................................................................276
........................................................................................................................................276
() .............................................................................................................287
, , , , ..................................295
USART PWM ....................................................................................................308
FlowCode ..............................................................316
...................................................................................................................................316
.....................................................................................................................................319
.....................................................................................................................................321
...............................................................................................................................324
......................................................................................................................................327
....................................................................................................................................331
.............................................................................................................................................334
FlowCode .............................................................................................334
Proteus ...........................................................................................................341
......................................................................................................................................351
..........................................................................................................................................358

..

Qucs FlowCode

Qucs

1. Qucs


.
. , Multisim MicroCAP,
,
,
,
.
( EDA)
; ;
, .
, ,
,
. .

, ,
.
, ,
. , ,
, .
;
,
.
,
.
, , ,
. , ,
, , ,
.

,
. . ,
, , ?
.

, . Windows,
, ,
Linux, , . Qucs
: Windows, Linux, MacOS.

. ,
, , . ,
Windows .
5

..

Qucs FlowCode

Qucs

Qucs .
Windows 2000, , .
, ,
Windows XP, ,
.
, .
, , .

. ,
, ,
.
.
.
, Qucs ,
,
, . , Qucs
, ,
.

, ,
.
Qucs. .
, , , . ,
, Qucs ,
, .

..

Qucs FlowCode

Qucs

1.
1.

,
. .

. 1.1. Qucs Vista

. 1.2. Qucs openSUSE 11.1

..

Qucs FlowCode

Qucs

. 1.3. Qucs Fedora 10 KDE 4.2


Windows, Linux ,
, .

. 1.4. Qucs
8

..

Qucs FlowCode

Qucs

, ,
.
, .
,
. , , Qucs
, , ,
;
,
.
, , ,
, .

. 1.5. Qucs
, ,
; , ;
, .
, .

. 1.6. Qucs
,
. , ,
, .

,
( ),
.
,
.
: ,
. .
beginner
, ,

,
.
.
. 1.7. Qucs
9

..

Qucs FlowCode

Qucs


,
(
),
, ,
.
,
.
.
,
.
. 1.8.
, ,
, ,
, :

. 1.9. Qucs

. , ,
. ,
10

..

Qucs FlowCode

Qucs

,
. :

. 1.10. Qucs
Qucs
, .
Qucs , ,
. , .
, ,
, Qucs.
.
. -
. , ,
, .
Qucs . ,
, ,
, .
. Linux ,
.qucs. Qucs
(, /home/valdimir/.qucs). Linux
:
11

..

Qucs FlowCode

Qucs

. 1.11. KDE
Qucs,
, .

. 1.12.
Linux
.
Windows.
.
Qucs.

12

..

Qucs FlowCode

Qucs

. 1.13. , Qucs
, Linux,
Windows. , ,
.qucs.

. 1.14. Qucs Windows


13

..

Qucs FlowCode

Qucs

- ,
, HOME.
Windows Vista .
, Windows XP. , ,
, , Windows XP, ,
Microsoft. .
, ,
. :

. 1.15. Vista
, Microsoft .
, , : .
:

14

..

Qucs FlowCode

Qucs

,
,
HOME,

,
,

Documents .

Qucs,
.

. 1.16.

. 1.17. Qucs
Qucs , ?
,
, Qucs. , ,
, - , ,
15

..

Qucs FlowCode

Qucs

, - ,
FreeHDL, . ,
, . ,
,
,
,
.
, ,
. .

: MinGW32 ( Windows), FreeHDL, Icarus Verilog,
ASCO. Windows .
Linux , , ,
, , Qucs.
. Windows
Qucs,
Windows 98 XP. Windows
Vista. - .
Verilog, , .
Icarus Verilog - ,
, ,
- .
, : iverilog ,
. DOS (
DOS Vista), iverilog ,
Qucs. ,
, . , ,
, Qucs qucsveri.bat :
s e t V E R I LOG=C : \ I c a r u s V e r i l o g \ b i n \

:
%VER I LOG% i v e r i l o g - o %NAME% . b i n - s T e s t B en c h %NAME% . v
%VER I LOG%v vp %NAME% . b i n - v c d

, , ,
WordPad. Qucs,
. Program Files\Qucs\bin.
Linux openSUSE 11.1,
. , Fedora
, , , Qucs ,
Verilog, . ,
, , . , , ,
, .
16

..

Qucs FlowCode

Qucs

Qucs, FreeHDL, ,
, .
Qucs FreeHDL
. , ,
--tag. , ,
, ? , ,
, qucsdigi:
echo -n "linking..."
$LIBTOOL --quiet --mode=link --tag=digi $CXX $NAME._main_.o $NAME.o $LIBS

: /usr/bin.
,
, , digi,
, , . ,
.
,
.
, Windows :
, !. ,
, .
Windows .
Linux, Windows,
, ,
. , , ,
,
. ,
.
. , ,
, . ,
,
, , . ,
, ,
, . , , ,
. , , :
http://vgololobov.narod.ru

, , , ,
Qucs.

17

..

Qucs FlowCode

Qucs

,
, -,
. ,
,
. ,
Alt . (
) . ,
, :
( )
.
.
,
,
.

,
,
. , ,


,
,
, .
,
.
. 2.1.
,
,
Qucs, .
( ), ,
VHDL. , ,
, ,
VHDL. , ,
, Qucs VHDL,
. VHDL
, , , .
, , .
. ,
. ,
, ,
, , , .
, , .
18

..

Qucs FlowCode

Qucs

.
, , , .
,
. .
, ,
, , , .
, .
, , ,
. ,
. , ,
, ,
. , .dat
, .
. ,
, .
. Windows Vista ,
, -, .
Linux ,
, .ps.
.

. ,
.
. .

.

, -
, .


.
,

.
. ?
. 2.2.
, , ,
.
19

..

Qucs FlowCode

Qucs


( ). ,
. .
.
, . ,
. ,
. , .

. ( ).
.
.

. ,
,
, ,

.
.
,
, .
, Windows Vista

. ,
.

. 2.3.
,
, , ,
, , .
, .
.
,
, ,
, , .
, .

20

..

Qucs FlowCode

Qucs

. 2.4.
. , .
, ,
F9,
, , . :
P1-P5 . ,
-,
,
,

.

. 2.5. D-
21

. 2.6.

..

Qucs FlowCode

Qucs

, ,
. , ,
.
, ,
.

. 2.7.
. ,
, . .
, , , ,
,
, . , .
,
, . . Qucs
.
, .
.
,
,
, Ctrl+E .

.
VHDL ,
, VHDL
, , , ,
..
.

Qucs, .
, .
22

..

Qucs FlowCode

Qucs

, ,
, ,
, .
.
Ctrl+Q. , , ,
, ,
, , ,
.

. 2.8.
, , , ,
. , ,
, , , ;
, , , ,
, ,
.

23

..

Qucs FlowCode

Qucs

,
, Qucs

,
,
:
,
,
..
,
, ,
()

VHDL,

,
,
.
.
,
,
,
.

. 2.9.
,
, . ,
, ,
,
. ,
. ,
Ctrl+Z Ctrl+Y, .
, , .
, ,
( ),
. ,
,
Ctrl+X. ,
, ,
. ,
, ,
24

..

Qucs FlowCode

Qucs

, . ,
.
,
,
. VHDL,
.
,
. , , ,
. ,
, . ,
, .
, ,
.

. 2.10.

, ,
. (
) .
. ,
, . , ,
, , , Esc
,
.
, .

. 2.11.

25

..

Qucs FlowCode

Qucs

,
, , ,
. .
, .
.

,
- ,

,
.

. 2.12.
. , .
, .
, , ,
.
. . Qucs,
,
.

.

.


,
1 ,
Ctrl+B .


.
, .

. 2.13.
26

..

Qucs FlowCode

Qucs

.
, , .
, VHDL,
.
, ,
: VHDL .

. 2.14. VHDL

. 2.15.

. . ,
90 . , ,
90 .
, . .
, ,
, :

, :
; ,
.
. 2.16.

: X
Y. . ,
, , ,
, , .

27

..

Qucs FlowCode

Qucs

, ,
, .
/
, ( ).
, ( )
. ,
, .
. . , ,
. ,
, /.
,
( ) , .
, .
.
, ,
555. ,
, , .
.
.
. ,
Ctrl+I.

.
, , , , . ,
, ,
. , ,
.
,
, , ,
. , , ,
, , .
. , , ,
.

28

..

Qucs FlowCode

Qucs

. 2.17.

, ,
. , ,
, ,
. ,
Ctrl K (Ctrl+K),
, ,
.
Esc (
).
,
, ,
; ,
, .

.
. , , ,
, .
. ,
, , .
, ,
, ;
, ,
, ,
. .
. 2.18. ,

29

..

Qucs FlowCode

Qucs


, .

.
, ,
Ctrl+U.
. 2.19.

.
.

. 2.20. ,
,
, . ,
.
. 2.21.
, :

. 2.22.

30

..

Qucs FlowCode

Qucs


.
, . .
,
, .
,
.

.
, ,
.
,
, .

. 2.23.

. 2.24.
, ,
. .

. 2.25.
31

..

Qucs FlowCode

Qucs

,

.

,

.
. 2.26.
.
, ,
, .
. .
, , ,
.
,
Ctrl+E ,
, .

. 2.27.
.
,
, ,
.


.
,
.

. 2.28.
32

..

Qucs FlowCode

Qucs

, .

R1 R2

,
.

. 2.29.
,
,
.
. ,
, R3,
.

. 2.30.
,
, R1 R3,
, , .
?
, R2,
R3,
.

. 2.31.

33

..

Qucs FlowCode

Qucs

.
. ,
.

. 2.32.
, R2,
, Delete ,
, .
- , ,
,
( , , ).

.

.
. .
, ,
, , ,
, .
,
, , , .


output

.

,

.

. 2.33.
34

..

Qucs FlowCode

Qucs

,
, name
Ctrl+L .
, .
, .
. 2.34.
.
,
,
.
- ,
. ,

, .

,
.
. 2.35.
, , ,
, ,
.

. output
:
.

, ,
.

. 2.37.
35

..

Qucs FlowCode

Qucs

. Qucs .
.
,
, .
.
. .

. 2.38.
, .
, ,
, Ctrl+< .
Qucs
, dB. out.v.

Qucs.
. 2.39.
, .
, .

. Export
.

36

..

Qucs FlowCode

Qucs

,
, .

. 2.40.
, , ,
.
.
.
. , .
, ,
. , ,
.
. Qucs .
, .
, ,
. ,
RCL ,
, . ,
.
.
. , ,
1, Ctrl+B, .
,
.
.
.
/ .
, ,
. ,
.
,
, .
37

..

Qucs FlowCode

Qucs

. 2.41.
, .
, ,
. .
, ,
.
. ,
190. 1900,
.

. 2.42. -
VHDL .

38

..

Qucs FlowCode

Qucs

Qucs

.

,
,

, ,
VHDL Verilog,
, .
,
,
.
. 2.43.
. , (
CTRL+Shift+N), .

. 2.44.
, ,
, , ,
,
. ,
. , ,
.
, ,
, . ,
,
, .

39

..

Qucs FlowCode

Qucs

. 2.45.
.
, , , ,

. .

. ,
.
, .
, .


(.qucs)
,
.


,
.

. 2.46.
40

..

Qucs FlowCode

Qucs

. 2.47.
.
, .
, ,
. ,
. ,
. ,
.
+.

.

. 2.48.

41

..

Qucs FlowCode

Qucs

.
, . ,

, .
VHDL Verilog ,
, .
,
, . (
.dat) ,
, .

. ,
, .
, , .
,
.

. 2.49.
,
. .
.
.qucs. ,
.
, .
42

..

Qucs FlowCode

Qucs


.
.
. . Qucs
, : , ,
.. ,
. ,
. .
, .

: ,
, ..

,
,
,

.
,

.

. 2.50.
D-. ,
, .
, , .

. 2.51.
43

..

Qucs FlowCode

Qucs

, (,
, ) 10 5.
(
, ). , ,
in, , , out. , ,
, .
. , ,
.
, .

, ,
.
, , ,

.

: , ;
;
.

. 2.52.

Qucs, .

. 2.53.

,
,
.
.

.

44

..

Qucs FlowCode

Qucs

,
( ) >>,
.
,
.
,
, ,
.

. 2.54.
,
, ,
.


,
.
,
, ,
.

,

.

. 2.55.
, ,
.

45

..

Qucs FlowCode

Qucs

. 2.56.
.qucs user_lib.
.
.qucs . ,
.
.
.
, , , .
, , ,
.
/ .
( ), .

46

..

Qucs FlowCode

Qucs

. 2.57. /
CSV ,
CSV.

Ctrl+Shift+C.
.

. 2.58. CSV.
47

..

Qucs FlowCode

Qucs

Qucs.

,
.
. 2.59.
. Qucs .
, , ,
Qucs.
, , , netlist, Verilog.

,

, .
(
)


.

Qucs
.

. 2.60. Qucs
. , .
. , , , , .
.

48

..

Qucs FlowCode

Qucs

. 2.61. Qucs , .
,
, . ,
, .
.
.

. 2.64.
49

..

Qucs FlowCode

Qucs

, ,
, , ,
, .

,
,

.
,
, S .

. 2.65.
. - , .
, , ,
. ,
,
.
, .

. 2.66. Qucs

50

..

Qucs FlowCode

Qucs

50 10
, ( )
Z0 = 50 . , mil ,
.. .

. 2.67.
. .
Ideal.

,

,

,
.

. 2.68.
, , ,

.

51

..

Qucs FlowCode

Qucs

,
.

. 2.69. -

. 2.70. - 2DA1774R

. 2.71. - 2N2955

52

..

Qucs FlowCode

Qucs

(
), ,
( ).

. 2.72.
.

. 2.73.
. Qucs.
.

.
2.74.

53

..

Qucs FlowCode

Qucs

, ,
.

. 2.75.
, S-, .
.
, .

. .

,

,



,
.

. 2.76.
, .
.
54

..

Qucs FlowCode

Qucs


Qucs.
,
,
netlist.

. 7.78.
. F2
, . ,
,
. , ,
.

, ,
,

.
.
,
.
,
.

. 7.79.
,
. .
- .
, , ,
. ,
, , .
.
, .
55

..

Qucs FlowCode

Qucs

/. ( F4 )
: .
.
, , .

. 2.80.
. ,
, ( F8) .

. 2.81.

56

..

Qucs FlowCode

Qucs

. ( F5)
( , ),
.
.

.
-,
- .
, ,
.

. 2.82.
. , , netlist, .

,
,
,
.
, ,

.

. 2.83. netlist Qucs

57

..

Qucs FlowCode

Qucs

,
: .

. 2.84.
. , ,
, ,
. , , .
, ,
,
.
.
Shift -.
Ctrl, .

. 2.85.
58

..

Qucs FlowCode

. 2.86.
1:1. , .

. 2.87.
59

Qucs

..

Qucs FlowCode

Qucs

( +).
. , ,
. .
,
( -). .
: , ,
. (
) . ,
, . ,
.

. 2.88. Qucs
:
. ,
, ,
.

60

..

Qucs FlowCode

Qucs

. 2.89.

. 2.90. Qucs
, ,
.
,
Qucs, Qt ,
Qucs Windows, Linux, MacOS.

61

..

Qucs FlowCode

Qucs

2.
Qucs
Qucs, , ,
.

. 3.1. Qucs
,
.

.
untitled, , .

Ctrl+N

Ctrl+Shift+V
VHDL .
.

Ctrl+O

Ctrl+S

, .

Ctrl++

, .

Ctrl+W

,
.

Ctrl+P

62

..

Qucs FlowCode

Qucs

Ctrl+X


( ) .

Ctrl+C

Ctrl+V

Del

Ctrl+Z

Ctrl+Y

,
.

1:1 .

63

..

Qucs FlowCode

Qucs


.
/
/ .

Esc

Ctrl+D

X
X.

Ctrl+J

Y
Y.

Ctrl+M

90
.

Ctrl+R

, .

Ctrl+I

Ctrl+H

Ctrl+E

Ctrl+L

Ctrl+<

Ctrl+G

, .
Qucs,
.

F2

/
.

F4


.
? -
.
, .
64

Ctrl+B

..

Qucs FlowCode

Qucs


. ,
: , .
, .qucs, ,
.
,
,
,
.
,

.
,
,

.


.

, .
,
.
, .
. 3.2. ,
- .
, .
. , .
, ,
, .
,
.qucs ,
, , ,
.
, ,
, , ,
: , , ..
.
. +.
, , , .
65

..

Qucs FlowCode

Qucs

,
.
,

.



,

.
. 3.3.
, .


,
.

. 3.5.

66

..

Qucs FlowCode

Qucs

,
. , , ,
, , .

, .
.
.
: ,
.
, , ,
.

,
.
, .



, ,
.
,

.
. 3.7.
: ,
, .


,

,
,

.
. 3.8.
, ,
.
67

..

Qucs FlowCode

Qucs

. 3.9.

, ,
.

,
,


,
.

. 3.11.
.
( ) ,
. .
.
,
. ,
, Enter.
, .
, ,
. , .
, .
. ,
.

68

..

Qucs FlowCode

Qucs

. 3.12.
Qucs
, , .
10 200, 0.1 0.34.
k , M m
. , : 5k 5 k .
, , ,
, .

. 3.13.

69

..

Qucs FlowCode

Qucs

Qucs :

dBm 10 log (x/0.001)


dB 10 log (x)
T 1012
G 109
M 106
k 103
m 103
u 106
n 109
p 1012
f 1015
a 1018

: (1000), (1e-3)
(1k) . :

Ohm resistance /
s time / Seconds
S conductance / Siemens
K temperature / Kelvin
H inductance / Henry
F capacitance / Farad
Hz frequency / Hertz
V voltage / Volt
A current / Ampere
W power / Watt
m length / Meter ( )

, ,
, ( ,
Ctrl+L).

. 3.15.
.

, ,
Ctrl+<,
. .
, ,
- ,
70

..

Qucs FlowCode

Qucs

, . -
.
. , .

. 3.16.

, .

,
output,
out_db,
,
dB().

,

, : output.v.

. 3.17.
- .

71

..

Qucs FlowCode

Qucs

. 3.18. -
,
, :

. 3.20.
,
.

,
, .

, ,
A3 A5,
.
.
.

. ,

.

. 3.21.
72

..

Qucs FlowCode

. 3.22.

73

Qucs

..

Qucs FlowCode

Qucs

3.

Qucs, . ?
, , .
.
.


, .

.


.

,
.

. 4.1. Qucs

, ,
.
.

. 4.2.


. ,
, , , ,
, .

. ,
74

..

Qucs FlowCode

Qucs

Esc
.
,
.

. 4.3.

,
. ,
Delete .
, ,
, , , ..
, .

, , , .
, ,
,
, ,
.

,
.

.
, Ctrl ,
, .
( Ctrl)
.

. 4.4.
, ,
, .
, , , ,
. - ,
, .
, , :
. .
75

..

Qucs FlowCode

Qucs

, . ,
, ,
, .
,
. .

. 4.5.
, , , ,
, .
, ,
, ,
, ,
.
.

/ / ( ).
/, Shift
/; Ctrl .
, .
, , .

.
,
.
,
. .

. 4.6.
76

..

Qucs FlowCode

Qucs

, , , .
, . ,
, ,
, ,
, , .
; ,
.
, .
, ,
.
:


( Ctrl+K).
.
,

.

. 4.7.
,
.
, .
, ,
. , .
, .

. 4.8.
77

..

Qucs FlowCode

Qucs

,
(, ).

,
,
.

. 4.9.

, , ,
, , , ..
, , .
, (
) .
, , ,
, .

. 4.10.

78

..

Qucs FlowCode

Qucs

, ,
. ,
. , .
.
,
.
,
.

.
. ,
,
.

,

.
. 4.11.
p-n-p
. , , ,

. X.

. 4.12.

79

..

Qucs FlowCode

Qucs

, ,
1 GHz.


.
,

,
, .

. 4.13.


. , , .
, .
, , ,
Ctrl+J. , ,
.
, (
, ,
, , ,
Enter), .


,
.

.

,

,

.
. 4.14.

. , ,
, , ,
, , ,
.
80

..

Qucs FlowCode

Qucs

. 4.15.

.
, .
.

,
,
.

, .
,
, ,
.
. 4.16.

, ,
. , , ,
,
, .
, Qucs ,
.
, ,
.
81

..

Qucs FlowCode

Qucs

. 4.17.
,
,
, .
,
,
. .
( ) .ps,
, .
Windows Vista , ,
, , Linux
- .
ps Windows GSView.
. ,
MS Word, .
, Word . ,
ps - .

82

..

Qucs FlowCode

Qucs

. 4.18. , ps
openSUSE 11.1.

. 4.19.

83

..

Qucs FlowCode

Qucs

, , , Qucs,
, ,
. .
Qucs .

-, ,


.
,
.

. ,
,
,
.
1960-70

.
SPICE1,
1972
.

,
.

. 4.20.
, , .
,
, . ,
,
,
. ,
, ,
, .
, ,
. ,
. ,
. , .
84

..

Qucs FlowCode

Qucs

. 4.21.
,
.
, ,
, .
.
, Qucs,
. ,
, . , ,
, .

. .
Qucs
, .
, .
, ,
.
85

..

Qucs FlowCode

Qucs

. 4.22. ,
-
. ,
, , ,
.

. 4.23.

: out_phase = phase(output.v),
X.

. , ,
.
86

..

Qucs FlowCode

Qucs

,
.

,
,

.
,
, ,

S-.

,
.
,

:
.

. 4.24.

,
.
.

. ,
, ,
, , .
,
.
87

..

Qucs FlowCode

Qucs

. 2.25.
, , , ,
,
.

. , ,
, , , ,
, - .
, ,
, , , . , , ,
, , .

88

..

Qucs FlowCode

Qucs

. 2.26. Qucs
Qucs, ( )
.


5 ns
, t
,

,
.

. 2.27.

89

..

Qucs FlowCode

Qucs

, Qucs, ,
. ,
. , , ,
. Qucs .
, , , -
. RC
.
(
), .
,
,
,

,
.

. 2.28. RC
cap. ,
, RC .
.
- , ( )
cap .

. 4.29. RC

90

..

Qucs FlowCode

Qucs

, ,
, .
X. .

. 4.30. X
,
.
. Qucs
, .

91

..

Qucs FlowCode

Qucs

2.
1.
,
,
, ,
. ,
(
).

. 5.1.
,
, , , .

-
,


.
, ,
.

,
: ,
;
.
,
,

.

. ,
,
, ..
.
,
RF .
.
,
.
92

..

Qucs FlowCode

Qucs

.

. , , S-
, .
.

. 5.2. S-
C1 , X1 .
.
,
.
, .
.
,
.
. Qucs
.

93

..

Qucs FlowCode

Qucs

.
Qucs
,
S-,

,
,
Y.

. 5.3.
, , .
. ,
(
), .

. 5.4.
94

..

Qucs FlowCode

Qucs

Pr1,
.


,


.
,
,

,
,
.
,


.
. 5.5.
, ,
.

. 5.6.

Qucs , .
.
, . ,
.
,
, .
95

..

Qucs FlowCode

Qucs

.
,
, ,
.

.

,
.

. NF
.

. 5.7.
, .

. 5.8.

96

..

Qucs FlowCode

Qucs


. .

. 5.9.
, 220
308 , 50 .
:
,
.
, .
, ,
. ,
.
,
.
, .
, ,
, ,
.

97

..

Qucs FlowCode

Qucs

,
, ,

.
,
,
.

. 5.10.
, ,
, .



,

.
, .

. 5.11.
,
, , ,
, . ,
, , , , .
3 .
, .

98

..

Qucs FlowCode

Qucs

. 5.12.
, ,
. . .



.
. , ,


.
. 5.13.

99

..

Qucs FlowCode

Qucs

. 5.14.
.

,
.


.
. 5.15.

100

..

Qucs FlowCode

Qucs

. 5.16.
,
.
, . ,
. ,
.
.

. 5.17. P1 P2
.

101

..

Qucs FlowCode

Qucs


.
, , ,
,

.
,
, .

. 6.2.
.
, .
;

,
.

. 6.3. ,
102

..

Qucs FlowCode

Qucs

, ,
, .
.

. 6.4.
Pr1 1.68 ,
Pr2 8.4 .
, , ,
.
.
, .
. ,
, . , ,
10 , .
Qucs
, . ,
, .
, ,
.
,
220 , 50 . ,
. , 1 .

103

..

Qucs FlowCode

Qucs

, ,
,
1 .
,
( ).
,

.

. 6.5.
Theta .

. 6.6.
, , ,
, .

104

..

Qucs FlowCode

Qucs

( )
, .
,
. ,
, .
.
.

. 6.7.
,
, .
, ,
. .
.

. 6.8.

105

..

Qucs FlowCode

Qucs

: , , ,
, ,
, , ,
, -
.

.
,
.
: -
, ,
.

. 6.9.
,
, .
106

..

Qucs FlowCode

Qucs



, .
.
.



.

.


.
,
,

.

. 7.1.
107

..

Qucs FlowCode

Qucs

n-p-n p-n-p
. , , , ,
.
, , , , , ,
.
n-p-n .

. 7.3. -
0 10 .

. 7.4.

, .

. 7.5.
108

..

Qucs FlowCode

Qucs

,
.

. 7.6.
,
, .
,
, ,
.
109

..

Qucs FlowCode

Qucs


, , .
, .

. 7.7.
V1 ,
, , V1 .
,
, .

,
,
.
. 7.8.

110

..

Qucs FlowCode

Qucs


, Qucs , . Qucs
. Qucs
(, ) , .
, ,
. , ,
, , ,
, .

. 7.10.
,
,
.

.
:
, , .
, , .

111

..

Qucs FlowCode

Qucs

, , .
. ,
, ,
( ) . ,
. .
( , , ),
.

. 7.11.
, ,
, -, ,
. Pr2 ,
.
, ?
, , .
, ,
: Pr1 Pr2 Pr3.
, .
, . -
.

112

..

Qucs FlowCode

Qucs

. 7.12.
,
; ,
( ).
,
, .
, , .
,
, Qucs
.

113

..

Qucs FlowCode

Qucs

2.

. ,
, ,
, ,
.
.

. 8.1.
,
Pr1. ,
.
.
.
, I1.


.
,
Isweep,
,
.
. 8.2.

,
.

114

..

Qucs FlowCode

Qucs

. 8.3.
( ),
, , , .
.

. 8.4.

115

..

Qucs FlowCode

Qucs

, , ,
1N4001 ( ).
.

. 8.5. 1N4001
,
. , .



Vdiod (
V1).


. Pr1
.

. 8.6.
,
.

.

116

..

Qucs FlowCode

Qucs

. 8.7.
, ,
, .
.

. 8.8.
,
I1. (10
) Ib, SW2.
SW1 ( Vp).
, 40 . ,
, .
, ,
, .
117

..

Qucs FlowCode

Qucs



. , , ,
,
.
.

.
,
,
V1.

,

.

. 8.9.
, ,
,
,
.


.
, ,
,
.

. 8.10.
, :
,

,

X.
.
8.11.

118

..

Qucs FlowCode

Qucs

Pr1. ,
, .
. ,
( ).
X
X,
.
,
.
.

. 8.12.
,

. 8.13.
, , .

119

..

Qucs FlowCode

Qucs

. 8.14.
, , ,
Y, .
.

,
Y.

.

. 8.16.


, - . , ,
.
120

..

Qucs FlowCode

Qucs

, ,

.

. 8.17. cap ( )

. , .




.



, -
. .

. 8.18.

121

..

Qucs FlowCode

Qucs

,
, , .
.

. 8.19. ( )

, , ,
. ,
, ,
- .

, .
, . ,
( OpAmps).

122

..

Qucs FlowCode

Qucs

uA741
,

.
,

,

.
.
8.20.


, , :
,
, .

. 8.21.

123

..

Qucs FlowCode

Qucs

.
- R4 R2,
40 . V3 .
, ,
1 . , ,
.

. 8.22. -
, ,
, ( 40 20 ) ,
.
.

. 8.23.
124

..

Qucs FlowCode

Qucs


,
Vout, 100 . ,
.
, .

. 8.24.
V3
, ,
,
1 1 .
,
10 .
,
.
. ,
, .
, , , ,
, ,
,
. ,
, .

125

..

Qucs FlowCode

Qucs

. 8.25.
.
.
, ,
, 1 .

. 8.26.
.

126

..

Qucs FlowCode

Qucs




6.

. 8.27.
.

, ,
. V1,
.

, .

.
. 8.28.
Pr1 100 .

,
,
,
.


.

. 8.29.
- ,
. , 1 100 , ,
. ,

127

..

Qucs FlowCode

Qucs

.
?
, .

.
.
.
. 8.30.


. ,


. ,
,
. 8.31.
,
, . ,
.
.

. 8.32.
128

..

Qucs FlowCode

Qucs

,
.
( ) uA741. ,
(
).

. 8.33.
, -
, RC-. ,
.

,
16 .
. 8.34. -
RC-

,
.
129

..

Qucs FlowCode

Qucs

. 8.35. RC-

. C1, .

. 8.36. C1 = 1
,
.
RC- R1 C1, R2
1 , .

130

..

Qucs FlowCode

Qucs

. 8.37. RC-
, , 8.28. ,

.

. 8.38. RC-
.
, .
C1 1 .

131

..

Qucs FlowCode

Qucs

. 8.39.
.
.
, ,
.

, .

. ,
. .

. 8.40.
132

..

Qucs FlowCode

Qucs

, . ?
.
, . 11.
100 .
. -
. ( ) ,
,
.
, , .
.
,
. 8.26. .


.
.

. 8.41.
8.26

, 2 3 ,
.


,
.

,

.
.
8.42.


,
, ,

133

..

Qucs FlowCode

Qucs

. ,
, , ?

,
.
, ,
.

. .

. ,
. ,

.
,
. .

. 8.43.
134

..

Qucs FlowCode

Qucs

( ).

. 8.44. Transistors
(
) Temp, . 26.85 .
tmp.

. 8.45.

.
.
. ,
. ,
: . ,
, .
, .

135

..

Qucs FlowCode

Qucs

. 8.46.
, : tmp.
,
.
!
, .
, ,
,

.
. 8.47.
, (
) .
. , , F2 ,
,
Pr1.
, 8.43.
, . , ,
( 1 ) .
, . ,
( ,
) .
136

..

Qucs FlowCode

Qucs

. 8.49.
,
.

0.2 . , , .
,
. (
) . ,
.

.


.

.


,
, 40 100.

. 8.50.

137

..

Qucs FlowCode

Qucs

, .
.

coef
.

.
. 8.51. ,


coef.

40-100
.

.

. 8.52.

,
.

. 8.53.
138

..

Qucs FlowCode

Qucs


, ,
. ,
.
,
, . ,
. , ,
; ?
? - , ,
, .
, . , ,
?

, , , ,
555 ( SN74).
55511 ( SN7451).

. 8.54. Qucs
.
y(x1,x2,x3,x4).

. 8.55. 55511
:
.
.
139

..

Qucs FlowCode

Qucs

. 8.56.
, ,
(Truth Table). ( F2
), .

,
.
Qucs

.
() ,
y = NOT (x1x2 + x3x4).
:
Y = NOT (x1x2) *NOT (x3x4)
. 8.57. 8.55

140

..

Qucs FlowCode

Qucs

. 8.58.
.
y = (NOT x1 + NOT x2)(NOT x3 + NOT x4),
.

. 8.59.
, ,
. , , , .
, .
, (, ,
) 555.

141

..

Qucs FlowCode

Qucs

. 8.60. RS- 2-
, TTL KMOS, RS-,
.
, , .
RS-.

. 8.61. RS-
, ,
1, ,
.
142

..

Qucs FlowCode

Qucs

,
. .
Qucs , :
, . 2.51
. ,
, .

. 8.62. 2.51
, ,
,
, D-
.
D- .
, .

. 8.63.
.

143

..

Qucs FlowCode

Qucs

. 8.64.
.

.

144

..

Qucs FlowCode

Qucs

3. Qucs


. , , ,
. ,
, , .
, : ,
.
,
, , .

.
, ,
.
, , ,
.
, ,
, .
, ,
, , .
; ,
, .
,
,
. ,
. Qucs -
.

. 9.1. Qucs
145

..

Qucs FlowCode

Qucs

,
Qucs.

. 9.2. Qucs
, , .
, , ,
,
,
, - .
Qucs. ,
, , ,
, , ,
, , ,
.

146

..

Qucs FlowCode

Qucs

. 9.3.
Qucs ,
.

S1.

. 9.4.


,
, , ,
.

147

..

Qucs FlowCode

Qucs

. 9.5.
,
.
, , , ,
.

. 9.6.
? Qucs.
148

..

Qucs FlowCode

Qucs

, . , ,
, .
?

. 9.7. LC
, ,
LC-.
,
.
. ?

149

..

Qucs FlowCode

Qucs

. 9.8.
, ,
?

. 9.9.
150

..

Qucs FlowCode

Qucs

, .

. 9.10. Qucs
, ,
.

. 9.11. S-

151

..

Qucs FlowCode

Qucs

, .

. 9.12.
: , ,
, Qucs
, .

152

..

Qucs FlowCode

. 9.13. LaTeX
, .

. 9.14.
153

Qucs

..

Qucs FlowCode

Qucs

, ,
, , ..
.
.
, .
.
, , ,
. , ,
, .
Qucs , ,
, . , ,
, , ,
.

. 9.15.
, ,
. ,
, , .

154

..

Qucs FlowCode

Qucs

, , -
.
Qucs, , ,
. ,
,
, .

. .

.
. ,
, : , .
, , ,
. .

. ,
. -
,
. , ,
. 2N2222.

. 9.16. 2N2222
2,68 .
.

155

..

Qucs FlowCode

Qucs

. 9.17. 2N2484
, , ,
, .

. 9.18.
.
156

..

Qucs FlowCode

Qucs

3. Qucs
1.
, ,
. .
,
. .

: ,
; , ; ,
; , .
. 555,
, , ,
.


.
. 10.1.

, ?

.
.
,
(, ,
, ), ,
, .

, .
:

157

..

Qucs FlowCode

Qucs

. 10.2.
. I1 U1
, ; I2 U2 .
,
, .
, h-, y- ..,
.
. ,
:
U1 = h11*I1 + h12*U2
I2 = h21*I1 + h22*U2
h11 , h12 , h21 ,
h22 .
5.2 S-.
H-.

. , ,
.
.

158

..

Qucs FlowCode

Qucs

. 10.3. h-
, .
. .
, ,
, , , , .

159

..

Qucs FlowCode

Qucs

. 10.4.

, .
, ,
.

. 10.5.
-
. , 15 . , ,
, .
.

. 10.6.

160

..

Qucs FlowCode

Qucs


. , ,
. , .

. 10.7.
. , .

. 10.8.

( F9).
161

..

Qucs FlowCode

Qucs

. 10.9.
, .
P1 ( ,
) .

. 10.11. P1
, ,
,
Y.

. 10.12.
162

..

Qucs FlowCode

Qucs

,
, .

. 10.13.
,
, .
,
, .

. 10.14.
?

, .

163

..

Qucs FlowCode

Qucs



.
, ,
.

,
.

. 10.15.

. 10.16.
, .
, , ,
Windows Linux. ,
.
164

..

Qucs FlowCode

Qucs

.
, .
. ,
, ( ).

. 10.17.
, .
, 1 , , , ,
( ).

. 10.18. () ()
, ( 10.13)
.

165

..

Qucs FlowCode

Qucs

. 10.19.
, .
, .
.

. 10.20.
166

..

Qucs FlowCode

Qucs

,
.

. 10.21.
,
, . ,
, .
,
.
, .
,
. ,
, , .
.
, . ,
, .

167

..

Qucs FlowCode

Qucs


,
, SPICE.
SPICE-.
.
MBR951:
********************
.SUBCKT XMBR951 1 2 3
CBPAD 2 1 9E-14
CEPAD 1 3 9E-14
Q1 1 2 3 DMBR951
.ENDS
********************
.MODEL DMBR951 NPN
+ IS = 8.633E-16
+ BF = 105
+ NF = 0.9909
+ VAF = 26
+ IKF = 100
+ ISE = 1E-15
+ NE = 1.356
+ BR = 60
+ NR = 0.9983
+ VAR = 5
+ IKR = 0.022
+ ISC = 1.673E-16
+ NC = 1.076
+ RB = 5
+ IRB = 8E-05
+ RBM = 5
+ RE = 0.33
+ RC = 10
+ XTB = 0
+ EG = 1.11
+ XTI = 3
+ CJE = 2.9E-12
+ VJE = 1.061
+ MJE = 0.5089
+ CJC = 7.3E-13
+ VJC = 0.25
+ MJC = 0.27
+ XCJC = 0.5
+ TF = 9E-12
+ XTF = 500
+ VTF = 3
+ ITF = 1.1
+ PTF = 85
+ TR = 1E-09
+ FC = 0.5

*$
, .cir.
168

..

Qucs FlowCode

Qucs

SPICE
,
.

. 10.22. SPICE
, :
.
, , :

. 10.23.
, . SPICE:
, .SUBCKT XMBR951 1 2 3 . ,
>> :,
, .
,
. , ,
. 1 (),
. .
, .

169

..

Qucs FlowCode

Qucs

. 10.24. , SPICE
.
, ,
, .

. 10.25. LM124
170

..

Qucs FlowCode

Qucs

,
. .

. 10.26.
: VHDL Verilog.
, , VHDL,
Verilog. Verilog:
// Verilog code for AND3 gate
module and3gate (a, b, c, d);
input a, b, c;
output d;
assign d = a & b & c;
endmodule

, , SPICE .
.v, Verilog.
,
, .

171

..

Qucs FlowCode

Qucs

S1-S3
, TruthTable .
, verilog.

. 10.27.
.

. 10.28. Verilog
Verilog.
Verilog
(HDL), .
Verilog HDL, VHDL, ,
(RTL)
. .
Verilog-AMS (Verilog Analog Mixed-Signal Simulation) ,
,
,
172

..

Qucs FlowCode

Qucs

. Verilog-AMS (IEEE
1364, Verilog-D) Verilog-A, ,
, . Verilog-AMS
:
/,
/-rtl/

/-rtl/ . , Verilog-AMS
,
, ,
, , .
Verilog-AMS .
. ++
. /++
Verilog-AMS.
ADMS (. http://mot-adms.sourceforge.net) Verilog-AMS
.
XML ,
.
XML /++ ,
API. :
( ), ;
API;

, Verilog-AMS .
, admst. , , XML
.
admst
API, , ADMS
Verilog-AMS API.
admst .
Verilog-AMS.
module d e v i c e ( node1 , node2 , . . . )
// module d e f i n i t i o n s and code
endmodule

, Verilog ,
, .
Qucs
. ,
.
. VHDL.

173

..

Qucs FlowCode

Qucs

. 10.29.
.vhdl
:
-- VHDL code for AND3 gate
library ieee;
use ieee.std_logic_1164.all;
entity and3gate is port (a, b, c : in std_logic; d : out std_logic);
end and3gate;
architecture
and3gate_arch of and3gate is
begin
d <= a and b and c;
end and3gate_arch;

, VHDL.

174

..

Qucs FlowCode

Qucs

. 10.30. Qucs

, .
.

175

..

Qucs FlowCode

Qucs


, ,
: .
,
, .
, .

. 10.31.

.

176

..

Qucs FlowCode

Qucs

: spectrum =
Time2Freq(out.Vt,time),



out(t),

.

. 10.32.
(spectrum ) ,
.

. 10.33.

. 10.34.

177

..

Qucs FlowCode

Qucs

. 10.35.
, , .
, .
, ,
.

Qucs

ASCO
(http://asco.sourceforge.net/). , ,
, .
ASCO.
Linux ,
Readme, .
Windows.
ASCO, :
http://asco.sourceforge.net/downloads_win32.html

178

..

Qucs FlowCode

Qucs

. 10.36. ASCO
, Readme
Windows:
, asco asco-test
.
: win32 LTspice, HSPICE Qucs.
ltspice, hspice qucsator.
, Qucs.

179

..

Qucs FlowCode

Qucs

. 10.37. ASCO

netlist: () .
, netlist ,
.
, ASCO, , Qucs
.
( Examples ASCO).

180

..

Qucs FlowCode

Qucs

. 10.38. bandpass.sch ASCO


.
,
F .

.

()
,


.


,

,
.

. 10.39.

181

..

Qucs FlowCode

Qucs

. 10.40.
,
( ) .
.
:

. 10.41. . 10.38
182

..

Qucs FlowCode

Qucs

, .,
, (, )
(, , ).
ASCO ,
.

. 10.42.
, ,
, ,
. ,
.
( 10.38), . ,
, ,
, .

183

..

Qucs FlowCode

Qucs

. 10.43.
, , F2 .
, ( Windows Vista, ,
), .

. 10.44.

184

..

Qucs FlowCode

Qucs

.
.

. 10.45.
, Windows Vista
,
.

. 10.46. Qucs
185

..

Qucs FlowCode

Qucs

, , , , -
,
S-. .
(.., )
, - ,
(S-). 5.2.

. 10.47. S-
, S-
.
( ,
).
P1 P2 S-.
( )
. ,
, :
. ,
.
.
. ,
,
, .
,
.
.
,
. Num
186

..
S-.
) S-.

Qucs FlowCode
Z

Qucs

( ) 1
( ) X1
, ,
. , P2
V1.
I1 .
.
S- SP1 .
,
S H- H.
h21 dB.

. 10.48.
S-
( , ), ,
.
S-
. ,
S11 S21.
, .

187

..

Qucs FlowCode

Qucs

. 10.49. S11
Y.

. 10.50. S21
H-, S , (
).

188

..

Qucs FlowCode

Qucs

. 10.51.

. (
: X,
: ) , bjtac.
, , ,
beta_db.
.

189

..

Qucs FlowCode

Qucs

. 10.52.

. 10.53.

190

..

Qucs FlowCode

Qucs

,
. , ,
.

. 10.54. ,
, , 288 .

191

..

Qucs FlowCode

Qucs



, SPICE.
, SPICE, Qucs.
netlist SPICE ,
.
SPICE netlists
.
, Qucs SPICE , netlist
. Qucs SPICE
netlist, Qucs . , , , SPICE netlist Qucs, -,
, , , , , ,
, Qucs SPICE netlist.
SPICE , ,
,
.
SPICE , :







SPICE 2 () 0 9999. SPICE 3
.
. node 0 .

, , 5, 0.5e1 5.0 , .
SPICE : f =1e-15 (femto), p =1e-12 (pico), n = 1e-9 (nano), u = 1e-6 (micro), mil = 25e-6, m =
1e-3 (milli), k =1e3 (kilo), meg = 1e6 (mega), g = 1e9 (giga) t = 1e12 (tera).
.
. : V = Volt, A = Amps.
Hz = Hertz, ohm = Ohm(), H = Henry, F = Farad deg =Degree. SPICE
:
1. , (*),
2.
3.
4. .end
SPICE :
192

..

Qucs FlowCode

Qucs

* A twostage BJT amplifier.


*
* Input node 2, output node 9
* Power supply Vcc connected to node 10
*
c1 2 3 10uf
r1 3 10 200k
r2 3 0 50k
r5 10 4 12k
q1 4 3 5 qmod
r6 5 0 3.6k
c2 4 6 10uf
c4 5 0 15uf
r3 10 6 120k
r4 6 0 30k
r7 10 7 6.8k
q2 7 6 8 qmod
r8 8 0 3.6k
c5 8 0 25uf
c3 7 9 10uf
*
.model qmod npn (is=0.2fa bf=50 br=1 rb=5 rc=1 re=0
+ cje=0.4pf vje=0.8 me=0.4 cjc=0.5pf vjc=0.8 ccs=1pf va=100)
*
.end

netlist , SPICE 2.
,
. , netlist,
, . Qucs SPICE
netlists, , QUCSCONV, SPICE Qucs netlist.
SPICE netlist
Qucs netlist. Qucs netlist Qucs
.
,
SPICE netlist Qucs GUI
( F2).
SPICE netlist Qucs SPICE netlist , ,
,
Qucs , .
BJT .
,
Qucs , .
Qucs SPICE netlist,
Qucs netlist . , netlist, , Qucs
netlist BJT .
, .
193

..

Qucs FlowCode

Qucs

. 10.55. , SPICE-
netlist Qucs, , ,
,
Qucs. , spice- ,
: 100 k 100k .

194

..

Qucs FlowCode

Qucs

2.
Multisim 10
, . , ,
, - . , ,
, Multisim,
, , .

. Proteus . ,
, .
. ,
, ,
.
.
, , Qucs.

. 11.1. Qucs
, ,
. , .
, , Qucs ,
,
, ,
.

195

..

Qucs FlowCode

Qucs


1N4004 Qucs . ?
, .
Qucs . ,
.

. 11.2.
,
, (
input). . Pr1
. ,
, .
( ) ,
,
.

196

..

Qucs FlowCode

Qucs

. 11.3.
.
Vvar, .
, , .

, .
, .

197

..

Qucs FlowCode

Qucs


0.75 V, 0.85 V,
10.

. 11.4.
, .

,

0.75

0.04

0.816

0.18

0.834

0.27

, ,
, . ,
0.85 , 0.25 .
, .
.
,
, 1 , , , ,
.

198

..

Qucs FlowCode

Qucs

( )
, .
( ) ,
, , ,
.
.

.
, ,
, .
( )
.
1N751 (
BZX5V1).

. ,
5.08 , 3 , 5.14
7 . ,
.

. ,
, ,
.

. 11.5.
199

..

Qucs FlowCode

Qucs

4.38

2.6

4.88

18

, .
,
. 5.1 ,
18 5 .
,
. Qucs
, ,
SPICE-:
**********************************
* Model created by *
* Uni.Dipl.-Ing. Arpad Buermen *
* arpad.burmen@ieee.org *
* Copyright: *
* Thomatronik GmbH, Germany *
* info@thomatronik.de *
**********************************
* February 2001
* SPICE3
* anode cathode
* Reverse direction: node 1 <- node 9
.SUBCKT bzx55c5v1 1 9
DF 1 9 DFMOD
.MODEL DFMOD D N = 2 IS = 1.9E-009 RS = 0.36459
+ EG = 1.11 XTI = 3
+ CJO = 1.71713E-010 VJ = 0.490432 M = 0.5 FC = 0.5
+ TT = 1E-008 TNOM = 25
* Leakage
RL 1 9 1.05263E+007 RLMOD
.MODEL RLMOD R TC1 = 0 TC2 = 0 TNOM = 25
* Breakdown
ES 9 90 10 20 1
DR1 90 31 DREV1 TEMP = 25
.MODEL DREV1 D IS = 1E-015 N = 3.95147 RS = 0.00225008 TNOM = 25
VR1 31 1 0.00879249
DR2 90 32 DREV2 TEMP = 25
.MODEL DREV2 D IS = 1E-015 N = 2.92114 RS = 695.888 TNOM = 25
VR2 32 1 0.0793202
VTRIM 20 0 2.95119
IBVC 0 10 0.001
RBVC 10 0 5100 RBVCMOD
.MODEL RBVCMOD R TC1 = 0.00015 TNOM = 25
.ENDS

200

..

Qucs FlowCode

Qucs

. 11.6. SPICE- BZX55C5V1


, .
, . ,
, , , ,
15-20 .

201

..

Qucs FlowCode

Qucs

.
( - )
( -)
.
, .

. 11.7.
-
. , ,
, .
,
, ,
.

202

..

Qucs FlowCode

Qucs

. 11.8. - 2N2222A
, , , 2N2222A,
.
100 1 .
100 , ,
1 .
, .
, ,
.
.
,
, , , .
. ,
, .

203

..

Qucs FlowCode

. 11.9.
, .

. 11.10. 100
204

Qucs

..

Qucs FlowCode

Qucs

, , ,
11.9. . ,
.
, , , ,
. ,
.
.

. 11.11.
-
. (
).
.
, ( , )
. . ,
V2 ( ),
.

205

..

Qucs FlowCode

Qucs

. 11.12.
.

. 11.13.
.
.
.

206

..

Qucs FlowCode

. 11.14.
, .

. 11.15.
207

Qucs

..

Qucs FlowCode

Qucs

3.
, , ,
, . , , , , ,
, ,
. ,
. ,
, .
, (
) , .

. ,
.

, ,
. :
U = dw/dq, U , w , q .
:
I = dq/dt, I , q , t .
:
P = dw/dt, P , w , t .
: P = dw/dt = (dw/dq)(dq/dt) = U*I.
, :

. 12.1. , ,
208

..

Qucs FlowCode

Qucs

,
.
, .
x y,
, . ,
, ,
, , , .


: , ,
, .
, ,
,
. , , ,
: ,
.

, .
,
.
Qucs , ,
.

. 12.2.
209

..

Qucs FlowCode

Qucs

. 12.3.
,
.
.

. 12.4.
210

..

Qucs FlowCode

Qucs

,
, , .


, :
v = iR, v , i , R .

. 12.5.
, , :
.
.

. 12.6.
211

..

Qucs FlowCode

Qucs

, , ,
, .

.

. 12.7.

. , ,
.
. ,
, .
, , ,
, , ,
, .
, ,
.

212

..

Qucs FlowCode

Qucs



.

R = R1 + R2 + + Rn,
, , G = 1/R
.

G = G1 + G2 ++ Gn,
1/R() = 1/R1 + 1/R2 ++ 1/Rn

. 12.8.
, , Pr1 Pr2
, V1
, ,
, ,
.


, .
, .
(
), .
213

..

Qucs FlowCode

Qucs

, ,
.

. 12.9.
Pr1 Pr2 , Pr3 .
,
. .

. 12.10.
214

..

Qucs FlowCode

Qucs


, .
, , ,
.

. 12.11.
Pr1 , .
, , R1-R3 ,
R4 .
, ,
,
, .
.

. 12.11, ,
.
, .
, , ,
, , ,
.
.

215

..

Qucs FlowCode

Qucs

,
, .


, , ,
, .
, , ,
, .
, , ,
, , ,
.
.
, ( ) .
, ( ) .
.
, .
, ,
.
, .
, .
,
.
.

. 12.12.
216

..

Qucs FlowCode

Qucs

, ,
, . ,
. ( I1 !)
. , .
. .

. 12.13.
, (
). ,
. ,
(v1 v2 ).
, , ,
, .
i v1 -10, (
, (v1-10)/1). . :
(v1-10)/1 + v1/5 + (v1-v2)/2 = 0
2:
(v2-v1)/2 + v2/10 2 = 0
, :
v1 = 9.09 V; v2 = 10.91 V
, , ,
. . .

217

..

Qucs FlowCode

Qucs

. 12.14.
v1 v2, .
, ( ),
(, ),
, ( ).

. 2.15.
. , i2
, i1, i3 i4 .
, ,
.

218

..

Qucs FlowCode

Qucs

. 12.16.
, :
i1 = i2 + i3
, :
v1 = i1R1 + i3R3
-v2 = i2R2 i3R3
i3 i1 i2,
, .
i1 i2, i3 .
() ia ib
( ) :
v1 = iaR1 + (ia ib)R3
-v2 = (ib ia)R3 + ibR2
ia ib, :
i1 = ia
i2 = ib
i3 = ia ib
:

219

..

Qucs FlowCode

Qucs

.12 17. Qucs


ia, ib, ic : 5.6 , 2.0 , -0.8 .



. , , , , ,
.
.
, , .

. 12.18.
V1 R1
I1 R2
, ( R3 R4) ,
. , Pr1 Pr2 .
220

..

Qucs FlowCode

Qucs


R3:
I = V1/(R1 + R3)
R2 ( R(I1 I),
) R4 ( IR4),
R4:
I = I1R2/(R2 + R4)
, : R1 = R2 = R,
.
I1 = V1/R
, ,
.
Qucs, R ( ):

. 12.19.
.

221

..

Qucs FlowCode

Qucs


, ,
, .

. 12.20.
Vcc
:

. 12.21.
, , Qucs- ,
.

222

..

Qucs FlowCode

Qucs

. 12.22.
.

. 12.23.

223

..

Qucs FlowCode

. 12.24.

. 12.25.

224

Qucs

..

Qucs FlowCode

. 12.26.

225

Qucs

..

Qucs FlowCode

Qucs

,
, ,
. , ,
. :
v = L (di/dt)
L , v , ,
di/dt .

. 12.27.
, S1, 1 ,
R2
226

..

Qucs FlowCode

Qucs

, ,
, .
:
i = C(dv/dt), , , .

. 12.28.

227

..

Qucs FlowCode

Qucs

.
. , , ,
, , , Qucs
, .
, .
, ?

228

..

Qucs FlowCode

2.
FlowCode

229

FlowCode

..

Qucs FlowCode

FlowCode

2. FlowCode

,
, .
.

, ,
.
,
FlowCode. ,
FlowCode , , ,
.

.
, , .
,
, , ,
;
, .
, ,
USART.
FlowCode
PIC, AVR ARM. , ,
, , ,
, PIC-, AVR .
, FlowCode
, , ,
: , ..
, , , , .
, MPLAB PIC- AVRStudio
AVR, FlowCode
. , - , FlowCode
.
FlowCode, .
, ,
, ,
. , -,
.
, , FlowCode ,
.
230

..

Qucs FlowCode

FlowCode

,
.
: FlowCode,
, FlowCode,
FlowCode , ,
, ( ).
FlowCode , ,
, , FlowCode.
,
: , !. , ,
, USART ,
. ,
, , ?

? , ,
FlowCode.
FlowCode PIC-
MPLAB PICC Lite (HI-TECH).
AVR-.
:

http://www.matrixmultimedia.com/ ( FlowCode)
http://www.microchip.com/ ( MPLAB)
http://www.htsoft.com/products/compilers/PICClite.php ( HI-TECH)
http://sdcc.sourceforge.net/ ( SDCC)
MPLAB
PICC Lite ( ).
SDCC.
( ) ,
FlowCode ( MPLAB, AVRStudio),
.
. ,
, ,
. . ,
, , ,
, .
, ,
,
, ,
.

231

..

Qucs FlowCode

FlowCode

FlowCode
:

. 1.1. - FlowCode
, .

. 1.2. -
, .
, ,
.
. .

232

..

Qucs FlowCode

FlowCode

. 1.3.
( Create a new FlowCode flowchart),
( Flowcode_AVR ).

. 1.4.
. ,
. ,
, ,
, - ,
. , , ,
PIC16F628A, . ,
, FlowCode,
( PIC16F627A) PICC Lite,
, ,
. . , ,
.
. , , . PIC16F628A ,
.
233

..

Qucs FlowCode

FlowCode

. 1.5.
. Main .
Chip , . ,
, .
.

. 1.6. FlowCode
234

..

Qucs FlowCode

FlowCode


, , .


Import.

,
AVR-,
PIC-.

. 1.7. File

: New ; Open...
; Close ; Save ; Save As... - ...,
, ;
Save Image,
, ,
; , Print..., ,
, Print Preview ,
.
Exit.
-:
, , . ,
, , ,
.

235

..

Qucs FlowCode

FlowCode

. 1.8. Edit
, , ,
, ,
, .

: Undo Redo
; Cut ; Copy ; Paste ; Delete
. : Toggle Breakpoint
(
, , , ),
(), , ; Clear All Breakpoints
, .
Variables... ,
, .
, .
Supplementary Code... ( ) (
) , ,
.
Definitions and function declarations (
) Function implementations ( ).
- ,
OK .
FlowCode ,
, ,
, .

236

..

Qucs FlowCode

FlowCode

. 1.9.

,
.
(KeyPad) , Key Mappings... (
) .
.

. 1.10. Key Mappings

237

..

Qucs FlowCode

FlowCode


Properties... (). ,
. , ,
.
. Input ()
, , , Use
Masking.
FlowCode ,
, .
,
, ? ,
, .
( ,
).

. 1.11.
Input

,
: Command Toolbox
( ), Components Toolbox
( ), Chip (,
), Variables (,
), Call Stack ( ), Attached
components ( ,
),
Analogue Inputs ( ).

,
.
Zoom, ,
,
.
. 1.12. View ()
238

..

Qucs FlowCode

FlowCode

Toolbar ( )
Status Bar ( ). ,
, , Options..., ,
Components...
: ,
, .. ,
, -,
, , , .
.
, , ,
FlowCode ;
, -, ,
, ; ,
, .

. 1.13. Macro ()

New... ( ), Show... ( ), Delete... (), Edit Details...


( ), Edit Description... ( ,
), Export... (), Import... ()
().
Go/Continue (/), Step Into ( ,
, ), Step Over ( , ,
), Pause (), Stop ().

. 1.14.


. .

239

..

Qucs FlowCode

FlowCode

Target... ( ), Clock Speed... (


), Configure... ( ), Compile to C...
( ), Compile to Chip... (
), Compile to Hex... ( hex- ),
View C... ( ), View ASM... (
), Compiler Options... ( ).
,
Configure.

. 1.15. Chip

. 1.16. FlowCode
Install PPP 3.9 ,
Next >. ,
FlowCode Common. ,
.

240

..

Qucs FlowCode

FlowCode

, , ,
, .

. 1.17. Window

Help, ,
.

241

..

Qucs FlowCode

FlowCode

. 1.18.
(- , -,
):
Input (), Output (), Delay (), Decision (), Connection Point (
), Loop (), Macro (), Component Macro ( ,
), Calculation (), String Manipulation ( ), Interrupt
(), C Code ( ), Comment ().
, .
.
Input Output
. , , ,
. . ,
. (

Edit->Properties).

. 1.19. Output
Display name: ( ) Output.
, , , . ,
, ,

242

..

Qucs FlowCode

FlowCode

. FlowCode . .
- : svetodiody, , , .
, ( )
. .
.
.

. 1.20.
(Variable or value:),
. Variables
. , ,
, Cancel.
Delay (). ,
, .
.

. 1.21. Delay
, ,
. . seconds,
243

..

Qucs FlowCode

FlowCode

. , Variables,
, , .
, FlowCode ,
, , 0.1 . ,
, .
.
Decision ().
, - .
, , . ,
( ),
. , :

. 1.22. Decision
. (
key_1) , Yes, ,
No. ( )
, , , , , .
, FlowCode,
.
.

244

..

Qucs FlowCode

FlowCode

. 1.23. Decision
Variables, , (
) , .
, , , , ,
.
Swap Yes and No . .
( ) ,
Loop ().
. . .
. ,
, .
, ; ,
, . . ,
. Swap Yes and No,
.

() Yes No.
.
,
. While 1,
.
, ,
, , ,
.
,
,
, , .

.
, ,
:
.
. 1.24.

, , .

245

..

Qucs FlowCode

FlowCode

. 1.25. Loop
, Variables
. ,
. ,
, , , .
, , ,
, .
,
Start. , ,
. End,
, .
.
. , ,
, ,
. Loop count, ,
,
.
Macro (). .
.
,
, . , ,
, ,
. . FlowCode
Macro.

. Macro, .

246

..

Qucs FlowCode

FlowCode

. 1.26. Macro
, . ,
, Create New Macro.

. 1.27.
247

..

Qucs FlowCode

FlowCode

,
( Edit Parameters), ( Edit
Variables), (
), . ,
. OK & Edit Macro,
.

. 1.28.
, ,
FlowCode .
, ,
, :
Calculation () Comment ().
Calculation ,
.
. FlowCode .
,
.

248

..

Qucs FlowCode

FlowCode

. 1.29. Calculation
.

. 1.30. Calculation ()
,
, , , ,
. Variables
.
249

..

Qucs FlowCode

FlowCode

Comment ()
. , (
), , ,
.

. 1.31. Comment
Comment.

. , .
, ,
, , ,
. ,
;
.
,
, , .
, , USART,
RS232.
,
.

250

..

Qucs FlowCode

FlowCode

. 1.32.
,
, : New ( ), Open
( ), Save ( ).
. ,
Examples .

. 1.33. FlowCode
.

. 1.34.
Cut (), Copy (), Paste (), Undo (), Redo ()
. , ,
, .

251

..

Qucs FlowCode

FlowCode

,
:
, , ,
.

. 1.35.
, , .
, , . ,
, .

, ,
.
.

. 1.36.
. ,
, , , ,
( ).
.
252

..

Qucs FlowCode

FlowCode

, , .
Run, .
.
,
Toggle Breakpoint.

. 1.37.
, , ,
, .
,
. . ,
.
.
Toggle Breakpoint . ,
Edit , Clear All Breakpoints.

253

..

Qucs FlowCode

FlowCode

. 1.38. a,
, ,
. Stop Step Into (
). ,
. Step Over , ,
.
.

. 1.39.
.
.
Chip, View C. ,
:

254

..

Qucs FlowCode

FlowCode

. 1.40.
, ,
.

. 1.41.

255

..

Qucs FlowCode

FlowCode

hex- .
, ,
( , View ASM Chip
), hex-.
hex- ,
, . ,
, , hex, , , ()
.
, FlowCode ,
, . , ,
hex- , .

256

..

Qucs FlowCode

FlowCode

Calculation
.
, :
(

<>

- ,

+ -

<

<=

>>

<<

/
>

MOD
>=

NOT AND OR XOR

- , , , ,
- , ; ; , ;
- ,
- NOT(), , ,

:
abs(), round(), floor(), ceil()

fround(,)

mod(), fmod()

sqrt(), cbrt()

log(), log10()

- ( e 10)

exp(), pow(,)

sin(), cos(), tan()

asin(), acos(), atan(), atan2()

sinh(), cosh(), tanh()

asinh(), acosh(), atanh()

fact()

rand()

isnan(), isinf()

- , ,

Help
FlowCode.

257

..

Qucs FlowCode

FlowCode

FlowCode

, .

. 2.1. Examples
.
,

.

. 2.2. ,
, ,
FlowCode , .
258

..

Qucs FlowCode

FlowCode

,
, .
Output.
, ,
. Component Macro.
, ,
. ,
, Component Macro.
.


,
,
,
.

.
LEDOn
() LEDOff
().

. 2.3.
(Parameters) ,
( ).
, ( )
. , ,
, , , ,
, , ,
.

. 2.4.
259

..

Qucs FlowCode

FlowCode

(TUT_02) , .

, TUT_03, ,
.
,
,
.
. 2.5. 5

TUT_05 : , , ,
, Calculation.
TUT_06 , ,
Input Output .

. 2.6.
260

..

Qucs FlowCode

FlowCode

. 2.7.
SWITCHES, Input,
, Output .

. 2.8.
, ,
, ,
, .
:

. 2.9.
(Properties).

261

..

Qucs FlowCode

FlowCode

. 2.10.
, ,
- , , , ,
, , .
LED Labels .
, , ,
, ,
.

. 2.11.
() . , ,
, ,
- .
.

. 2.12.
TUT_08 , .
262

..

Qucs FlowCode

FlowCode

. 2.13.
, , , ,
Calculation ,
, ,
.
TUT_15 , ,
Connection Point.
, , .
Connection Point , .

263

..

Qucs FlowCode

FlowCode

. 2.15.

. 2.16.
Component Macro
TUT_18.
,
.

. 2.17.

264

..

Qucs FlowCode

FlowCode

. 2.18.
(Parameters) COUNT.
( 0 9), .

265

..

Qucs FlowCode

FlowCode


.
,
.
, , , ,
, . -
, .
. ,
,
. ,
. , , ,
, ,
, , .
,
.

. 2.19. Interrupt (e)

266

..

Qucs FlowCode

FlowCode

(Main)
INTERRUPT_TMR0. , ,
Interrupt
.
. ,
, (RB Port
Change).

. 2.20. PIC16F88
TMR0 Overflow ( 0).
Properties ,
. .

. 2.21. ,
(Clock Source Select),
, , ,

267

..

Qucs FlowCode

FlowCode

.
.

. , , ,
Create New Macro (. 2.20), OK & Edit Macro
.
.

. 2.22.
Increment TIMER counter (
).

268

..

Qucs FlowCode

FlowCode

. 2.23.
, Calculation, TIMER
. (
Decision ).

. 2.24.
,
Calculation COUNT
TIMER, ,
1 full cycle.

. 2.25.

269

..

Qucs FlowCode

FlowCode

, Run
Go/Continue Run , .
.
. ( ): , ,
5 .
Increment TIMER counter.
, ,
. ( Stop
) , .

. 2.26.
, ,
,
, .
TUT_20 .
, ,
. ,
, .
, . .
,
?

270

..

Qucs FlowCode

FlowCode

. 2.27.
TUT_20 , .
, .

. 2.28.
Component Connections.

. 2.29.
, ,
. TUT_20 ,
.

. ,

271

..

Qucs FlowCode

FlowCode

, . ,
, . , TUT_21.
.

. 2.30.

. 2.31.
, , ,
. .
.

272

..

Qucs FlowCode

FlowCode

. 2.32.
, Component
Macro. , ,
( ).

. 2.33. LCDDisplay

273

..

Qucs FlowCode

FlowCode

- , ,
, ,
, .

. 2.34.
ACD ,
, , , .

. 2.35. TUT_26
String Manipulation
, .
274

..

Qucs FlowCode

FlowCode

. 2.36. String Manipulation



, , Functions.
, , ,
:

. 2.37. TUT_26
275

..

Qucs FlowCode

FlowCode


, , ,
. , -,
. , , ,
FlowCode, ,
. FlowCode
.


Output. ,
BEGIN-END. . ,
, 0.

:
FlowCode
Chip Compile to C.
: Chip->
View C.

. 3.1. FlowCode

, , (
). :
void main()
{
//Initialisation
cmcon = 0x07;
//Output: 0 -> PORT A
trisa = 0x00;
porta = 0;
}

main . {...}.
. void main ,
. ,
, , .
, 0.
, : , ,
0, 1.

276

..

Qucs FlowCode

FlowCode

Output
:

. 3.2. Output
: 0 Variable or value (
) 1; Entire Port ( ) Single Bit (
) 0 ( , ).
, .
: Chip->Compile to C...
:
void main()
{
//Initialisation
cmcon = 0x07;
//Output: 1 -> A0
trisa = trisa & 0xfe;
if (1)
porta = (porta & 0xfe) | 0x01;
else
porta = porta & 0xfe;
}

1.
, 0 ( , ),
:

277

..

Qucs FlowCode

FlowCode

void main()
{
//Initialisation
cmcon = 0x07;
//Output: 0 -> A0
trisa = trisa & 0xfe;
if (0)
porta = (porta & 0xfe) | 0x01;
else
porta = porta & 0xfe;
}

,
0 1
0.
: 1 , .

. 3.3. 1
, ( ):
void main()
{
//Initialisation
cmcon = 0x07;
//Output: 1 -> A1
trisa = trisa & 0xfd;
if (1)
porta = (porta & 0xfd) | 0x02;
else
porta = porta & 0xfd;
}

FlowCode.
:
1. FlowCode :
278

..

Qucs FlowCode

FlowCode

, Output
: 0, 1 ..
FlowCode,
.
Run ,
.
, .
, . ,
,
.
, ,
.

. 3.4.

( ),
. ,
, .
, :
void main()
{
//Initialisation
cmcon = 0x07;
//Output: 0 -> PORT A
trisa = 0x00;
porta = 0;
}

, , ,
trisa = 0x00; :
, ,
trisa = trisa & 0xfe;

(datasheet), ,
TRISA , . , ,
, , 0, , , 1.
TRISA , .
0 , . ,
, porta = 1;, ,
( RA0) . ,
279

..

Qucs FlowCode

FlowCode

(1) ?
. (
).

. 3.5. ,
, , :
void main()
{
//Initialisation
cmcon = 0x07;
trisa = 0x00;
//Output
porta = 0;
porta = 1;
porta = 3;
porta = 7;
porta = 15;
porta = 31;
porta = 63;
porta = 127;
porta = 255;
}

, , c . , .
? , .
.
. PIC-
MPLAB IDE: http://www.microchip.com/
,
, .
, , HI-TECH (PICC Lite).
, .
, :
http://www.htsoft.com/products/compilers/PICClite.php

280

..

Qucs FlowCode

FlowCode

SDCC, ,
MPLAB,
SDCC: http://sdcc.sourceforge.net/
, MPLAB .
, .
MPLAB PIC.

. 3.6. MPLAB

: Project->Project Wizard.

. 3.7.
281

..

Qucs FlowCode

FlowCode

> :

. 3.8.
PIC16F628A. ,
, PIC16F627A.
. . ,
MPLAB PICC Lite , , ,
, Browse. Show all installed toolsuites,
.

. 3.9.
282

..

Qucs FlowCode

FlowCode

test ,
, .

. 3.10.
, ,
work, .
, , , .
, ,
, >.
, :

. 3.11.
.
.
283

..

Qucs FlowCode

FlowCode

. 3.12.
(Project->Add New File to Project), test.c,
, .
. , .
. Output MPLAB Build
.

. 3.13.
284

..

Qucs FlowCode

FlowCode

:
test.c; 4.1 undefined identifier "cmcon"

, cmcon .
MPLAB ( MPLAB 8.33)

. ,
, .
. ,
.
MPLAB . , . : View>Spicial Function Registers. .
:

. 3.14. MPLAB
: Debugger->Animate.

285

..

Qucs FlowCode

FlowCode

. 3.15. MPLAB
, .
, FlowCode, hex-,
, , , ,
, , .
FlowCode.
, .
.
FlowCode.
, ,
MPLAB. ,
MPLAB, .
, ,
.
. , ,
.

286

..

Qucs FlowCode

FlowCode

()
FlowCode .
. , , , ,
, . , , .
( FlowCode) , ,
. ,
.
,
. , .
( ) : .
,
.
, : .
, ,
, , , . 3.4,
, .
. , ,
:

Loop (), FlowCode


.
,
, BEGINEND.

While.
( )
.

. 3.16. FlowCode

. 3.17.
287

..

Qucs FlowCode

FlowCode

Loop count: .
, . , , ,
.
//Variable declarations ( )
char FCLV_LOOP1;
void main()
{
//Initialisation
cmcon = 0x07;
//Loop: Loop 8 times
for (FCLV_LOOP1=0; FCLV_LOOP1<8; FCLV_LOOP1++)
{
//Output: 1 -> PORT A
trisa = 0x00;
porta = 1;
}
}

, . , ,
. , .
//Variable declarations ( )
char FCLV_LOOP1;

- .
FCLV_LOOP1, , , .
, . char,
. ,
.
:
void main()
{
//Loop: Loop 8 times
for (FCLV_LOOP1=0; FCLV_LOOP1<8; FCLV_LOOP1++)
{
- , ,
}
}

, , , : ,
, . .
for. ,
0 8 .
:
FCLV_LOOP1 = FCLV_LOOP1 + 1;

FCLV_LOOP1++,
, .
, = , ,
. :=.
, , :

288

..

Qucs FlowCode

FlowCode

FCLV_LOOP1<8;

- ,
. , FlowCode, MPLAB
,
MPLAB. , test3.
MPLAB , test3.
,
MPLAB. ,
, .
, , ,
, . FlowCode, ,
, , .
, . , .
:
char leds; //

:
leds = 1 + leds*2;

, :
PORTA = leds;

:
#include <htc.h>
//Variable declarations ( )
char FCLV_LOOP1;
char leds;
void main()
{
//Initialisation
CMCON = 0x07;
//Loop: Loop 8 times
for (FCLV_LOOP1=0; FCLV_LOOP1<8; FCLV_LOOP1++)
{
//Output: leds -> PORT A
TRISA = 0x00;
leds = 1 + leds*2;
PORTA = leds;
}
}

, , :
#include <htc.h>
(Debugger->Animate):

289

..

Qucs FlowCode

FlowCode

. 3.18. MPLAB
hex- : , ,
, ,
(, , ).
, ,
. , FlowCode
MPLAB, :
.
,
.

. 3.19.

290

..

Qucs FlowCode

FlowCode

, :

. 3.20.
Add New Variable, .
.

. 3.21.
, , leds, Byte.
, .

. 3.22. Output
, Calculation FlowCode,
leds:

. 3.23.
FlowCode :

291

..

Qucs FlowCode

FlowCode

.
,
FlowCode BEGIN-END.
,
for, FlowCode Loop.
,
FlowCode .
, FlowCode
leds .
, FlowCode
.
, ?
. 3.24. FlowCode

, leds = 1 + leds*2 ,
? , ,
. , ? . , ,
. , 1, 3, 7, 15 ..,
. ,
,
( !).
.

. 3.25.


FlowCode

292

..

Qucs FlowCode

FlowCode

- ,
. ( )
Delay (). Calculation,
.
. 300 , , ,
( Run->Go/Continue
) FlowCode , .
. ,
FlowCode .
, , , :
//Delay: 300 ms
delay_ms(255);
delay_ms(45);

, FlowCode, .
FlowCode , delay_ms()
. MPLAB . ,
, ,
. .
, -
.
, ,
.
#include <htc.h>
//Variable declarations ( )
char FCLV_LOOP1;
char leds;
int dl;
void main()
{
CMCON = 0x07;
for (FCLV_LOOP1=0; FCLV_LOOP1<8; FCLV_LOOP1++)
{
TRISA = 0x00;
leds = 1 + leds*2;
PORTA = leds;
for (dl=0; dl<=10000; dl++){}
}
}

dl int ().
.
, ,
, . ,
. ,
HI-TECH MPLAB.
, htc.h.
, , ,
:

293

..

Qucs FlowCode

FlowCode

#include <htc.h>
#define _XTAL_FREQ 4000000
//Variable declarations ( )
char FCLV_LOOP1;
char leds;
void main()
{
//Initialisation
CMCON = 0x07;
//Loop: Loop 8 times
for (FCLV_LOOP1=0; FCLV_LOOP1<8; FCLV_LOOP1++)
{
//Output: leds -> PORT A
TRISA = 0x00;
leds = 1 + leds*2;
PORTA = leds;
__delay_ms(100);
}
}

100 , :
#define _XTAL_FREQ 4000000

4 . PIC16F628A ,
, , 4 .
, 300 ,
:
char i;
for (i=0; i<3; i++) __delay_ms(100);

FlowCode

. MPLAB .
.
FlowCode ,
MPLAB,
. , hex-, ,
,
while. , , .
FlowCode.

294

..

Qucs FlowCode

FlowCode

, , , ,
. , -
, , ,
. . , ,
SOME, , ,
.
Decision FlowCode, ,
, :
if (FCV_SOME == 1)
{
//
} else {
//
}

: ( ), .
, .
, .
, , ,
.
FlowCode
, ( Input).
, , ,
. .
, , , , ,
, ,
.
,
( GOTO). , ,
. ,

, ,
.
, , ,
, , ,
.

295

..

Qucs FlowCode

FlowCode

FlowCode Macro.

. 3.26. FlowCode
.

, ,
(Call Macro). .

. 3.27.

,
. , Create New Macro,
.

. 3.28. Macro
.

296

..

Qucs FlowCode

FlowCode

. 3.29.
, .
, (Chip->Compile to C).
, ,
, , .
//Macro function declarations ()
void FCM_loop();
//Macro implementations ()
void FCM_loop()
{
}
void main()
{
//Initialisation
cmcon = 0x07;
//Call Macro
//Call Macro: loop ( )
FCM_loop();
}

, .

, . ,
, ,
?
OK &
Edit Macro (. 328).
loop.
, ,
, . ,

, .
Macro,
, .
.

. 3.30.

297

..

Qucs FlowCode

FlowCode

. 3.31.
, FlowCode
, , .
(
, ).
. ,
FlowCode. , ?
//Macro implementations ()
void FCM_loop()
{
//Loop
//Loop: Loop 8 times
for (FCLV_LOOP1=0; FCLV_LOOP1<8; FCLV_LOOP1++)
{
//Calculation
//Calculation:
// leds = 1 + leds * 2
FCV_LEDS = 1 + FCV_LEDS * 2;

298

..

Qucs FlowCode

FlowCode

//Output
//Output: leds -> PORT A
trisa = 0x00;
porta = FCV_LEDS;
//Delay
//Delay: 300 ms
delay_ms(255);
delay_ms(45);

}
.
FlowCode , , ,
,
MPLAB.
FlowCode,
Output. Input ,
.
: . ,
. ,
, , .
. ,
- .
, , ,
Input
, BEGIN-END.

, .
, ,
, ,
,

. 3.32. Input

. 3.33.
,
. ,
299

..

Qucs FlowCode

FlowCode

Variables .
key, .
, (Chip->Compile to C).
, , , :
//Variable declarations
char FCV_KEY;
void main()
{
//Initialisation
cmcon = 0x07;
//Input: PORT A -> key
trisa = trisa | 0xff;
FCV_KEY = porta;
}

: trisa = trisa | 0xff;


trisa ff,
, , , .
, , ,
- , .
, , ,
. ,
. , , .
, Interrupt.

. 3.34. Interrupt
, ,
- . .
PIC16F628A , .

300

..

Qucs FlowCode

FlowCode

. 3.35.
,
, . , ,
, ,
Create New Macro ( ).
key_intr, , .

. 3.36.

301

..

Qucs FlowCode

FlowCode

( Edit Variables) , ,
, key. ,
, ,
.
Calculation.

. 3.37.
Calculation :

. 3.38. Calculation
, light, , ,
, , . ,
(Edit->Variables), light.
, , ,
, :

302

..

Qucs FlowCode

FlowCode

, , , ,
- ,
.
, , ,
, .
, ,
.
While ,
. ,
Switches, ,
light key.
. 3.39.

. 3.40. Switches
,
, light .
, , key ,
. Calculation
light. . ,
, .

303

..

Qucs FlowCode

. 3.41.

304

FlowCode

..

Qucs FlowCode

. 3.42.

305

FlowCode

..

Qucs FlowCode

FlowCode

, , :
//Macro function declarations
void FCM_key_intr();
//Variable declarations
char FCV_LIGHT;
//Macro implementations
void FCM_key_intr()
{
//Local variable definitions
char FCL_KEY;
//Calculation:
// key_intr.key = key_intr.key + 1
// light = key_intr.key
FCL_KEY = FCL_KEY + 1;
FCV_LIGHT = FCL_KEY;
}
void main()
{
//Initialisation
cmcon = 0x07;
//Interrupt initialisation code
option_reg = 0xC0;
//Loop
//Loop: While 1
while (1)
{
//Interrupt: Enable RB0/INT
option_reg.INTEDG=1;
intcon.GIE=1;
intcon.INTE=1;
//Output: light -> PORT A
trisa = 0x00;
porta = FCV_LIGHT;
}

}
, MPLAB (
AVRStudio), , . MPLAB
PICkit 2 ( PICkit 3), USB .
, FlowCode.
, ,
. (Chip>Configure).

306

..

Qucs FlowCode

FlowCode

. 3.43.
Options :

. 3.44.
USB ,
, LPT. , ,
FlowCode, :
http://microsin.ru/content/view/820/1/

307

..

Qucs FlowCode

FlowCode

USART PWM
PIC16F628A,, , ,
USART.
RS232 ,
USART.

. 3.45. RS232 USART


, RS232 ( ),
Component Macro. - :

. 3.46. , USART
, , ,
? : N, (
) 0 ; F, (
) 0 .

308

..

Qucs FlowCode

FlowCode

Component Macro .
() , Variables inp
0.

. 3.47. Component Macro RS232


,
.
, N
0 . , , ,
; , ,
, . F
, .
,
, , ,
, - : , ,
. , .

309

..

Qucs FlowCode

FlowCode

Component Macro,
RS232, inp.

, .
N, 1,
.
, inp
F.
0.
While
, , .

. 3.48.

,
, +, ,
(Run->Go/Continue , F5 ,
Run ).

310

..

Qucs FlowCode

FlowCode

. 3.49.
+ Characters in queue, .
, ,
Characters Received, 0 .
, F, .
, USART, .
:
N F.
, , ,
, . inp,
. , flag,
0 1 .
out. ,
.
. , ( Loop).
, Calculation, flag
. ( Input)
311

..

Qucs FlowCode

FlowCode

0 : ,
, , .
? flag:
flag = ( NOT flag ) AND 1,
Calculation. FlowCode
, ( NOT), ,
.
flag = NOT flag,
: 0 255.
N, flag 1, F,
.
, Component Macro
RS232. out.

. 3.50. RS232
, , ,
, . , ,
.
:

312

..

Qucs FlowCode

FlowCode

. 3.51. , USART
, 0.
, , ,
FlowCode. ,
.
,
, . PWM, PIC16F628A.
. ,
3 , , ,
FlowCode.

313

..

Qucs FlowCode

FlowCode

. 3.52. (- )
, : ,
Component Macro Calculation,
fst .
Component Macro .


, ,
.

. 3.53.
PWM

314

..

Qucs FlowCode

FlowCode

( Component Macro) .

. 3.54. fst
,
.
, FlowCode
, . ,
PIC-, ,
AVR-, .
-
FlowCode, ( ).
.

315

..

Qucs FlowCode

FlowCode

FlowCode

, ,
- .
,
RJ45. , . ,
.
, , .
, : , .
, 1.5-2 .
: (Master)
(Slave). RJ45
.
. ,
.
. :
Master

Slave

+5

:
, .
,
:

. 4.1.
316

..

Qucs FlowCode

FlowCode

( ) Pr1-4, ,
V1 . ,
, :
, . FlowCode:

( Loop)
( Loop) ,
1 ( Calculation), 1
2 ( Calculation).
: ,
. HI-TECH
. ,
FlowCode .
:
#include <htc.h>
#define _XTAL_FREQ 4000000
void main()
{
char out;
char i;
char k;
CMCON = 0x07;
while (1) {
out = 1;
for (i=0;i<8;i++) {
TRISA = 0x00;
PORTA = out;
for(k=0;k<10;k++) {
__delay_ms(100);
}
out = out*2;
}
}
}

. 4.2.
MPLAB: ,
.

317

..

Qucs FlowCode

. 4.3. MPLAB
.

. 4.4. Proteus
318

FlowCode

..

Qucs FlowCode

FlowCode

, . ,
, . , ,
, ,
..
, ,
, . ,
, ,
.
, - , .
, , , FlowCode, , .
.


: ,
. ,
.
? ,
, , .
, :
char FCV_IN;
void main()
{
//Input: B0 -> in
trisb = trisb | 0x01;
FCV_IN = (portb & 0x01);
}

( Input) , char
FCV_IN. RB0 , trisb
= trisb | 0x01. , , ,
RB0.
, :
if (FCV_IN == 1)
{
//
} else {
//
}

FlowCode :

319

..

Qucs FlowCode

FlowCode

Input,
,
Decision,


.
,

MPLAB.
,
, ,
.
,
. ,
:

.
,
, . (
)
,
( )
.
.
,
,
, ,
,
.

, FlowCode.
. 4.5.

320

..

Qucs FlowCode

FlowCode


,
, ,
. . .
FlowCode
, USART PWM. , ,
HI-TECH, , .
.
, ,
, , ,
,
, . , ,
, . , ,
, , , .
.
, , ,
. .
, ,
.
.
. , ,
, , ,
. .

. 4.6.

321

..

Qucs FlowCode

FlowCode

RA0 RA,
RB0 RB1, S1-S4.
. -
:

,
.
. ,
.

key1 - key4
,

.
,
FlowCode -

.

.
, ,
-
,
.
,


MPLAB Proteus.
FlowCode

KeyPad.

. 4.7. -

322

..

Qucs FlowCode

FlowCode

, KeyPad
.
Component Macro, ,
, .

. 4.8. KeyPad
key.
.
:

. 4.9. FlowCode
323

..

Qucs FlowCode

FlowCode


, - ,
. ,
, .
.

. 4.10. RB0
FlowCode
.
, :

324

..

Qucs FlowCode

FlowCode

. 4.11.
, , .
, ,
. , :
, FlowCode, .
FlowCode, , . ,
FlowCode,
,
.
, , :
//Interrupt initialisation code
option_reg = 0xC0;
//Interrupt: Enable RB0/INT
option_reg.INTEDG=1;
intcon.GIE=1;
intcon.INTE=1;

:
void interrupt(void)
{
if (intcon & (1 << INTF))
{
FCM_display();
clear_bit(intcon, INTF);
}
}

325

..

Qucs FlowCode

FlowCode

FCM_display() :
void FCM_display()
{
//Calculation: num = num + 1
FCV_NUM = FCV_NUM + 1;
//Calculation:
// num3 = num / 1000
// num2 = (num - num3 * 1000 ) / 100
// num1 = (num - num3 * 1000 - num2 * 100 ) / 10
// num0 = (num - num3 * 1000 - num2 * 100 - num1 * 10 )
FCV_NUM3 = FCV_NUM / 1000;
FCV_NUM2 = (FCV_NUM - FCV_NUM3 * 1000 ) / 100;
FCV_NUM1 = (FCV_NUM - FCV_NUM3 * 1000 - FCV_NUM2 * 100 ) / 10;
FCV_NUM0 = (FCV_NUM - FCV_NUM3 * 1000 - FCV_NUM2 * 100 - FCV_NUM1 * 10);
}

, ,
, .
, , ,
, . , , , , ,
, , ,
. , ,
.
. .
,
, .
FlowCode
, ;
.
, FlowCode
, ,
. , ,
, ,
, , .

326

..

Qucs FlowCode

FlowCode


, , , FlowCode,
, ,
, , .
,
. , , ..
, - . ,
, ,
.
,
, , .
, : ,

. .
,
. ?
:
, .
, ,
.
,
, , .
.
. 4.
, , .
2, , ,
. , , ,
, . ,
, . ,
1, 1, ( ) :

. 4.12.
25 .
,
:
327

..

Qucs FlowCode

FlowCode

,
.
,
( ).
,
, .
,
( )
. key.
.
,
key AND mask, mask
, ( ) .

. , ,
.
.

. 4.13. ,

cod_out Calculation.
.

. 4.14.

328

..

Qucs FlowCode

FlowCode

. 4.15.
, , ,
.
.
,
25 . :
. , ,
.
307. , .
307 100 10
20 . ,
, RA0 ,
.

329

..

Qucs FlowCode

FlowCode

, FlowCode
.
, FlowCode.
, , ,
.
RA0 ,
? ,
, TSOP 36-38 ,
27 . 100 ,
5 ( ) 20 .
, :

, ,
.
, !.. FlowCode
.
,
, PICC Lite.
, ,
.

, .
.

. 4.16.
- , ,
,
,
.
,
.
, . ,
, .
,
, , .

330

..

Qucs FlowCode

FlowCode


, , , ,
, , ,
,
. , .
, , ,
.
, . ,
TSOP, ,
4.12. (
).


RB0.

,
, ,
4 ,
3.5
.

,
, .
0.5
.


,
. 0.5
.

. 4.17.

0.5 . ,
.

331

..

Qucs FlowCode

FlowCode

RB0 (,
RB0).

. 4.18.
.
( , While input = 1
) 16000. 4 , 0.25 .
,
, , :

. 4.19.
332

..

Qucs FlowCode

FlowCode


.
, , .
,
.
, , , :
, ,
.

333

..

Qucs FlowCode

FlowCode

FlowCode
, ,
, .

. 5.1. FlowCode

, .
. ,
.

. 5.2.
334

..

Qucs FlowCode

FlowCode

Delay.

. 5.3. Delay
Switch.

. 5.4. Switch
.

. 5.5. Switch
335

..

Qucs FlowCode

FlowCode

. ,
Connections
.

. 5.6.
. Connection
, Ext Properties
.

. 5.7.
336

..

Qucs FlowCode

FlowCode

, , ,
: .
,
,
Component Macro. .
, , .

. 5.8.
:

. 5.9.
337

..

Qucs FlowCode

FlowCode

. 5.10. (Floating )

.

. 5.11.
, , , ,
. , , Help .
:

, Stepper, Servo, Speech


, ADC, RS232, I2C, PWM


338

..

Qucs FlowCode

FlowCode

FlowCode
(ICD)

ICD

ICD





ASCII

FlowCode

, , . , .

339

..

Qucs FlowCode

. 5.12. FlowCode

340

FlowCode

..

Qucs FlowCode

FlowCode

Proteus
ISIS.
FlowCode, , .
FlowCode . ,
, ,
Proteus, .

, , , , ,
, . , , ,
, .
.
. FlowCode. , ,
. : E F.
PIC16F628A. E , ,
, . ...
Proteus.

. 5.13. Proteus
Proteus F . , ,
, . , ,
, . ,
341

..

Qucs FlowCode

FlowCode

, , , ,
, .


( ).

, 3
.
,
, ,
.

, ,
PIC16F628, , ,
. ,
( ),
/.
hex- .

. 5.14.

hex- Proteus,

342

..

Qucs FlowCode

FlowCode

. 5.15. Proteus
... , . .
ISIS (Proteus). . .
. ( ?!)
.

. 5.16. Proteus
Proteus Linux, .
, :

343

..

Qucs FlowCode

FlowCode

. 5.17. Proteus
( ,
) , Optoelectronics
: 7SEG-MPX4-CA ( ) 7SEG-MPX4-CC
( ). , .
.

. 5.18.
.

344

..

Qucs FlowCode

FlowCode

. 5.19.
hex-,
Proteus, . , , ...
, . , , F .
Proteus , , ,
( Debug).
, .
. , ,
, .
: , .
Proteus, , .
, ,
. , -
, .

345

..

Qucs FlowCode

FlowCode

. 5.20. Proteus
Start/Restart Debugging,
, .
.
. , .
, ,
. .
.
, , ,
, : , , ,
.

346

..

Qucs FlowCode

FlowCode

. 5.21.
, , .
(, F11 ),
Step Over ( F10) Step Out, ( Ctrl+F11), , ,
.

. 5.22.
, , :

347

..

Qucs FlowCode

FlowCode

. 5.23.
, , , ...
. , : Proteus
, .

. 5.24. Proteus
, , ,
, . , .
,
RA5
.
348

..

Qucs FlowCode

FlowCode

, FlowCode. ,
. ,
5.14, .
#include <htc.h>
#define _XTAL_FREQ 4000000
void main()
{
char i;
while (1) {
CMCON = 0x07;
TRISA = 0x00;
PORTA = 0xFF;
for (i=0;i<30;i++) {
__delay_ms(100);
}
TRISA = 0x00;
PORTA = 0x00;
for (i=0;i<30;i++) {
__delay_ms(100);
}
}

}
, MPLAB, ,
.

. 5.25. MPLAB
349

..

Qucs FlowCode

FlowCode

, ,
, RA5 (
, FF, DF).
, , , , RA5,
, :
RA5 is a Schmitt Trigger input only and has no output driver (RA5
)
,
RA5/MCLR pin function is digital Input ( RA5/MCLR ).
, -
Proteus ,
FlowCode, .
, .
. .
, FlowCode.
, - , ,
. - .
, , FlowCode . .
, FlowCode, . ?

350

..

Qucs FlowCode

FlowCode


, ,
, .
,
.., AVR PIC ,
-. , ( )
, .
. .
SOS.
#include <18F458.h>
#use delay(clock=20000000)
#fuses HS,NOWDT
void Pause(int ms)
{
output_D(0xFF);
delay_ms(ms);
}
void P(void)
{
output_D(0);
delay_ms(5);
Pause(5);
}

//
//

//
//
//

void D(void)
{
output_D(0);
//
delay_ms(20); //
Pause(5);
//
}
int main (void)
{
set_tris_D(0xFF); // D
while(1)
//
{
P(); P(); P(); //. . .
D(); D(); D(); //- - P(); P(); P(); //. . .
Pause(100);
}
}

, FlowCode, :
P, D, P Pause.
FlowCode,
. ,
, Pause Delay.
.
:
351

..

Qucs FlowCode

FlowCode

,
P, .
D.
P.
5 .

1 ,
3 .
FlowCode
.
( )
, .
, , .

,
.

, OK&Edit Macro
Macro Show,
. ,
Macro.
:
. ( FlowCode)

.

. 5.26. SOS FlowCode


( P)
:

352

..

Qucs FlowCode

FlowCode

-
.
Pause, ,

1 ,
.

. 5.27.
D ,
, .
:

. 5.28. SOS
FlowCode PIC, AVR ,
,
.
, :
353

..

Qucs FlowCode

FlowCode

, D -
. " "
, ,
.
, 7 .
"" ( 0
127).
CD-, :
#include <avr/io.h>
#include <avr/delay.h>
unsigned long DelayCount;
unsigned long Velocity = 0;
unsigned char EyeType = 0;
void ShowEyes(int i)
{
if(EyeType) PORTD = ~i; else PORTD = i;
_delay_loop_2(DelayCount);
}
int main (void)
{
DDRB = 0x00;
DDRD = 0xFF;
while(1)
{
Velocity = PINB;
if(Velocity > 127)
{
Velocity -= 127;
EyeType = 1;
}
else EyeType = 0;
DelayCount = 500 + (Velocity * 50);
for(int i = 1; i <= 8; i = i*2) ShowEyes(i * 16 + i);
for(int i = 8; i > 1; i -= i/2) ShowEyes(i * 16 + i);
}
}

, ,
, , , ,
.

354

..

Qucs FlowCode

FlowCode

. 2.29.
, , ,
. , ,
, .
.

355

..

Qucs FlowCode

FlowCode

. 2.30.
, 0 .
RB0.
,
, . ,
, .

356

..

Qucs FlowCode

FlowCode

. 2.31.
, , ,
, , ,
.
, ,
Delay .
,
..
.

357

..

Qucs FlowCode

FlowCode

? . , ,
FlowCode. ..,
, ,
,
.

, , . ,
Linux, ,
, FlowCode, ,
KTechlab.
, , , ,
.
,
, , .
, ,
, ,
, ,
, , ,
.

358

Вам также может понравиться