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

517.977.

05.13.03

:
,
. .

- 2002

. 4
5
1..................................................................................................................................................................11

..........................................................................................................................11
1.1.
1.2.

..............................11

................................................................................................................................36

1.3.

..........................................................................................................................38

1.4.

..................................................................................................................39

1. 5.

..................................................................................................................41

1.6.

............................................................................................................................43

1.7. ..................................................................................................................................................44
2..................................................................................................................................................................46
..........................................................................46
2.1.
2.2.

.....................................................................................46

..................................................................................48

2.3. ..................................................................................................................................................74
3..................................................................................................................................................................78

..............................................................................................................78
3.1.
3.2.

...............................................78

.................................80

3.3.

...........................................................................................90

3.4.

.................................................................................................................95

3.5.

....................................................................................................................96

4...............................................................................................................................................................105
......................................105
4.1. ......................................................................................................................................105
4.2.

..........................................................................................................................105

4.3. ...............................................................................................................................................110
4.4.

................................................................................................................117

3
4.5.

.............................................121

4.6. ................................................................................................................................................124

.....130
......132
....... 140

,
. (
)
, ,
.
, ,
,
,

.

[1] .

13

[2], .. 13 . -.
, ,
70 .
11 . .
17 % ,
5 % - [3], 550
217 . 20 %
, 40 % -
20 % -
.
Philips [4],

:

6
- 4,5 %, - 5 %, - 4
%, - 3,5 %, - 3,3 %, - 2 %.
1 20 %
.

.
,
, 50 % [5-8]. [2]
: 30 %
, 50
/ (, ,
).

60-70 % [9-11].
- 25 %.
- - 2060% [3].

.
,


, ,
: ,
.

, ,

, ,
.

7
[12],


.
:

;
;
;

(),

;
.

,
.
:

();
;
,

;

8
,
.

,
,

. :

, ;
,
;
,
;
;
,
.

.
:
1. :
-

,
;

2. :
-

;
-

,
;

. 128 ,
41 , 7 , 95
26 .


. ,


. ,
,


.

:

.
,

10

, .
.
,

. ,
.
:
, ,
, .
,
.

(),
. ,
. .

, "-" (),
.
.

.
, :
, .
.
.

11


.
.

(1998 - 2001 .),
" - 2000" (, 1999 .).
,


.
,

,
,
,
.

1


1.1.

1.1.1.

.
,
.

; [9]
, . 1.1.

12

1.1

(),

, ,

[4,16,19]

.

.

,

. ,
,

()

() ,
.

10 45 % [3, 9],
, ..
.

13

[18-24].
- .

( 1, 3, 4 . 1.1).


.
: , , 25
75 %.

[25, 26].

; ,
- .
, ..
,
. , ,
, 25-30 % .
,

;
, ,

1220 %.
, ,
,
[25].
15

14
,
.
10%.
.
,

40-50 %,
-
.
,
( )
[25].
; ,
() ,
, 80 %,
, . , 10-12

.
,
,

.
, ,
. , ,
,

[27].

, :
;
;

15

( )
.
:
.
;
.

.
,
. :
,
.
,
, [2, 18, 19].


[19]:
, . ,
, ,
() ,
, ,
.
1. .
,

, ,
, ,

.

16
2. .
, , ,
(
,
, ). , ,
, ,
.
- ,
. ,

,
( ).
1.1.2. .

. ,
1993 [2] 2,5 . (600
, 85 ), 85 .
,

48

, , 20
, - 35, - 6.

: 150 .
. 75 % ,
, .
30 /, ,
,
40 /.
1 1980 .
II-4-79

17
[28],
. , [28],
,
. 30

[2],

70

. , 175000
;
, .

, ;
,

,
). ,

.

,
;
,

: -,

,
, -

18
; -,

,
,
.
,

,
.


, ,
.

, [25].

.
,
. , ,

.
.
100 % ,
.

,

.
. ,
,

19
.
10-15- .
1989 , ,

.

:
, ,
50 %
, 1978-87 .,
, ,
25 %

.

[6, 7, 29-33, 3840, 95]. ,
, [31, 35,
36, 41].
1.1.3.
. ,

. ,

, .

, .

20

,

,
: , ;
;
, .

()
()
[23].

-,

, 9,4
(
).

. , -
, ,

.

[23].

( 25 40 ).
.
,
, . ,
.
,
.
, ( , )
,

21
, , .
[42]:
, , ,
, .
,
.
,
, ..
.

, (

),
.

, ,
. 1.1 ( ELS [43]).
, , ,
70 %
.

, ,
[43, 44, 46-50].

-
.
,

. -
,
;

22
, .
:
-
.
.

. 1.1. .
-
, - .
:
, .

.

[21].
1.

. (

) ,

,
, ,
. :
, ,
.
2.

23
.
, .
: 24 , 7 , 1 , 4 .

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

, ,

,
.

.
. ,
, ,
, .

24

[45, 51]:

25 %, ,
:
20, 50
100 .

. ,
,

.
,
.

[52].


.
.

.

.
. ,


.

, .

25
. ,

, , ,

1020

[18].

.
,
[25]:



,
.

, ,
.

- ,
.


( ,
) ( ..).

1045
%.
1.1.4.

, ( )

[44].

26

.
, (
) (. . 1.1).

, (., , [44])
: ,
,

, .

- .
- .
,
,
.

.

.
.
,
:
, ,
;

, :
, , ;
, ..
;

27
,
: , .. -
, ,
,
.


. , ,
,
.
,
,

( , ).

[13].
1.


.
2.

,
, ,
.
-

(,

-).


.

.

28
1.
, ,
,
[53]. ,
[54].
2.

[55, 56].
3.
-,
[57].
4.
[58].
(. , )

[13-15].

E = ( E ) ,
(E ) ,
.
:
t , E = 0.
E > 0.
[15]

LabView.

) 10 50 %
.

29


. , [59]

,
:

E1 = 1 ( E )
E 2 = 2 ( E )
E3 = 3 ( E ) .

, (30
40 %), (16 22 %)
, .
[44] MIMO 101,

.

, ,
, . ,
,
, ,
,
.
,

, .
,
.

30

.
IMAGINE
Electrosonic,
.

, [20, 44], .
.
, -

[60]. ,
(, , ..),
. ,

.
:
, ;

, , ,
.
, , .

,
. ,
, :

: , ,
;

(
);

:
30 ;

31

,
(Intranet Internet);

,
.

, ..
.
[61]:
,
- ,


.

,

,
.

C-bus [62],
.
-
.
, ,
20...60 %.

32

.
,
[20, 25, 59], -

, ,

.
() .

-
[27]. ,

(
).

, -
.


. ,
, [63-67].
, ,
. [9],

33
, (
),
.

. , ,
,
.

[44]

, ,

,
,
.
.
,
,
.
:
1. ,

2. : (
),
( )
,

.

.
1.1.5. .
, ,

34
,
.
1.

, .

,
,
.
,
.

, .
2. , ..
,
:


[20];

[25].

3. ,

.
4. ,

.

.
1. "" "":

35

[44].
; ,
" " - "
".
.
.
2.

[25].

, .

.
, , , ""

.
3.
, [54, 68, 69].
,
, , , . .

:
, ..
4. [2, 70-74],

. , ,

, (
) .

36
1.2.
,
, .
.
, .

(X,Y,Z), () .

,
( )
. (0;0;0)
.
.

1.2

. M
, ( ).
, ,

. ,
, , ,
.
.

37

Y
3

. 1.2. .

38

, .
.
. j- (j = 1M).
1. 1 :
(X j ,Y j , Z j ).
2.
- , (X j , Y j , Z j ).
:
(X nj , Y nj , Z nj ).
3. :
Ej .
1.3.
, ,
[28, 37].
,

,
.
,
E i = (E i1 , E i2 , ... E iM ),

i = 1, 2, ... N t ,

(1.1)

E ik - , ,

k- , t i t i ;
Nt

(1.1).
1

, -

39
(1.1)
[28] ,
t i < t < t i + t i .
, ,
, ,
E i E i+1 . ,

(1.1)


E = (E 1 , E 2 , ... E M ).
1.4.

, () .

E = (E 1, E 2, ... E H),

E h - , h- ,
H - .

, .
,

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

40

,
8 500
8 000
7 500
7 000
6 500
6 000
5 500
5 000
4 500
4 000
3 500
3 000
2 500
2 000
1 500
1 000
500
0
7

10

11

12

13

14

15

16

17

18

. 1.3. .

19

t,

41

E = (E 1 , E 2 , ... E M ),
E j - j- :
H

E = E
h ehj ,
e
j

h=1

e hj [75] j-

h- ().
1. 5.

K . i
Q i .
,
.
, : , ,
.


[75].

q-

i-

:
(x q, y q, z q), q = 1 ... Q i .
, :
(x q, y q), q = 1 ... Q i .
,

x q = y q = 0.

42
, ,
.
, ,
- ,
( (x q, y q, z q)) .
:
(x nq, y nq, z nq), q = 1 ... Q i .

, .

I,

:
S = (s 1, s 2 , ... s ),
s i - i- ,
0 L. s i = 0 i- .
i- s i = r

r .
L .
/ L = 1.
0 =0, 1 =1. L
, .

43


, L =
15.
,
:
U = (U 1 , U 2 , ... U K),
U i - i- ,
:
0, 1 U i , 2 U i , ... L-1 U i ,
U i

i- ,

r -

r.
s i = 0, U i = 0.
I i .
, , :
N = (N 1 , N 2 , ... N K),
N i - , i- ,
N i = Si U i I i .
i- s i = r
,

,
i (r) : E = E i i (r).
i (r)
.
1.6.

44
K

N
i =1

min

(1.2)

:
, :

Ej E j, j = 1 ... M.

(1.3)

N
i =1

t
. 1.4. .

Ej

Ej

j = 1M

. 1.5. .
1.7.

45
, ,
.

.

.

, ,
.

()

, ..

.
.
1. ,
.
2. .
3. ,
.

[76, 77].
,
.
.


, .

46

2

2.1.

[78,

79].

, .
:

( )

);

;

.
. 2.1.

47

...

...

1E

...

...

ME

1
...

. 2.1.

...

ei l

NK

N1

pi j

...

sK

...

...

s1

48
:


,
.
(

1.1.4)

,
: .

[80].
2.2. .
, ,
. ,

.
.
1. E , .
2. E .

, S
.
:
.

. -,

49

:
i (r) ; i = 1, 2, ... K; r[0;L].

1
0,9
0,8

u(r)

0,7
0,6
0,5
0,4
0,3
0,2
0,1
0
0

9 10 11 12 13 14 15

. 2.2.
( ).
. 2.2 (r),
.

,

. ,
, :
i (r); i = 1, 2, ... K; r[0;L].
i (r), ,
. 2.3.

50
1
0,9

(r)

0,8
0,7
0,6
0,5
0,4
0,3
0,2
0,1
0
0

10 11 12 13 14 15

. 2.3.
( ).

. ,
U

q- j-

,
[75]:

E qj =

I qj cos( qj)
2

rqj

I qj(rqj (rnqj)2 + 1)
3

2rqj

Iqj - , q-

( qj ) j- q-
,
qj -
(. . 2.4).

cos( qi ) =

rqi2 (rqin )2 + 1
2rqi

r qj - :

51
2

rqi = (X j xq )2 + (Y j yq )2 + (Zj zq )2 ,
r nqj - ,
:

(rnqi )2 = (X n j xq )2 + (Y n j yq )2 + (Zn j zq )2 ,
qj ,
, :

cos( qi ) =

zq Z j
rqi

rn
(XNJ, YNJ, ZNJ)

(xq, yq, zq)


qi

qi

rqi

qi

(XJ, YJ, ZJ)

. 2.4.
.
i- , U i ,
j- ,
:

52
Qi

pij = E qj .
q=1

i-

, ..

U < U i , ,

j- ,

i (r). j-

:
K

E j = i (Si )pij , j = 1, 2, ... M,


i =1

:
K

i =1

i =1

N = N i = i (Si )U iI i ,
:
(1.3)
(1.2).
- , .. i (r)
[0,1], i (r) = r, i (r) [0,1], i (r) = r
. ,
:
K

f (S1, S2 ,...SK ) = Si U iI i
i =1

, S i [0,1]

- :
K

S p + E
i =1

ij

h=1

h
hj

e E j , j = 1...M

S1 ...SK

53
0 1 (., , [82, 83]).
,

[2, 27, 84].
i (r),
i (r)

(
) . ,
:
K

f (S1, S2 ,...SK ) = i (Si )U iI i

(2.1)

i =1

S1 , S2 , ... SK [0;L]
:
K

(S )p
i =1

ij

E j

(2.2)

j = 1...M .
, , (2.1), (2.2)
.

.
,
, , p ij (i = 1...K, j = 1...M), ..
.

. p ij
,
.

54
,

2.5

,
. . 2.6.
, ,
. ,
, .
2.7. , . 2.8 :
,
400 ,
300 . ()
20 . ,

(. . 2.7), ,
(. . 2.8).
,

, .. . 2.6.

55

600
550
500
450
400
350
300
250
200
150
100
50
0

. 2.5. ,
, .

600
550
500
450
400
350
300
250
200
150
100
50
0

. 2.6. ,
.

56

600
550
500
450
400
350
300
250
200
150
100
50
0

. 2.7. .

600
550
500
450
400
350
300
250
200
150
100
50
0

. 2.8. .

57

, . .
.
. ,
:

;
,
.
- . 2.9.
( 1, 2) ,

(j

1...M)

j- .

= E E i e ij

j = 1...M

i =1

3, 4, 6
S (
S min )
. 5, 6
,
,
,
.

S min , E
=0
j
S = S max , j E
S opt

> ( L) pij
i =1

Sopt .

j = 1...M ,

58

7,

,
.

,
,

)
.
,
7 ,
(1.2), (1.3).

59
1

j = 1...M

j =
.
H
E j -

E
i=1

eij

(Smin)

(Smax)




Sopt

. 2.9. .

2.2.1. . S opt .

60
, .
K
,
( ). K = K,
.
K R.
(r) / (r)

( r [0L]),

(r) / (r)

u(r) / (r)

. 2.10.
1
0,9
0,8
0,7
0,6
0,5
0,4
0,3
0,2
0,1
0
1

10 11 12 13 14 15

. 2.10. (r) / (r) .

[13, 81] , ,
, ,
.

(r) / (r)
.

61
,

,
U , .. .

:
. , ,
.
.
,
,
( ).

, . -2.1.

S opt

. ,
,
j- .
. -2.2. ,
k K , V.
,
. , K (
3-6), , j-
( r min). i
, Si ,
( 5).
(. 2.1)

, .. R ( - 6-9).

62
( 6) ( 7).
(
, 8),
R opt
( 9).
R opt S opt ( 10, 11):

E = pVi j(R Vi ) E j
i =1

k
N = (R V )N V min
i
i

i =1
S opt

N min

.
, K = K,
( )
. (. . -2.3) ( 2-6)
S.

( 3, 4) ( 5).
S
S opt ( 6), N -
N opt.
, ,

S,

(S)

(.

-2.4).

( 3) E ,
( 4)
j . , E < j ,
.

63
, ..

( K ,
,
).

R LK. ,
MLK.
2.2.1. .

,

( )
,
,

, ,

()

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

64
1 K (.. ) (R i1 , R i2 , R i ri ),
, i- .
r i .

65

. 2.11. .

66
D,
D i (i = 1...K) ,
,
i- . , ,
. 2.11, D 1 = D 2 = 1, D 3 = D 4 = 2.

,
.
(. .
2.12)
,
,
. ,
2,

3,

.

(

2,

3,

4).

6,

7,

8,

10,

11,

12

6, 7-, 8- .
,
. 5, 9, 13

5-,

9-

. 15, 16 11, 12.


14 , ..
.
,
(, 1
. 2.12).
1
, 2, 3, 4. 1

67
2,
, 5, 9 13.
6, 7, 8, 10, 11, 12 , ..

. ,

.


. i
E i = max { E Ri1 E Ri1 E Di Ri1 ,

E Ri2 E Ri2 E Di Ri2 ,

E Ri ri E Ri ri E Di Ri ri } ,

R i1 , R i2 , ... R i

ri

- , i-

;
E Rij R ij ;
E Rij R ij ,
,
;
E Di , D i - ;
Rij R ij .

68

. 2.12. , .

69
- . 2.5. :

Emax ( 3) ,
( R i1 , R i2 , ...

Si,

Ri ri

E ( 4);

,
Si
( 5).
Si (E) .

. -2.6

[0; L] log2 (L+1) .

, .
, ,
(),

. D.


:
.
2.2.3.

,
,
.
.

70
1.

, .
2. ,
. , ,
,

.
,

, .

: i Gr i On
, i Gr [2...K], i On [1...i Gr -1]. ,
, .
,
.

. 2.1.

( , ,

: , , ,
, , , , , ).

71
2.1

1

1 8.

1 7

1 6

1 5

1 4

1 3

1 2

2 3

3 4

10

4 5

11

5 6

12

6 7

13

7 8

,
. -2.7. :
(..
i On , i Gr ,
i First );
,
, .
, . 2.7. 1 ( ) 2-8 ( ).
. 2.1. ( i < 0)
K
, -
K-1 K. ,
:

72
1. 2, (S) = 0, i = -N+2, -N+1, -1, 0, 1,
N-2:
2. , (S) = 0,
i Gr

b = 1,2,...2 b[ j] = i On ,
i Gr

j=1

b[j] 0 1 j-
b.

S = (S1 , S2 , SK )
Sk = L b[k % iGr]
iGr = | i | + 2

i On =

i + 1, i > 0
1, i 0

i First
(, 6-8).
i Gr , i On, i First 9-11

.
,

-2.8,

S ,
i On i Gr i First r.

,
M (2K! + L).
2.2.4. .
r
i C ir ,
:

73

1
Cir =
N ir

pijr

j =1

E j Ej

min(

;1) ,

N ir - , i- r-

;
p ijr - , i-
r-

j-

;
E j , E j - j- .
min ,
,
.
, .
1.

i max, rmaxC(i max, rmax) = max


{C(i, r)}
i =1...N
r=1...L

S imax = max{S imax , rmax }


E

=E

pij ( S imax ) E ej
i =1

pij (r)
min
;1

E j

j=1
C(i, r) =
N i(r)
M

2.

jE
>0
j

max
S<S
1.

. -2.9.

74
,

( 2).

( 7) C;

8,

9).

( i max)
, (r max),
r max ( 10, 11).
(LK) 2 .
2.3.

,
K, (K = K ) .
,

: K ,
K .
C ,


(, 0,01). ,


K = 4 ... 6.

(, ,
) ,
.

75
,

(
)

.
:
,
.
, / (. .
2.10), .. .
,
, ,

.
, ..

,
.
,
.
4.5, . 4.4, 4.5,
4.6 .

, :

, ,
;

,
( ):
,
;

76

.
,
,
(. . 2.2).

77

2.2

-

78

3


3.1. .

, .


:
N ;
L .

.
IBM-
. , 2
. 2.6,
.
, -
.
. 3.1.
(),
:

;

.

79

~ 220


" "

...

...

. 3.1. .

80
: -
- .
- .

.
,
,
. , ,
.
. ,
. ,
-
.
, ,
.
.
, Object
Pascal Delphi 5.0. .
3.2. .


,
(. . 3.2).
, ,
,

,
N=8 L=16 .

81
. 3.5 ()
.

(),

S
;


.
:

,
,
,
;

,

;

(, ).

82

. 3.2. .

83

. 3.3. . .

84

. 3.4. . .

85

~ 220


" "

...

...

. 3.5. .

86
.
,

( , ,
. 3.6).
.

..

, , ,
. ,

,
. ,
.


[86]. ,
,

, , .

87
R,

800

700

600

500

400

300

200

100

0
0

1000

2000

3000

4000

5000

E,

. 3.6.

[87].
(. . 3.7),
, ,
(. 3.8).

()

PIC16C84

Microchip.

1,

...

[86].

88
. ,

. ,
, - .
. 3.9 , . 3.10
, .

.
.


.
, (),
,
, :
,
, ,
;
Windows
,
,
.

89

-1

-1

20

40

60

80

100 120 14 0 160 18 0 200 220 240 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720

. 3.7.

20

60

80

100 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720

. 3.9. ,

-1

40

-1

20

40

60

80

100 120 140 160 18 0 200 220 240 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 5 80 600 620 640 660 680 700 720

. 3.8.

20

40

60

80

100 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720

. 3.10. ,

90

.

, ..

. ,

, :
P = P P P ,

:
P = P P .
P

,
, . ,

.
3.3.

. 3.11. (DD4)
:
2 (DD1);

(DD2);
3.1

91
PIC1684

, 10

EEPROM 2

1792

1024 14

64

,
-

36

,
,

25
29

EEPROM

13

Watchdog

EEPROM

(Electrically

Eraseble

Programmable

Read

Only

Memory)

92
-, ,
RS-232 (DD3);
(U1).
PIC1684
RISC- Microchip [88],
. 3.1.
BQ1,
8 . MCLR
( ).
SB1
. ,
, .
, ; RB6, RB7

. ( )

,
RB6, RB7 RS-232,
.
( SB1,
) SB2 (,
)
( DD1). RA3
, RB3 3;

RS-232.

RA4


.
U1.1, U1.2 R2, R4.
, XP3 R4

93
, .
(
) .
( 6, 7 U1)
(. . 3.8),
.
B (
6).
DD1
(EEPROM) 2
2- I2 C.
I2 C ,
SCL () SDA () DD1 RA0, RA1
.

DD2 [89], C1
- , XP1. 1551

.
RS-232
RS-232 DD3 MAX232
Maxim. : 13 (R1in)
RS-232, 14 (T1out) RS-232, 12 (R1out)
, -, 11 (T1in) -,
RS-232. RS232 XP2.

94

DD1 24C16
8

XP1 (
)

7
+5 B

VCC

U1 AOT101AC-1
7
1

+5B
6
5

SCL
SDA

R4 36K

WP

XP3 ~220 B
R2 20K

GND

.
.
6
5
C1 0,1

11
10
3
4

6
+5B

RC
C

SB2.1

SB1.1
5

SB2.2

A1
A2

SB1.4

DD2 1551
+5B

.
DD3 MAX232
C2, 3 1

1
3
4

XP2 (
RS-232)

5
13
14

TxD (2)
RxD (3)
RTS (4)
CTS (5)
DTR (20)
GND (7)

C1+

R1 2

C4, 5 1
V+
V-

+5B

2
6

.7

C1C2+
C2R1in
T1out

R1out
T1in

12
11

SB2.3

.4
.5
.6
.0
.1

17
18
1
2
3
6
7
8
9
10
11
12
13

.
DD4 PIC16C84
RA0
RA1
RA2
RA3
RA4
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7

VDD
OSC1
OSC2
MCLR
VSS

SB1.2, SB1.3
.2

R3 100

C6, C7 15

14
16

BQ1 8

15

.
4
SB1.5-1.7
5

R5 1

.
.3

. 3.11.

+5B

95
PIC16C84
. (. . 3.12) R6, VT1,
R7,

U2,

VD1,

FU1.

VT1 U2.
, ,
. , ,
VD1 . FU1 VD1
U2 .
, ,
.
+5B

VD1

U2

KC405

TO125-12,5

XS1

R6

R7

2K

39

FU1
1A

VT?
NPN
~ 220 B

. 3.12. .
3.4.
:
, .
190 200 70
. :
, SB2.
,
.

96
2 .

:
, , -
.

3.2.

.

.
+5
, .
300 .
3.5.

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

97

. 3.13. .
3.5.1. . . 3.14
" - ". ,
, ,
, - ,
.
- (),
.

" " "", 1:4.
" " /4, "" - .
, , , .
,
.

",

"

98

"")

, , ( "
").

, (r) (r),
" " L+1 .
, " "
.

.
,
.

", ".
, -
.

99

10

U
I
F 1 ...F L
M 1 ...M L

4

X ,Y, Z
N x, N y, N z
. . .

KL

- , .

-


4M L

Q i

X , Y, Z
.

. 3.14. .

100
3.5.2. .
,
,
Windows 95 ( ).
8
.

. .
1.

, ,
. ,
(. . 3.15).
( )
,
).
2.

( . 3.16),
, ,
( ).
3. . (.
. 3.17) ,
, . ,
(r)
(r) ( .
3.17), ( ).

101

. 3.15. .

. 3.16. .

102

. 3.17. .

. 3.18. P.

P, p ij ,
i- j- ,
.

.

103

(. . 3.18).

(. . 3.18).

, .

2.

(

),


. Object
Pascal, ,
.
3.5.3. . ,
, .
,
, RS-232 .

, (. . 3.19).
, ,

. , ,
.

( ):
, ;
,
;
, ;

104

).

. 3.19. .
3.5.4.

()

. . -4.1
, .
, ,
(. - . 2.10)
.
, .. 10 .
, . -2.11.

105

4

4.1.
,
.

.
4.2.

4.1

( ),

E j j-
( ).
, j

t
t
. 4.1.

Ej

106

.
t :
(4.1)

t = t

(4.1) ,

( )

(. . 4.2)

t. = t

T..

t - ,
t - - ,
t .. .
. 4.2. .
.
1. t ,

, .. t = 10
.

107
2. -
.
, .
, ,

08

60000 0 ).
3. ,
,
( ). t ..
, , .
, t + t .. t
.


. ,
,
. , t = 10 .
:
= | Zt - Xt | ,

Z t - ,
X t - .

, ,
.. , ,
,
E .
:
= . + + ,

. - ;
- - ;

108
- .

.
.

.
,
.
, .
.
116, 0,5 %.
,
, .

,
,

. , ,
, .

(. ) ,
( ) 0 8184
, 8 . ,
10 ;
0 1023. , 1/1024*100%
0,1 %.
,
,

.
.

109

:

E Er 1
= max r
,
r =1... L 1
E

r 1

E i , i.
( )

(
(1.3))
+6,7 %. , , ,

,
. ,
.
+13%,
+6,7 %, [28] (+ 20 %).
,

, , :
;

-;
.
, ,
, [28],

, L .
log

(L).

L
2 n, n .

110
,
0,6 +7,3 %.
[28] :
0,9E H E / K 1,2E H ,

E H -
E -
K - .
,

0,6+7,3 %, ,
10+20 %.
4.3.
[43, 44]
(),
.
(
),

) . ,

.

() [90-94],
.
[94]

111
.

:
N 1

ck = x ne j2nk/ N
n= 0

ck , k k
~
ck =
0, k > k
N 1

~
xn = ~
ck ej2nk/ N
n= 0

x n ,


N
c k k-
~
ck k-
~
xn ,


k .


N.
, ,
, ,

, .

N
[94]:

112

1 N1
~
xn = x n
N n=0

. 4.1.

:
1. ,
( 2-3 ,
).
2.


- (. . 4.5).

113
4.1

1
288
2
14
3
15
4
88
5
461
6
44

151,7

17
2
2
6
13
18
9,7

17
2
2
6
14
17
9,7

, ,
,
,
:

xn =

vn1 + min(vn vn1; vmax),vn vn1


vn1 min(vn1 vn ; vmax),vn < vn1

vn
vn-1
vmax

. 4.3, 4.4

.

114
. . 4.6
, . 4.3, ,
. ,

20 40 . 0,0005
0,001 .

115
,
,
1 460
1 440
1 420
1 400
1 380
1 360
1 340
1 320
1 300
1 280
1 260
1 240
1 220
1 200
1 180
1 160
1 140
1 120
1 100
1 080
1 060
1 040
1 020
1 000
980
960
940
920
900
880
15

16

17

t,

. 4.3.

,
1 480
1 460
1 440
1 420
1 400
1 380
1 360
1 340
1 320
1 300
1 280
1 260
1 240
1 220
1 200
1 180
1 160
1 140
1 120
1 100
1 080
1 060
1 040
1 020
1 000
980
960
940
920
900
15

16

17

18

t,

. 4.4.

116
,
1 460
1 455
1 450
1 445
1 440
1 435
1 430
1 425
1 420
1 415
1 410
1 405
1 400
1 395
1 390
1 385
1 380
1 375
1 370
1 365
1 360
1 355
1 350
1 345
1 340
1 335
16

17

t,

. 4.5. ,

,
1 480
1 460
1 440
1 420
1 400
1 380
1 360
1 340
1 320
1 300
1 280
1 260
1 240
1 220
1 200
1 180
1 160
1 140
1 120
1 100
1 080
1 060
1 040
1 020
1 000
980
960
940
920
900
880
15

16

17

18

t,

. 4.6.

117
4.4.

/ .


,
.
,
,

..

, ..
.

. -

.
:
= + ,

, .
-
.

118
E,

EMAX
E

12

15

18
,

T,

. 4.7. .
,

,
(

50 ..).

, . 4.7. . 4.2
MAX ,
[4].

:
= / ,

- ,

[28] , ,
- () .

119
4.2
MAX

MAX ,
12 000
18 750
12 500
4 900

,
1 770
2 420
1 860
710

T ,
4,17
5,84
4,24
0,40

,
2,83
1,16
2,76
6,60

0,01...0,12 [75],
0,065.

30 ... 1500 . ,
,
,
300 [28].
(. . 4.7),

, :
= 2 ( - ) / .
,

,
, :
= - - ,

8 ),
- ,
, ( 1 ).

120
, , .
4.2. . ,
, , :
. = 3,34 .

,
(K U - ,
(
K U 0,2;
K U = 0,9); -
, ):

= (1 - K U1,58 ) = 0,511 P

();
= (2,43 - 2,43K U) = 0,811 P

();
= (1,26 - 1,26K U) = 0,421 P

() ;
= (3,5 - 3,5K U) = 1,169 P -
().

,
13 %
( ,
).
:
= n ,

- , . / ,
n - .

121

.

, [4]:
= - = K um - = (K um - 1),

- , ,
- , , .
m - , .

m = -14, m = -3,2.
= 0,401 , ..
40 %.
, :
= n ( + ) / = (K um - 1) ( + ),

- ,

.,
n - , .

13 %
.
40 %
.

1,7 %
.
4.5.

:

;

122
.
.
,
. 4.3.

4.3
,

40
16
1

79,4
14
2

480

576

, 2

,

:
1.

2.

3.

,
. ,
,
.
9-00 18-00 40 .

Pentium-III 800

123
1.

.
2.

(
1024)
.
3.

;
.
. 4.4 4.6.
. 4.4
( 2 ) .

.
.

4.5

. , (1) ( )
, , 2 3
2 3 %. ,
,
,
. 1 , ..
.
4.4

1
2

1
9293
207360

,
2

3
7
9

9
44
4.5

, %

124
1
2

. 1
526
4008

. 2
538
4081

. 3
537
4128

. 1
87,83
22,76

. 2
87,55
21,35

. 3
87,57
20,44

. 4.6
:
T 1 M

E
k =0 j=1

1
j

E
j

TM

T ,
, .. ,
j , j-
( = 2, 3). E = 100 ,

4.6

.
4.6

1
2

, , %
2
3
1,99
1,41
0,95
1,31

. 4.5, 4.6 , 1
, 2
, .
, .
,
, .
4.6.
,
, , .

125

.

10 .
0,6+7,2 %,
.

(..

), .

.
:
.

126

.

:
,
;

;
,
.
,
,
.

,
.

,

.


.

127
,

.

:

;

;
.


(2000 .), (1998 - 2000 .),
" - 2000" (, 1999 .).

128

1. Mills E. Global Lighting: 1000 Power Plants // IAEEL newsletter. - 2000. -


1-2. - P. 1-4.
2. Aizenberg J., Mills E. Light from Glastnost // IAEEL newsletter. - 1993. - 3.
- P. 22-25.
3. Picone J. Automatic Light Control Device. - Mississippi State University,
2001. - 21 p.
4. . ., . .
. - .: , 1984. - 160 .
5. Fontoynont M. Daylighting Performance of Buildings: 60 European case
studies // Right Light 4 Proceedings. - 1998.
6. Ottonson A., Stillesjo S. Examples of Technology Procurement and
Demonstration of Energy-Efficient Lighting - a Swedish Approach // Right
Light 3. - 1995. - P. 517-524.
7. Min G., Miles E. China - a Lighting Giant // IAEEL Newsletter. - 1994. - 3.
- P. 34-36.
8. Borg N. Efficiency in Commercial Buildings // IAEEL Newsletter. - 1997. -
3-4. - P. 16.
9. Slater A., Bordass B., Heasman T. Give People Control of Lighting Controls //
IAEEL Newsletter. - 1996. - 3. - P. 22-25.
10. Levy A. Lighting Controls, Patterns of Lighting Consumption, and Energy
Conservation // IEEE Transactions on Industry Applications. - 1980. - Vol.
1A-16. - 3. - P. 419-427.
11. Galasiu A., Atif M., MacDonald R. Field performance of daylight-linked
lighting controls // IES Conference Proceedings, Ottawa, Ontario, Aug. 5-8
2001. - Ottawa. - 2001. - P. 207-215.
12. Loe D. Task and Building Lighting: The Link Between Lighting Quality and
Energy Efficiency // Right Light 4 Proceedings. - 1997. - P. 15.

129
13. Lee E., DiBartolomeo D. Integrated perfomance of an Automated Venetian
Blind/Electric Lighting System in a Full-Scale Private Office // Proceedings
of the ASHRAE/DOE/BTEC Conference. - Florida. - 1998. - P. 1-12.
14. D. L. DiBartolomeo, E. S. Lee. Developing a Dynamic Envelope/Lighting
Control System with Field Measurements // Journal of the Illuminating
Engineering Society. - 1996. - 26 (1). - P. 146-164.
15. Jennings J., Rubinstein F., DiBartolomeo D. Comparison of Control Options
in Private Offices in an Advanced Lighting Controls Testbed. - Berkeley:
University of California, 2000. - 26 p.
16. Floyd D. B. Daylight Savings: Not an Easy Catch // IAEEL newsletter. 1994. - 4. - P. 23-26.
17. Weersink A. Lighting and Overall Energy Performance of office Buildings //
Energy-Wise News. - 1997. - 53. - P. 2.
18. Schalin B., Helvar O. The Use of Distributed Intelligent Control in Energy
Efficient Lighting Systems // Right Light 3. - 1995. - P. 212-222.
19. Dilouie C. Manual vs. Dimming Controls. - Lawrence Berkley National
Laboratory. - 1996. - 5 p.
20. Buddenberg A., Visser R. Strategies for Technologies Procurement in
Creating Energy-Efficient Lighting Installations // Right Light 4. - 1997. Volume 1. - P. 187-194.
21. Automated On/Off Lighting Controls: Report of Pacific Energy Center /
Pacific Energy Center. - Los Angeles. - 1997. - 5 p.
22. Loe D., Davidson P. A Holistic Aproach to Lighting Design // IAEEL
Newsletter. - 1997. - 2. - P. 36-41.
23. Vesser R. Occupancy Sensors for the Home // IAEEL Newsletter. - 1997. -
2. - P. 17-18.
24. Borg N. Large-Scale Procurement Of Occupancy Sensors // IAEEL newsletter.
- 3. - 1996. - P. 1.
25. Retrofit Control Technologies / Advanced Lighting Guidlines (Second
Edition). Lighting Design and Strategy. - Los Angeles: California Energy
Comission, 1993. - 21 p.

130
26. Maniccia D. Effects on Lamp Life // IAEEL newsletter. - 3. - 1996. - P. 5.
27. Christofersen J., Petersen E., Johnsen K. An Experimental Evaluation of
Daylight Systems and Lighting Control // Right Light 4. - 1997. - Volume 2. P. 245-254.
28. II-4-79. .
. - . 01.01.1980. - .: , 1980. - 32 .
29. Younger D., Granda C. Lighting Initiative For Poor Countries // IAEEL
Newsletter. - 1998. - 2. - P. 11-13.
30. Julian Aizenberg, Evan Mills. Lighting of global importance // IAEEL
Newsletter. - 3. - 1993. - P. 2.
31. Paule B., Scartezzini J.-L.. "Leso-Dial", a new Computer-based Daylighting
Desing Tool // Right Light 4 Proceedings. - 1997. - P. 26.
32. Daylight-dependent Lighting Control in a Bank // Energy-Wise News. - 1997.
- 53. - P. 4.
33. Canterbury Library Saves Lighting Energy with Intelligent Controls // EnergyWise News. - 1998. - 59. - P. 5-6.
34. Jacobsen H. Forgotten Issues in Energy Saving // Right Light 4. - 1997. Volume 2. - P. 21-24.
35. Mills E. Lighting by Example // IAEEL newsletter. - 1. - 1999. - P. 22.
36. Mills E. Lighting programs at your fingertips // IAEEL newsletter. - 1. 1998. - P. 32.
37. Mills E., Borg N. Rethinking Light Levels // IAEEL newsletter. - 1. - 1998.
- P. 18-19.
38. Queins S., Zimmermann G., Becker M., Kronenburg M., Peper C., Merz R.,
SchAfer J.. The Light Control Case Study: Problem Description // Journal of
Universal Computer Science, Special Issue on Requirements Engineering. 2000. - 7. - P. 586-596.
39. Kronenburg M., Peper C. Application of the FOREST Approach to the Light
Control Case Study // Journal of Universal Computer Science, Special Issue
on Requirements Engineering. - 2000. - 7. - P. 679-703.

131
40. Saing R., Pont P. Asian Development Bank Lights the Way in Efficiency //
IAEEL newsletter. - 2000. - 1-2. - P. 8-9.
41. Mills E. The Internet as a New Tool for Implementing Energy-efficient
Lighting // Right Light 4. - 1997. - Volume 1. - P. 29-34.
42. Maniccia D. They Turn Off the Lights // IAEEL newsletter. - 1996. - 3. - P.
21-23.
43. Embrechts R., Bellegem C. Increased Energy Savings by Individual Light
Control // Right Light 4. - 1997. - P. 179-182.
44. Viljanen T., Halonen L., Lehtovaara J. Advanced Lighting Controls
Technologies for User Satisfaction and Energy Efficiency // Right Light 4. 1997. - Volume 1. - P. 169-174.
45. Borg N. High-quality task lighting // IAEEL Newsletter. - 1993. - 3. - P.
13-15.
46. LRC Releases Evaluation of Lighting Controls: Report of Lighting Research
Center / Lighting Research Center. - Troy, NY. - 1998. - P. 29-30.
47. Rubinstein F. Advanced Lighting Controls Testbed in San-Francisco // IAEEL
Newsletter. - 1996. - 3. - P. 32-37.
48. Borg N. Easy-to-Install Sensor Charms Tough Buyers // IAEEL newsletter. 2. - 1998. - P. 22-23.
48. Knoop T., Ehling K., Aydinli S., Kaase H.. Investigation of Daylight
Redirecting Systems and Daylight Responsive Lighting Control Systems //
Right Light 4. - 1997. - Volume 2. - P. 231-235.
49. Rubinshtein F., Avery D., Jennings J., Blanc S. On the Calibration and
Commisioning of Lighting Controls // Right Light 4 Proceedings. - 1997. - P.
34.
50. Borg N. Ballast Efficiency Regulation Proposed for Europe // IAEEL
newsletter. - 2. - 1999. - P. 3-4.
51. Borg N. New ballast may start CFL revolution // IAEEL Newsletter. - 1998. 1. - P. 14-16.
52. Borg N. New Philips miniature HF ballast // IAEEL newsletter. - 1. - 1999.
- P. 12.

132
53. Wolsey R., Davis R., Heslin K., Gross J. Controlling Lighting with Building
Automation Systems // Lighting Answers. - 1997. - Volume 4, 1. - P. 3741.
54. Morrow W., Vargas M., Peterson D., Mix J. The quest for the ideal office
control system // Lighting Futures. - 3. - Volume 3. - 1998. - P. 2-7.
55. Bierman A., Turnbull P. Daylight Photosensor Control Systems for Office
Buildings : Lighting Research Center report / Rensselaer Polytechnic
Institute. - New York, 2002. - 2 p.
56. Maniccia D. Will Sensors Pay ? // IAEEL newsletter. - 3. - 1996. - P. 1619.
57. Miller N., Vasconez S. Demonstration and Evaluation of Lighting
Technologies and Applications : Lighing Research Center report, Issue 5 /
Lighing Research Center, Rensselaer Polytechnic Institute. - New York, 1999.
- 2 p.
58. Ji Y., Wolsey R., Bierman A., Davis R. Dimming Systems for High-Intensity
Discharge Lamps // Lighting Answers. - 1994. - Volume 1, 4. - P. 1-8.
59. Rubinstein F., Jennings J., Avery D. Preliminary Results from An Advanced
Lighting Controls Testbed // IESNA 1998 Annual Conference Proceedings,
San Antonio, TX, August 10-12, 1998. - San Antonio. - 1998. P. 1-19.
60. Rubinstein F. Advanced Lighting Controls Testbed In San Francisco // IAEEL
newsletter. - 1996. - 3. - P. 14-15.
61. Borg N. Give your luminaire a call // IAEEL Newsletter. - 1995. - 3-4. - P.
12-14.
62. C-bus Lighting Management System // Energy-Wise News. - 1997. - 53. P. 1.
63. Iwata T., Miake T., Sakamoto S., Yoshimura K., Kimura K.-I.. Experimental
Study on the Integrated Lighting System with Daylight and Artificial Light
Based on the subjective Response and Energy Saving // Right Light 4. - 1997.
- Volume 2. - P. 255-259.

133
64. Berman S. Tuning the Light Spectrum To Improve Energy Efficiency //
IAEEL Newsletter. - 1992. - 2. - P. 34-36.
65. Berrutto V., Fontoynont M., Fourmigue J.-M. Effect of Temperature and
Light Source Type (natural/artificial) on Visual Comfort Appraisal :
Experimental Design and Setting // Right Light 4. - 1997. - Volume 1. - P.
139-141.
66. Kirschbaum C., Tonello G. Visual Appearance of Office Lighting // Right
Light 4. - 1997. - Volume 1. - P. 143-148.
67. Knez I. Changes in Females' and Males' Positive and Negative Moods As a
Result of Variations in CCT, CRI and Illuminance Levels // Right Light 4. 1997. - Volume 1. - P. 149-154.
68. Wolsey R. Interoperable Systems: The Future of Lighting Control // Lighting
Futures. - Volume 2. - 1997. - 2. - P. 16-21.
69. Slater A.. Energy Efficient Lighting in Buildings // Right Light 4 Proceedings.
- 1997. - P. 29.
70. Borg N. DELight - Domestic Efficient Lighting // IAEEL newsletter. - 1998. 1. - P. 8-11.
71. Kristensen P. Daylight Europe - JOULE Project CT94 - 0282 // Right Light 4
Proceedings. - 1998.
72. Willey H. Energy-Efficient People: Redefining Energy-Efficient Lighting in
Terms of Support for Human Activity // Right Light 4 Proceedings. - 1997. P. 17.
73. Erhorn H., Boer J., Dirksmoller M. ADELINE - An Integrated Approach to
Lighting Simulation // Right Light 4 Proceedings. - 1997. - P. 11.
74. Newsham G., Veitch J. Individual Control Can Be Energy Efficient // IAEEL
newsletter. - 1. - 1999. - P. 19.
75. / . . . . - .:
, 1983. - 472 .
76. . : . . - .: , 1984.
- 541 c.
77. . . . - .: , 1979.

134
78. . . . - .: ,
1991. - 432 .
79. . ., . .
. .: , 1964.
80. Duarte R., Martins G. A Comparative Analysis of Automatic Lighting Control
Strategies in Buildings // Right Light 4. - 1997. - Volume 2. - P. 137-140.
81. Galasiu A., Atif M. Project to improve understanding of daylight-linked
lighting systems // CABA Home & Building Quarterly. - 2000. - Summer. - p.
18.
82. . . . .: , 1991. - 320 .
83. . .
. - .: , 1980. - 230 .
84. Rubinstein F. The Usefulness of Bi-Level Switching. - Berkeley: University
of California, 1999. - 2 p.
86. . // . - 1989. - 11. . 67.
87. . // . - 1991. - 1. - .
60-61.
88. PIC16C84. 8-bit CMOS EEPROM Microcontroller. - Microchip Technology
Inc. - 1996. - 116 p.
89. . . : . - .:
, 1987. - 352 .
90. . . -
// . - 5. - 1998. - c. 142-151.
91. . ., . .
// . - 7. - 1998. - c.
96-106.
92. . ., . ., . .

// . - 11. - 1999.
- c. 69-80.

135
93. .. //
. - 3. - 1999. - c. 25-37.
94. . . //
Basegroup (www.basegroup.ru). - 2000.
95. Jane Palmer. A Delightful Opportunity // IAEEL newsletter. - 1. - 1998. P. 14-17.

136

i

j

k

r

q

M

K

L
()
Qi
i-
H


X k ,Y k ,Z k
k-
Sk
k-
X j ,Y j ,Z j
j-
E j , j[1;M]
j-
E k , j[1;M]

e
E j , j[1;M]
j-
e jh , j[1;M]
j- h-

E h
, h-
qj
q-
qj

j-

r qj

q-
j- q-

j-

137


x q,y q,z q, q [1;Q i ] ,
x q,

y q,

q-
q-

[1;Q i ]
x nq,y nq,z nq,

q[1;Q i ]
Ii


, i-


Si , i[1;K]
i- . Si [0;L]

U i , i[1;K]

i (r),
i[1;K], i-
r[1;L]
r-
U i , I[1;K]
i-
i (r),
i[1;K],

i-
r[1;L]
p ij ,

r-
i[1;K], i- ,

j[1;M]
N i , i[1;K]
N

j-
i-
,

U i ,

138

Sopt = Smin
2

j = 1...M

Nmin = 1038

R = (SV1, SV2, ...


SVK) = Rmin...Rmax
6
k .

N = ViRi
i=1 .

7
k

= pVi j Ri
i =1

( >= j)
(N < Nmin)

Ropt = R
Nmin = N

10

i = 1 ... k

11

SoptV i = Ropt

139
. -2.1. .

V = (0, 0, ... 0)
rmin = 1038
2

k= 1...K
3

i = 1...K

r=
(xi-Xj)2+(yi-Yj)2+(zi-Zj)2
5

r < rmin Si = 0

rmin = r
Vk = i

. -2.2. .

140

Nopt = 1038
2

S =
Smin...Smax
3

N = iSi
i=1

N < Nopt

(S)

Sopt = S
Nopt = N

. -2.3. .

141


(S)
1

j = 1...M

3
N

= pij Si

i =1

< i

. -2.4. .

142

Ej = 0
j = 1...M
2

i = 1...K

Ri ri
.
Emax = max { ERij - ERij - EDi Ri }
j = Ri1
.
4

Si = (Emax)
5

Ej = Ej + pijSi
j = 1...4M

. -2.5. .

143

(E )

L m in = 0
= L / 2
L m ax = L

E ( ) > E

L m in =

L m ax =

m ax

- L

m in

> 1

. -2.6. .

144

i = -(K-2) ... K-2

iGr = | i | + 2

i>0

iOn = i + 1

iOn = 1

i F = 1...i On
7

S =
(iOn, iGr, iF, smax)

(S)

s = smin ... smax


10

S =
(iOn, iGr, iF, s)

11

(S)

. -2.7. .

145

(ion, igr, ifirst, r)


1

= ()

i = 0...[K / igr]
3

j = 0 ... ion - 1

i igr+ ifirst + j K

i igr +ifirst +j = r

. -2.8. .

146

10

Simax < rmax

11

S = Smin

Simax = rmax

b=

(S)

b S = Smax

Cmax = -

i = 1...N

r = 1...L
7
M

C = min (pij () / E; 1)
j=1

---------------------Ni (r)
8

C > Cmax

imax = i
rmax = r
Cmax = C

. -2.9. .

147


Com C ode

i = 0 ...K -1

L e ve li = 0 F h

Com C ode
0

R T le v = 0
R T pr = 0
T tra n s = 0
R T p re v = 0


S la v e , A d d r ,
D a ta B y te


S la v e , A d d r


D a ta B y te
EEPRO M
[ S la v e * 2 5 5 +
A d d r]


D a ta B y te
EEPRO M
[ S la v e * 2 5 5 +
A d d r]


D a ta B y te

. -2.10. .

148

R T=0 R T

p re v

R T

=0

p re v

= R T

i = 0 ...K - 1

R T

L e v e lC h a nN o = 1 5

p re v

R T le n = T
R T p re v = 1

RT

= 1

le n

= 1023

T = 1024

P o r tC h a nN o = 0

Le ve l

E E P R O M [ R T le n * K / 2 ]

T .6 = T
T im e r = 0
T = 0
P r C ha nN o = 0

p re v.6

C o u n t tr + +

i = 0 ...K - 1

C o u n t tr = 0

T = T im e r

L e v e lC h a nN o = T /6 4
L e v e lC ha nN o < > 1 5

R T
T = T im e r

P o r tC h a n N o = 1

le n

p re v

= T

. -2.11. .

149

const
iMaxRFLevel = 1023;
iMaxInXY = 21;
type TLPoint = record
sX, sY, sZ,
sNorm,
sNLC,
sAL : single;
aLighting : array [0..15] of single;
end;

//
//
//
//
//

-
-
...
-, .
-

type
TfMain = class(TForm)

private
{ Private declarations }
dtLastReceive : TDateTime;
iByteToSend
: integer;
//
wToSend
: array [0..iMaxRFLevel] of word; //
cMinStage
: Cardinal;
//
cMaxStage
: Cardinal;
//
iReceived
: integer;
bAlgResultHashed : array [1..3] of boolean;
cAlgResultHash : array [1..3,0..iMaxRFLevel] of Cardinal;
procedure recalc_lack_lighting (sLevel : single);
function get_art_light_in_point (iP : integer; c : Cardinal) : single;
function is_enough_lighting (c : Cardinal) : boolean;
function get_power (c : Cardinal) : single;
procedure ask_for_byte;
function swap_thetrades (w : word) : word;
function Process1 (sLevel : single) : Cardinal;
function Process2 (sLevel : single) : Cardinal;
function Process3 (sLevel : single) : Cardinal;
procedure FillAlgResultHash (iAlg : integer);
public
{ Public declarations }
iNumSources : integer;
// -
function GetRealLighting (iCount : integer) : single;
procedure Load_Matrix;
function Process (sLevel : single; iVariant : integer) : Cardinal;
function ProcessAndTraceRFLevel (w : word; iAlg : integer) : Cardinal;
end;
var
fMain: TfMain;
fFastLog : TextFile;
//fSlowLog : TextFile;

procedure TfMain.btCalcClick(Sender: TObject);


var sLX, sLY, sLZ, sPX, sPY, sPZ, sNX, sNY, sNZ, sL, sR, sR2, sNR2, sBeta, sAlpha :
single;
function GetLighting (sA : single) : single;
var sPrevA, sPrevL, sK : single;
begin
sA := RadToDeg (ArcCos (sA));
// alpha
tbTypeCurve.First;
sPrevA := tbTypeCurveDegree.AsFloat;
sPrevL := tbTypeCurveLighting.AsFloat;
tbTypeCurve.Next;
Result := -1;
while not tbTypeCurve.EOF do
begin

150
if (sA>=sPrevA) and (sA<=tbTypeCurveDegree.AsFloat) then
begin
sK := (sA-sPrevA) / (tbTypeCurveDegree.AsFloat-sPrevA);
Result := sPrevL + (tbTypeCurveLighting.AsFloat - sPrevL) * sK;
break;
end;
sPrevA := tbTypeCurveDegree.AsFloat;
sPrevL := tbTypeCurveLighting.AsFloat;
tbTypeCurve.Next;

end;
end;
begin
//
Screen.Cursor := crHourglass;
DeleteAll (tbDeposit);
tbZone.First;
while not tbZone.EOF do
begin
tbZonePoint.First;
while not tbZonePoint.EOF do
begin
sPX := tbZonePointX.AsFloat;
sPY := tbZonePointY.AsFloat;
sPZ := tbZonePointZ.AsFloat;
sNX := tbZonePointNX.AsFloat;
sNY := tbZonePointNY.AsFloat;
sNZ := tbZonePointNZ.AsFloat;
tbSource.First;
while not tbSource.EOF do
begin
tbType.FindKey ([tbSourceType_No.AsInteger]);
//------------------ -----------------------sL := 0;
tbSourceLighter.First;
while not tbSourceLighter.EOF do
begin
sLX := tbSourceLighterX.AsFloat;
sLY := tbSourceLighterY.AsFloat;
sLZ := tbSourceLighterZ.AsFloat;
//
sR2 := sqr(sLX-sPX) + sqr(sLY-sPY) + sqr(sLZ-sPZ);
sR := sqrt(sR2);
//

sNR2 := sqr(sLX-sNX) + sqr(sLY-sNY) + sqr(sLZ-sNZ);
//
sBeta := (sR2+1-sNR2) / 2 / sR;
// , ,

sAlpha := (sLZ-sPZ) / sR;
//
sL := sL + GetLighting(sAlpha)*sBeta/sR2;
tbSourceLighter.Next;
end;
tbDeposit.Append;
tbDepositPoint_No.Assign (tbZonePointNo);
tbDepositSource_No.Assign (tbSourceNo);
tbDepositLighting.AsFloat := sL;
tbDeposit.Post;
//----------------------------------------------------------------tbSource.Next;
end;
tbZonePoint.Next;
end;
tbZone.Next;
end;
Screen.Cursor := crDefault;
end;
function TfMain.GetRealLighting (iCount : integer) : single;
var i : integer; s : single;
begin
Result := 0;
if iCount<=iLightInX[0] then
Result := iLightInY[0]
else if iCount>=iLightInX[iMaxInXY] then
Result := 0
else
for i:=0 to iMaxInXY-1 do
if (iLightInX[i]<=iCount) and (iCount<iLightInX[i+1]) then
begin

151

end;

end;

s := (iCount-iLightInX[i]) / (iLightInX[i+1]-iLightInX[i]);
Result := iLightInY[i] - (iLightInY[i]-iLightInY[i+1]) * s;
break;

// - .. = sLevel
procedure TfMain.recalc_lack_lighting (sLevel : single);
var pt : TLPoint; iP : integer;
begin
for iP:=0 to rsdcPoint.High do
begin
pt := TLPoint (rsdcPoint[iP]^);
pt.sAL := pt.sNorm - sLevel * pt.sNLC;
TLPoint (rsdcPoint[iP]^) := pt;
end;
end;
function TfMain.get_art_light_in_point (iP : integer; c : Cardinal) : single;
var pt : TLPoint; iR : integer;
begin
pt := TLPoint (rsdcPoint[iP]^);
Result := 0;
for iR:=0 to iNumSources-1 do
Result := Result + pt.aLighting[iR] * aLightingCoeffs [(c shr (iR*4)) and 15];
end;
// - = c
function TfMain.is_enough_lighting (c : Cardinal) : boolean;
var pt : TLPoint; iP : integer;
begin
Result := TRUE;
for iP:=0 to rsdcPoint.High do
begin
pt := TLPoint (rsdcPoint[iP]^);
if get_art_light_in_point(iP,c) < pt.sAL then
begin
Result := FALSE;
break;
end;
end;
end;
// .
function TfMain.get_power (c : Cardinal) : single;
var iR : integer;
begin
Result := 0;
for iR:=0 to iNumSources-1 do
Result := Result + aCurrentCoeffs [(c shr (iR*4)) and 15];
end;
function TfMain.Process1 (sLevel : single) : Cardinal;
var sPower, sBestPower : single;
c, cBestStage : Cardinal;
//
// optimisation <<<<<<<<<<<<<<<<
cT
: Cardinal;
bT
: byte;
aAl : array [0..15] of single;
aDep : array [0..15,0..15] of single;
pt
: TLPoint;
iP, iR, iNumPoints : integer;
bEnough : boolean;
s : single;
// optimisation >>>>>>>>>>>>>>>>
begin
// optimisation <<<<<<<<<<<<<<<<
iNumPoints := rsdcPoint.High+1;
for iP:=0 to iNumPoints-1 do
begin
pt := TLPoint (rsdcPoint[iP]^);
aAl[iP] := pt.sAL;
for iR:=0 to iNumSources-1 do
aDep[iP,iR] := pt.aLighting[iR];
end;
// optimisation >>>>>>>>>>>>>>>>
//
sBestPower := 10e38;
cBestStage := cMaxStage;
c := cMinStage;

152
while c > cMaxStage do
begin
// optimisation <<<<<<<<<<<<<<<<
// get the power
sPower := 0;
cT := c;
for iR:=0 to iNumSources-1 do
begin
bT := cT and 15;
sPower := sPower + aCurrentCoeffs [bT];
cT := cT shr 4;
end;
if sPower < sBestPower then
begin
// check if it is enough
bEnough := TRUE;
for iP:=0 to iNumPoints-1 do
begin
if aAL[iP]>0 then
begin
s := 0;
cT := c;
for iR:=0 to iNumSources-1 do
begin
bT := cT and 15;
s := s + aDep[iP,iR] * aLightingCoeffs [bT];
cT := cT shr 4;
end;
if s < aAL[iP] then
begin
bEnough := FALSE;
break;
end;
end;
end;
if bEnough then
begin
cBestStage := c;
sBestPower := sPower;
end;
end;
// optimisation >>>>>>>>>>>>>>>>
{
sPower := get_power(c);
if (sPower < sBestPower) and is_enough_lighting (c) then
begin
cBestStage := c;
sBestPower := sPower;
end;
}
Dec (c);
if (c and $FFFFFF) = $FFFFFF then
Caption := IntToStr(c shr 24);

end;

end;
Result := cBestStage;

function TfMain.Process2 (sLevel : single) : Cardinal;


var i,
iL,
//
iGr,
//
iOn,
//
iFirst : integer; //
c : Cardinal;
//
// iOn iGr, iFirst- ( iL)
1 !
function set_stage (iOn, iGr, iFirst, iL : integer) : Cardinal;
var iLgr, iLon, iNo, iPos, i : integer;
begin
Result := cMinStage;
// ( 0)
for iLgr:=0 to iNumSources div iGr do
// ( 0)
for iLon:=0 to iOn-1 do
begin
//
iNo := (iFirst+iLon) mod iGr;
// ,
iPos := (iLgr*iGr+iNo)*4;
//

153
if iLgr*iGr+iNo < iNumSources then
// -
for i:=0 to 3 do
MoveBit (Result, iPos+i, GetBit(iL,i));

end;
end;
begin
Result := cMaxStage;
for i:=-(iNumSources-2) to iNumSources-1
do
// i:
-2,-1,0,1,2,3
begin
if i>0 then iOn :=
i+1
// iOn:
1,1,1,2,3,4
else iOn :=
1;
// ... ...
iGr := min (abs(i) + 2,
iNumSources);
// iGr:
4,3,2,3,4,4
for iFirst:=0 to iGr-1
do
// iFirst:
0..3,0..2,0..1,0..2,0..3,0..3
begin
for iL:=15 downto 0 do
//
begin
// iL iOn iGr, iFirst-
c := set_stage (iOn, iGr, iFirst, iL);
//if iL=0 then
//begin
//
mm.Lines.Add (Format ('%d %d, %d (%d)', [iOn, iGr,
iFirst, iL]));
//
mm.Lines.Add (Format ('%.16X', [c]));
//end;
// ,
if is_enough_lighting(c) then
begin
Result := c;
Exit;
end;
end;
end;
end;
end;
function TfMain.Process3 (sLevel : single) : Cardinal;
var pt : TLPoint;
iP, iR, i, r, iMax, rMax : integer;
sC, sCMax, sArtLight : single;
c : Cardinal;
//
begin
c := cMinStage;
// ,

while not (is_enough_lighting(c) or (c=cMaxStage)) do
begin
sCMax := -MAXSINGLE;
//
for i:=0 to iNumSources-1 do
// ,
$F
for r:=0 to $E do
//
if ((c shr (i*4)) and 15) > r then
begin
// C i
r
sC := 0;
for iP:=0 to rsdcPoint.High do
begin
pt := TLPoint (rsdcPoint[iP]^);
// . ?
sArtLight := 0;
for iR:=0 to iNumSources-1 do
if iR<>i then
sArtLight := sArtLight + pt.aLighting[iR] * aLightingCoeffs [(c
shr (iR*4)) and 15];
//
if pt.sAL - sArtLight < 0 then
sC := sC + 1
else
sC := sC + min (pt.aLighting[i] * aLightingCoeffs [r] / (pt.sAL sArtLight), 1);

154
end;
sC := sC/aCurrentCoeffs[r];
//mm.Lines.Add (Format ('i=%d r=%d sC=%.3f', [i,r,sC]));
// ,

if sC>sCmax then
begin
sCmax := sC;
iMax := i;
rMax := r;
end;
end;

end;
end;

// S[iMax] := rMax
MoveBit (c, iMax*4,
MoveBit (c, iMax*4+1,
MoveBit (c, iMax*4+2,
MoveBit (c, iMax*4+3,

GetBit(rMax,0));
GetBit(rMax,1));
GetBit(rMax,2));
GetBit(rMax,3));

Result := c;

function TfMain.Process (sLevel : single; iVariant : integer) : Cardinal;


begin
recalc_lack_lighting (sLevel);
if is_enough_lighting (cMinStage) then
begin
Result := cMinStage;
Exit;
end;
if not is_enough_lighting (cMaxStage) then
begin
Result := cMaxStage;
//mm.lines.add ('not enough');
Exit;
end;
case iVariant of
1: Result := Process1 (sLevel);
2: Result := Process2 (sLevel);
3: Result := Process3 (sLevel);
end;
end;
procedure TfMain.Load_Matrix;
var pt : TLPoint; iT : Int64;
begin
//
rsdcPoint.Clear;
tbZonePoint.MasterSource := nil;
tbZonePoint.First;
while not tbZonePoint.EOF do
begin
FillChar (pt, sizeof(pt), 0);
pt.sX := tbZonePoint.FieldByName('X').AsFloat;
pt.sY := tbZonePoint.FieldByName('Y').AsFloat;
pt.sZ := tbZonePoint.FieldByName('Z').AsFloat;
pt.sNorm := 100{tbZonePoint.FieldByName('Norm').AsFloat};
pt.sNLC := tbZonePoint.FieldByName('NLC').AsFloat;
//
tbDeposit.Filter := 'Point_No='+tbZonePointNo.AsString;
tbDeposit.Filtered := TRUE;
tbDeposit.First;
while not tbDeposit.EOF do
begin
pt.aLighting[tbDepositSource_Ord_No.AsInteger] :=
tbDeposit.FieldByName('Lighting').AsFloat;
tbDeposit.Next;
end;
tbDeposit.Filtered := FALSE;

end;

rsdcPoint.Add (pt);
tbZonePoint.Next;

//
iNumSources := tbSource.RecordCount;
//
iT := (Int64(1) shl (iNumSources*4)) - 1;

155

end;

cMinStage := iT;
cMaxStage := 0;
tbZonePoint.MasterSource := dsZone;

function TfMain.swap_thetrades (w : word) : word;


begin
Result := (w and $F000 shr 12) or (w and $F00 shr 4) or (w and $F0 shl 4) or (w and
$F shl 12);
end;

procedure TfMain.btLoadClick(Sender: TObject);


var w : word;
dt : TDateTime;
begin
Screen.Cursor := crHourGlass;
mm.Lines.Clear;
// -
Load_Matrix;
// - 1-
FillAlgResultHash (1);
// ( )
dt := Now;
for w:=0 to iMaxRFLevel do
ProcessAndTraceRFLevel (w, StrToInt(edMultiplier.Text));
mm.Lines.Add (TimeToStr(Now-dt));

end;

//
iByteToSend := 0;
Screen.Cursor := crDefault;
//tmSendData.Enabled := TRUE;

156


; =================================================================================
LIST P=16C84, F=INHX8M
__CONFIG 3FFA
; 5 :
; 1 - code protection off
; 1 - power-up timer enabled
; 0 - WDT disabled
; 10 - HS oscillator
; =================================================================================
; PIC
INDF
EQU
0
TMR0
EQU
1
STATUS EQU
3
FSR
EQU
4
PortA
EQU
5
PortB
EQU
6
INTCON EQU
0Bh
OPTREG EQU
81h
TRISA
EQU
85h
TRISB
EQU
86h
;
CARRY
ZERO
RP0
T0IF
INTF
F
W

PIC
EQU
EQU
EQU
EQU
EQU
EQU
EQU

;
iCnt
EQU
TxByte EQU
RxByte EQU
TLo
EQU
THi
EQU
Level EQU
16h...19h)
BLo
EQU
BHi
EQU
RTlenLo
RTlenHi
RTprLo EQU
RTprHi EQU
FLAG
EQU
TLoPrev
trCnt EQU

;
;
;
;
;
;
;

carry flag
zero flag
bank select flag
timer int. flag
PB0 int. flag
instruction destinations

0CH
0DH
0EH
014h
015h
016h

;
;
;
;
;
;


, RS-232
, RS232

01Ah
01Bh
EQU
01Ch
EQU
01Dh
01Eh
01Fh
020h
EQU
021h
022h

;
;
; R2T-
;
; R2T-
;
;

5
2
1

0
2

1
0

; I2C
ERCODE EQU
02Bh
ADDR
EQU
02Ch
SLAVE
EQU
02Dh
TXBUF
EQU
02Eh
RXBUF
EQU
02Fh

;
;
;
;
;

; FLAG
#define
ERR1
FLAG,0
#define
prevRT FLAG,1

#define
prevPr FLAG,2

#define
eepromI
FLAG,6
#define
eepromO
FLAG,7
;
#define
ModePin
PortA,4
#define
RT
PortA,3
#define
ZD
PortB,0

(1010xxx0)


; I2C
;

R2T-

1024-

; 6- TLo,
; EEPROM
; EEPROM
;
; R2T-
; Zero Detector

157
#define
#define
#define SCL
#define
#define

RxD
PortA,3
TxD
PortB,3
PortA,0
SDA
PortA,1
Monitor
PortB,2

;
#define
#define
#define
#define
#define
#define

BANK0
BANK1
SkIfZ
SkIfNZ
SkIfC
SkIfNC

;
Move
MACRO
movf
movwf
endm

; RS232-
; RS232-
; I2C clock
; I2C data
; DEBUG pin

bcf STATUS,RP0
bsf STATUS,RP0
btfss STATUS,ZERO
btfsc STATUS,ZERO
btfss STATUS,CARRY
btfsc STATUS,CARRY

dst, src
src,W
dst

MoveCon
movlw
movwf
endm

MACRO
con
dst

MoveBit
btfss
bcf
btfsc
bsf
endm

MACRO dst, dstbit, src, srcbit


src,srcbit
dst,dstbit
src,srcbit
dst,dstbit

GoIfNEq
movf
subwf
btfss
goto
movf
subwf
btfss
goto
endm

MACRO Hi1,Lo1,Hi2,Lo2,LabToGo
Lo1,W
Lo2,W
STATUS,ZERO
LabToGo
Hi1,W
Hi2,W
STATUS,ZERO
LabToGo

Inc16

Hi,Lo
Lo,F
STATUS,CARRY
Hi,F

MACRO
incf
btfsc
incf
endm

dst, con

OffIfNZ
Move
IF
swapf
ENDIF
andlw
btfss
bcf
endm

MACRO ChanNo
BLo,Level+ChanNo/2
ChanNo % 2 == 0
BLo,W

OnChan MACRO
Move
Move
rrf
rrf
rrf
rrf
rrf
rrf
rrf
rrf
rrf
rrf
rrf
rrf
Move
IF
swapf
ENDIF
andlw
subwf
SkIfZ

ChanNo,NextLbl
BLo,TLo
BHi,THi
BHi,F
BLo,F
BHi,F
BLo,F
BHi,F
BLo,F
BHi,F
BLo,F
BHi,F
BLo,F
BHi,F
BLo,F
BHi,Level+ChanNo/2
ChanNo % 2 == 0
BHi,W

; BLo = Level [ChanNo / 2] (1- 2- )

0Fh
STATUS,ZERO
PortB,4+ChanNo

0Fh
BLo,W

; BLo = T / 64

; W = Level [ChanNo / 2] (1- 2- )

; W = BLo
;

158
goto
movf
sublw
SkIfNZ
goto
bsf
ENDM

NextLbl
BLo,W
0Fh
NextLbl
PortB,4+ChanNo

; W = BLo
;
; 15 <> W
;

"1"

SkIfNE MACRO F1,F2


movf
F1,W
subwf F2,W
SkIfNZ
endm
SkIfG

MACRO F1,F2
movf
F1,W
subwf F2,W
SkIfNC
endm

GoIfBE MACRO
btfss
goto
btfsc
goto
goto
f1is0: btfss
goto
endGIBE:nop
endm
ChIfCS MACRO
MOVLW
BTFSS
CALL
endm
ChIfSS MACRO
MOVLW
BTFSS
CALL
endm
ChAckC MACRO
MOVLW
BTFSC
CALL
endm

f1,b1,f2,b2,LabToGo
f1,b1
f1is0
f2,b2
LabToGo
endGIBE
f2,b2
LabToGo

1
SCL
ERR
ErrCode
ErrCode
SDA
ERR

3
eepromI
ERR

; =================================================================================
org
0
goto
main
; =================================================================================
org
4
goto
begINT
; =================================================================================
; DELAY
; 8 MHz:
; : 1000000[] / 115200[] = 8.68[]
; - 3 , - 5, .. 4
; .., - 4.68 ( - 2.34 )
; =================================================================================
COM_Del:return

;
main: BANK1
MoveCon TRISA,B'00011000' ; PortA usage (0-out, 1-in)
MoveCon TRISB,B'00000001'
; PortB usage (0-out, 1-in)
MoveCon
OPTREG,B'11000011'
; 1 - disable PortB pull-ups
; 1 - interrupt on up edge
; 0 - internal timer
; x
; 0 - prescaler assigned to the timer
; 011 - prescaler is 1:16 (increment every 8 us)
BANK0
btfsc ModePin
;
goto
mLoad

159
;--------------------------------------------------------------------------------------mWork: MoveCon
Level,0FFh
; (ModePin = 0)
MoveCon
Level+1,0FFh
;
clrf
RTlenLo
; RTlen = 0
clrf
RTlenHi
;
clrf
RTprLo
; RTpr = 0
clrf
RTprHi
;
clrf
trCnt
; trCnt = 0
bsf
prevRT
; prevRT = 1
MoveCon
INTCON,B'10010000'
; 1 - global interrupt enable
; 0 - EE int. disable
; 0 - TMR0 int. disable
; 1 - RB0/INT int. enable
; 0 - RB change int. disable
; 000 - reset all int. flags
loop: goto
loop
;--------------------------------------------------------------------------------------mLoad: clrf
INTCON
; (ModePin = 1)
mLoop: call
getch
;
btfsc RxByte,0
; = 0, -
goto
mRead
mWrite:
Move
call
Move
call
Move
call
goto

call
getch
SLAVE,RxByte
getch
ADDR,RxByte
getch
TxByte,RxByte
WRBYTE
mLoop

; SLAVE
;
; ADDR
;
;
;
; EEPROM

mRead: call
Move
call
Move
call
Move
call
goto

getch
SLAVE,RxByte
getch
ADDR,RxByte
RDBYTE
TxByte,RxByte
putch
mLoop

;
;
;
;
;
;
;

SLAVE
ADDR
read back data
RS232

;
ProcCh:
MoveBit
prevPr,TLo,6
OnChan 0,ch1
ch1:
OnChan 1,ch2
ch2:
OnChan 2,ch3
ch3:
OnChan 3,endPRC
endPRC:
return
;
MyDel: MoveCon
iCnt,040h
md1:
decfsz iCnt,F
goto
md1
return
;
Trans: MoveCon
TxByte,055h
call
putch
Move
TxByte,RTlenLo
call
putch
Move
TxByte,RTlenHi
call
putch
Move
TxByte,Level
call
putch
Move
TxByte,Level+1
call
putch
Move
TxByte,SLAVE
call
putch
Move
TxByte,ADDR
call
putch
movf
addwf
addwf
addwf
addwf
addwf
movwf
call
return

RTlenLo,W
RTlenHi,W
Level,W
Level+1,W
SLAVE,W
ADDR,W
TxByte
putch

160
;
begINT:
btfsc ZD
retfie
;
bcf
Monitor
OffIfNZ
0
OffIfNZ
1
OffIfNZ
2
OffIfNZ
3
clrf
TMR0
clrf
TLo
clrf
THi
clrf
TLoPrev
bcf
prevPr

;
;
;
;
;
;
;
;

;[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
loopT: SkIfNE TMR0,TLo
;
goto
loopT
;
Move

TLo,TMR0

btfsc
goto
btfsc
goto
bsf
Move
Move

RT
loop3
prevRT
loop3
prevRT
RTlenLo,TLo
RTlenHi,THi

; RT-
;

loop3: SkIfG
goto
incf
btfsc
goto

TLoPrev,TLo
Loop1
THi,F
THi,2
endInt

; TLo

;
;
;

;
;
;

RTlen = T


1024-

Loop1: GoIfBE TLo,6,prevPr,Loop2


; 6- TLo
call
ProcCh
;

bsf
Monitor
Loop2: Move
TLoPrev,TLo
; TLoPrev = TLo
goto
loopT
;
;]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
endInt:
MoveBit
prevRT,RT

btfss prevRT
; RT=1
goto
eInt1
;
MoveCon
RTlenLo,0FFh
;
MoveCon
RTlenHi,3
;

RT-

RTlen = 1023

eInt1: MoveCon
SLAVE,0A0h
; SLAVE
MoveBit
SLAVE,3,RTlenHi,1
MoveBit
SLAVE,2,RTlenHi,0
MoveBit
SLAVE,1,RTlenLo,7
rlf
RTlenLo,W
; ADDR
movwf ADDR
bcf
ADDR,0
call
RDBYTE
; 2 Level
Move
Level,RxByte
incf
ADDR,F
call
RDBYTE
Move
Level+1,RxByte
;l0:
movf

;
subwf
;
SkIfNZ
;
goto
;
movf
;
subwf
;
SkIfNZ
;
goto
;
call
;l1:
Move
;
Move

RTlenLo,W

RTprLo,W
l1
RTlenHi,W
RTprHi,W
l1
Trans
RTprHi,RTlenHi
RTprLo,RTlenLo

incf
trCnt,F
2.56 c
SkIfNZ
call
Trans
bcf
INTCON,INTF
retfie

; RTpr = RTlen
;
;

;
; :

161
END

162
-4.1

ComCode
Slave
Addr
DataByte
i
T
Timer

/ EEPROM
EEPROM I2C-
EEPROM (
EEPROM)

EEPROM

EEPROM)

Level 0

( 4

Level 7
Port 0 Port 7

RT

, R-T-

RT Prev

RT len
T Prev
Count tr

R-T-

1024-
R-T-

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