Beruflich Dokumente
Kultur Dokumente
"##$
"##$%" "&
!
! " # $%
"##$
"##$%" "&
!
''''''''''''''''''''''''''''''''''''''''''''''''''''''
! ( ! " # )% &*
''''''''''''''''''''''''''''''''''''''''''''''''''''''
+ ( ! " + # ' , &+ )*
''''''''''''''''''''''''''''''''''''''''''''''''''''''
+ ( ! " + + + &- )*
& .. / 0112
- " &
" & 3
3 4 /
#- & 3 & 3
# & 7 & 7
'
3 &
8: ' 3
" / %
8 4 3 4
+ ;
9 : /
9 #$<=> ! 3 " 7 /
/ 3
* "?
& /
"? 3 7
! $ ( 8 : + !
! 9 #$<=>
" @ @ 9 #$<=>
? A 3 @ " ?
C @$? ( 8 @ @ + ! " 8
9 #$<=>
(
* .) "6 : .=
D .) E 0F
* 0)! ! .G*G0=# 0>
D 0) H8 # 02
D F) 8 # 02
D <)! 6 7 8$0F0 9 #$<=> 0I
* F) J H F1
* <)8 9#
$ <=> F.
* >) ' 9 #$<=> F0
* G) ' 9 #$<=> FF
* 2)! " # HK H$ F<
* =) F>
D >) 7 FG
* I ) 9' 7 FG
* .1 ) ; E" FI
* .. ) "? <1
* .0 ) - " : <.
D G) 6 <0
* .F ) <<
* .< ) "? 9 #$<=> <>
* .> ) <G
* .G ) ! / 7 <2
* .2 ) - "? <=
D 2)* >1
* .= ) - "? >.
* .I ) - "? >.
* 01 ) 8 E >F
* 0. ) E ><
* 00 ) + 9 $ >>
D =) " 7 "? >2
D I)* @ 8# >=
D .1 ) E >=
D .. ) >I
D .0 ) L E G1
D .F ) * 3 G1
D .< ) M " 7 G0
D .> ) G0
D .G ) GF
D .2 ) / E G<
D .= ) 3 7 GG
D .I ) 8 E G2
D 01 ) Historico G=
* 0F ) E GI
* 0< ) 7 21
* 0> ) / E 2.
* 0G ) : 20
D 0. ) 2<
#N- ) # : N-
# )
#L )
#O )
#8 )
-9 )
#) #
-)
!) ! "#$
L! ) L: ! E
! ) "
) % &
99! ) 9 9 !
-N# ) - N# :
-P ) ' (
-LL ) &
-O! ) ( &"
9N8 ) 9 N8 6
9 - )
99! %+ ) " % )* $
9 #)
;O- ) +
P )' , % &
999 )
L- ) %
L9- )
%8 ) *
! )"
! )"
!,+ ) " # $
#+ ) % $
*) 3 *
O* ) 3 O $*
8)%
8; - ) 8 ; -
!N ! ) - " . "
L)- )-
+L ) $
8# ) % -
M )/ % &
M 9* ) / % 0
,- ) # -
Q) RS
*
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +
. . % T9 M%8 -% # #LP% .>
. 0 98 # -% # #LP% .G
" - ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +$
0 . 8 8 9+#8 8 !9 M 8U %8 .2
0.. # 3 : .=
0.0 + 01
0 0 89O8% 98 01
00. 0.
0F + % %O %L#-% 98 0F
0F. ! .G*G0=# 0<
0F0 8# 0>
0 < !#- V% 9 #$<=> 0=
0<. 8 9 #$<=> F1
0<0 FF
0<F F<
0<< 7 F>
0<> ! FG
0 > ! % % %L%8 -9 #O8+ 88V% -9 -#-%8 F2
0G # #LP%8 % 9L# %8 F=
0G. ! : : ' "
6 F=
0G0 ! 4 "
7 FI
0GF ! : / !N ! 9
R=10 FS <1
0G< ! : ? "? /
" " <.
0G> 7 <.
. ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, .
F. 9D 8 %8 -% 8 8 9+# <F
F 0 98!9 * #WV% -% 8 8 9+# <F
F0. M <<
F00 9 " 7 <G
F0F 9 " <I
F0< 9 " "? >1
F F +!L9+9O #WV% -% 8 8 9+# >G
FF. " / >G
FF0 "? >2
FFF "? G.
FF< % G=
F< 98 L #-%8 9 - 8 88V% 20
( ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,$
< . 9H 9O8X98 2G
- *- ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, $$
.<
D " Y Z[ /
" " / E " 7 3
/ E &
4 % /
" " " % 4 E
PE 3 " 3
! "6 &
: 3 / " 7
R & 4 S R E3 E3
S % E " 3 E
& 3 3 4
# E /
& / 7 E "
& 3 E " 7 3 E
E 4
9 4 / 7
R 999S =10 F 999 =10 ..& 4
R9 #S <=> $
! 3
" 3 9 #$<=>
93 / 999 =10 F
/ 9 #$<=> ! " &
9 #$<=> & J
6 " # & 6
3 : E 7
.. % T9 M%8 -% # #LP%
% 4 / : : 3
/ " 7 & ' 6
E 3 3 "
J "
% 4 6" (
S " 7 ^
S ^
S / 3 9 #$<=> "
7 ^
.G
S " 7 ^
S & "? &3 E : ^
"S & "? &3 E " J
.0 98 # -% # #LP%
9 E 3 6 % /
3 E % " :
E %
" & / % 3 6 7
7 ' 7
.2
" -
O 6 E
& 3 ( : & & & 9 #$
<=>&
0. 8 8 9+#8 8 !9 M 8U %8
E "
" " " " & :'
R S
& 4 _ ` E & &
7 "
& R # 9 %^ + a#; ^ 8 LM#& .IIF& =G$=2& " S
0.. #3 :
* (8 8 R011>& FS
* .) "6 :
% 3
: &3 / "6 &
& : E
% / &
3 % 3
7 3
R8#LM#-% ^ 8 LM#& 011>& 0S
# " " 7 " 7
L 3
.I
J & &"
: & ) & & " 3b & # 7
: & E
" 7 "
& / ] 6
& " 7
R8#LM#-% ^ 8 LM#& 011>& 0S
% " : /
E / ]
3 / 3 3 &
& : & & : 3
E &
E & " & : E" &
E R # 9 %^ + a#; ^ 8 LM#& .IIF&
==S
8 8 8 R011>& FS& :
" : &3
" ' /& 4 9 & $
" ( ] & 7 &
& : & :
R S & " E" & : & 7
: ' N
# " :
3 & 4 " 7 ]
"? % ] E " '
" 7 : & " E
& " E" &
E" & 7 : & '
& " &
R8#LM#-% ^ 8 LM#& 011>& F$<S
01
0.0 +
00 89O8% 98
& J J &
/ "
% " 3
E 3 4 * R0110& <S "
3 3 3 3 3 "
" 3 " (
S 6 ( 3 E 6 ^
S ( 3 E &
: ^
S : ( 4 &
3 3 ^
S ( 4
8 * R0110& <S& : &
" " E ! & 3
: E " :
" # : N- R#N-S& 3
: & - N# : R-N#S& 3
:
00.
E
N "
017;<=1> ?<91;>
\
N
O6
#
!
! /
*
9
! /
9 3 6
!
* ( # * R.IIF& 2=S
D .) E
0F + % %O %L#-% 98
0F. ! .G*G0=#
/ FN !.^
( ]
+ .P( + .L ! .P( ! .L !,+(
^
S : ( 3
7 : ^
4S : 8# ( 7 : 6"
^
AS # - R,- S( / :
& ,- / &
^
S 0&>M >&>M(
7 0&>M >&>M^
S 7 ( ! .G*G0=# " (
1^ ' 1N O ^
R 2( <S^ 99! %+^ : ^
8# ^ : !^ +9 .^ 3 +9 0
! 0
* (+ R011>& <S
* 0)! ! .G*G0=#
0F0 8#
3 "
" 6
" R! S& 7
9' 8# ! ( 6
6 & R" + R;O-SS
O 6 & / &R & S
/ E" & TE
6 & ' # &
/ R HS R HS R8% c#& 011F&
.2.S
" c R011G& 0><S& 8# "
6 # 6
& & &
% H8 # : 8# 8
c R011G& 0>>S& " 7 6
R3 0S(
S 8 ( & / O
6 " ^
S HI( Id RI$ S E I e .
E= e 1^
S H9O( e.
e 1^
S 8aO ( 6 e .
6 e 1^
S F( L 1^
"S ;P( R ' " S O
6 ( e .& ' e 1^
S + ( / R 8 S
8 / e. 8 e 1^
S HI-( ! /
02
9=4;1?1;/AC49 "."
+ ! +
O] . ). . ) F0
E' .0 .011
8 gFM g011 M
J FA 2A j.1&GA
RhS
* ( + R0110& .0S
D <)! 6 7 8$0F0 9 #$<=>
8 8 R011>& 0S& / 9 #$<=> J
& 6 # E' '
E' & &
R" FS ! 1&>.. J ' E'
I1A .011 R<111" S % E' .1+ E
G R01" S +
.01h
F1
* (! R.III& FS
* F) J H
0<. 8 9 #$<=>
* (8 R011>& FS
* <)8 9 #$<=>
# : & 9 #$<=>
& ) J 9
%
) 3 & & 4
R8 LM#& 011>& FS
#" > 6 9 #$<=> " 8 R011>& <S
" 3 #
& & / 9 "
% 3
) E '
/ " " ' J J
" R S 4
3 7 " 7
"
"
F0
* ( 8 R011>& <S
* >) ' 9 #$<=>
#" G ' 3 9 #$<=> 3
" " 8 R011>& >S&
# & & $
O " 3 " &
E &
% : & :
$ :
FF
* ( 8 R011>& >S
* G) ' 9 #$<=>
% ;O- 9 #$<=> " :
R S& .11h
R.N0,S % : "
" 9 & " :
" R S .11h R.N0,S # "
& /&
8 : 3 &
" " # E O &
& & " 8 " &
.11h R8 LM#& 011>& >S
0<0
* (8 R011>& 2S
* 2)! " # HK H$
0<F
* (8 R011>& =S
* =)
0<< 7
* (! R.III& GS
* I ) 9' 7
0<> !
& E
! $ 3 9 #$<=>
"6 * R%8 S E
/ $ ' & ( + & ' ( R-PS <=>
( &" R-O!S F& " " 7 6 "
& & &
S 6 ( 3 /
& " O : /
R#8 S !
& 7 E & 3 3 &
/ E ^
S 6 ( 3 & 4 &
7 & ! & E
!
& : #8
R9 - S
D & & "
RL%98 P^ 8 O;# ^ #*O9 & .IIG& F0$F2S(
S ( /
E" 8 &
" 3b & J ^
S ( /
6 & & "
7 E " & ' 3
" 7
0G # #LP%8 % 9L# %8
# ' 3 &
# R011>S& R.IIIS& + T R011>S 8 R0110S
& 3 3
" " E 6" ! / 3
" 7 " / &
L: ! E R L!S 3 4E " / / # "
L! "? " / 8$0F0
O & / / ! ' %
"? & % 4 !
- 2& E" E
/ E R" .1S % 7 3
7 & " ' &
* (# R011>& <.S
* .1 ) ; E"
0G0 ! 4 "
7
R.IIIS '
9 9 ! R 99!S
7 % : & &" /
7 &
" / & "
# : & " \
" " " /
<1
0GF ! : / !N ! 9
R=10 FS
% + T R011>S 4 ?
"? & &
# & ?
"? 3 &
* 6 ? J &
" E % "? "
" "?
& / T &3
? & E$ / E
R" ..S # ? "? " " 9
- " . " R !N !S
* (+ T R011>& >2S
* .. ) "?
<.
0G< ! : ? "? /
" "
% 8 R0110S
J N J " /
63 /
J 3 4 / #
" " & " &
" " * /
9 #$<=> " & 7 6
# J & "
# /
" $ / '
" 6 6 &"
* / ! .G*=22 " /
#" .0 :
* (8 R0110& F=S
* .0 ) - " :
0G> 7
O 3 G 6 # R011>S&
R.IIIS& + T R011>S 8 R0110S
<0
R -S
L! L! + +
0111 ! .G*=22
! # @
! + !N ! "
! % 4 ! T # @
"?
! '
8 O 8 O O
D G) 6
<F
F. 9D 8 %8 -% 8 8 9+#
% 3 * R *S 3 O $* R O*S (
S 3 R *S^
S E " 7 R *S^
S " J R *S^
S " 7 R O*S^
S 9 #$<=> 7
: R O*S^
"S 7
: R O*S^
S / % 4 ! "?
R O*S^
S "?
R O*S^
S / ! ' R O*S
! " " % : E
7 & "? & 3
F0. M
% 3 " 7 &
" 7 " E & 3
4 f / 9 #$<=>
#" .F 3
"
* .F )
% "? 7 &
/ " 7 E & # 7
E & $ 3
%
7 6 R 0 >S& "
" " "? 7
% "? 7
<>
LR / S 9 #$<=> $
R" .>S
* .> )
F00 9 " 7
# 7
D &
E 7
# "? &
! 3 " 7 3
7 / 8+# ! R! %*988% O%& 0112S # "
" 7 R" .GS(
S .! .G*G0=#^
S 3
^
S L- ^
S !,+ R S
: " R S^
S G & F 6 1 F 6 .&
7 ' ^
<2
"S .1 6 RL9-S^
S ,, " 3b ^
S " : ^
S 6 : / % 0 RM 9*S^
4S !% R 6 ' S
* (! " R0112S
* .G ) ! / 7
! & 3 /
? D 3 ? & 3
8O2>.2G ! R 6 S % 8O2>.2G ! 3
L 9 #$<=> 3
/ 7 R LS
R 9 #$<=>S
# " .2 " "?
7 ! " " /
$ R +LS& '6 " 9 #
R8!# H8a8 9+8& 0112S
<=
* .2 ) - "?
O " 3
<I
F0F 9 "
3 E ' ^
S ( @ 3
^
"S @ ( / " 8 E >> R
' S
E N
@ @
D 2)*
% "? E E
% "? ' N '
^ 7 & E & 7 ^ /
E ^ : : f E
7
" 7
# E 6 " 7 N "?
^ N N ' 7 & E & 7 3
' ^ / E
: " 7 #" .=
"? ! " " / " 9
# R8!# H8a8 9+8& 0112S
>.
* .= ) - "?
#" .I "?
* .I ) - "?
>0
# TForm1 E " E f
7 & E & E
E & : : 7
7 /
TX_RX f 3 ' 4
' N ' "? & " 3 7 &
E &
E & / E &
' 7 &
" 7 Historico
O " 01 0. 7 TX_RX
* 01 ) 8 E
><
* 0. ) E
# " 00 + 9 $
% " / $ " - - <
>>
* 00 ) + 9 $
# Estacao / : & E
f 3 "? " /
" R E S #
Variavel / : & " E
# Comando : & " 3
' E R & &
& S " 7
" - " & ' "
7 " - 6 E 3
# Acao / 7 3 E 3 3 '
Acao ( : ^ ^ : E
>G
^ J & 4 &3 E E
R ' & E /S^
& 4 & E & " & 3
J R / E : S^ :
' ^ J & 4 & 3 E
& ' ^ 3 E ' ^
E : /3 " ' # Historico /
: & 3 & E f
3 : :
# & "
/ 7 &
"?
FF. " /
! "? " / % 4 !
- G& 4 "
" 7 R" .I& 01 0.S ! 3 "?
9 #$<=>& " E
! RM L %+!%O9O 8& 0112S E
4 - G !
" / ! '
O "? " /
+A R+ C %9L9C %O C#&
0112S& & " "
R" .=S ! "? " /$
: $! . 1> R $! %;& 0112S ! 3
7 " / 8+# !
>2
FF0 "?
% "? " ( N
E & E &
' !
/ : 8# 8 " 7 &
& 8#& 8 !,+ 3
=
void main(){ // Início do programa principal
// CONFIGURAÇÕES DA USART
SPEN=1; // Habilita a USART
SYNC=0; // Seleciona o modo ASSÍNCRONO
BRGH=1; // "baud rate" ALTO
SPBRG=25; // Ajuste do baud rate para 9600bits/s
TXEN=1; // Habilita a transmissão
CREN=1; // Habilita a recepção
// CONFIGURAÇÕES DO PWM
CCP1CON = 0x0F; // Habilita o modo PWM
TMR2ON=1; // Habilita o Timer2
T2CKPS1=0; // Prescaler do...
T2CKPS0=1; // ...Timer2 em 1:4
PR2=249; // Determina a freqüência 1KHz para o
PWM
CCPR1L=0; // Zera a parte alta do PWM
...
D =) " 7 "?
% 3 I " leUsart(): char& '
"? D @ 8# &
" 9;& * 9
* & E retorno E ] /
9; # " E retorno
>=
...
char leUsart(){
char retorno;
if (RCIF){
retorno = RCREG;
}
delay_ms(1);
return retorno;
}
...
D I)* @ 8#
# : G @ & "? " / E R3 .1S "
F 0 F& 6 @ E ## R
' S % @ % 4 & :
E 3b E @
E & E / % & 3 3 @ /
E comando& dado end_origem& 8 ' @ " >> R
' S& 3 E % "?
" /
...
start = leUsart();
if (start == 0xAA){
end_destino = leUsart();
if (end_destino == 0xE1){
comando = leUsart();
dado = leUsart();
end_origem = leUsart();
stop = leUsart();
if (stop == 0x55){
//COMUNICAÇÃO REALIZADA COM SUCESSO
confirmaRecepcao();
...
D .1 ) E
O : 3 ..& $ 3 while
" E 8# 8
& :' " 3 E 8
" E & " 3 E
" E 8 3 E
' & " E
>I
...
while(1){
start = leUsart();
if (start == 0xAA){
end_destino = leUsart();
if (end_destino == 0xE2){
comando = leUsart();
dado = leUsart();
end_origem = leUsart();
stop = leUsart();
if (stop == 0x55){
//COMUNICAÇÃO REALIZADA COM SUCESSO
confirmaRecepcao();
switch(comando){
//LDR
case 0xA0: transmitePacote(0xA0, C1OUT); break;
//termistor
case 0xA1: transmitePacote(0xA1, C2OUT); break;
//receptor óptico
case 0xA2: transmitePacote(0xA2, RA3); break;
//botão RA7
case 0xA3: transmitePacote(0xA3, RA7); break;
//botão RA5
case 0xA4: transmitePacote(0xA4, RA5); break;
case 0xC0: acionaBuzina(); break;
case 0xC2: acionaVentilador(255); break;
case 0xC3: acionaVentilador(150); break;
case 0xC4: acionaVentilador(80); break;
case 0xC5: desligaVentilador(); break;
case 0xC6: acendeLampada1(); break;
case 0xC7: apagaLampada1(); break;
case 0xC8: acendeLampada2(); break;
case 0xC9: apagaLampada2(); break;
case 0xCA: acendeLampada3(); break;
case 0xCB: apagaLampada3(); break;
case 0xCC: acendeLampada4(); break;
case 0xCD: apagaLampada4(); break;
case 0xCE: acendeLampada5(); break;
case 0xCF: apagaLampada5(); break;
} //fecha switch
} //fecha if
else{
// OCORREU ERRO DE COMUNICAÇÃO
solicitaRetransmissão();
}
}
}
}
...
D .. )
% 3 .0 3 '
4 E % .% 0%
E / & % #F& #2 #>
E & . 0& !
N & " transmitePacote(char variavel, char dd)& 4
J " E
G1
...
//LDR
case 0xA0: transmitePacote(0xA0, C1OUT); break;
//termistor
case 0xA1: transmitePacote(0xA1, C2OUT); break;
//receptor óptico
case 0xA2: transmitePacote(0xA2, RA3); break;
//botão RA7
case 0xA3: transmitePacote(0xA3, RA7); break;
//botão RA5
case 0xA4: transmitePacote(0xA4, RA5); break;
}
...
D .0 ) L E
# R3 .FS
$ 1R S 6 : .& 3
H 9; -
H 9;& & & . R HS %
+ H 9;& 3 H 9;
/ # " G @ 3 7 &
$ 1 6 : 1
...
void transmitePacote(char variavel, char dd){
RB0 = 1; //HABILITA A TRANSMISSÃO
delay_ms(100);
TXREG = 0xAA; //START BYTE
while(TRMT == 0) //ENQUANTO ESTÁ TRANSMITINDO
{ //TRMT É ZERO. PORTANTO, AGUARDA
} //O FINAL DA TRANSMISSÃO
TXREG = 0XE0; //ENDEREÇO DE DESTINO
while(TRMT == 0)
{
}
TXREG = variavel;
while(TRMT == 0)
{
}
TXREG = dd;
while(TRMT==0)
{
}
TXREG = 0XE1; //ENDEREÇO DE ORIGEM
while(TRMT==0)
{
}
TXREG = 0X55; //STOP BYTE
while(TRMT==0)
{
}
delay_ms(100);
RB0 = 0; //DESABILITA TRANSMISSÃO
}
...
D .F ) * 3
G.
FFF "?
7 R3 .<S !
3 E % "?
. 8 & "? E
/ O : & "?
E3 E E E 8 & "?
E 3 E % R S /
estacoesAtivas 4 6 :
G0
procedure TForm1.verificaEstacoesAtivas();
var
endereco: integer;
Rnm_estacao: string;
begin
query1.close;
query1.sql.Clear;
query1.sql.text := 'select End_estacao as Qendereco, Nm_estacao as
Qnm_estacao from Estacao';
query1.open;
if query1.Eof = true then
else
begin
query1.First;
while not (query1.Eof) do
begin
endereco:= Query1.fieldbyname('Qendereco').AsInteger;
Rnm_estacao:= query1.fieldbyname('Qnm_estacao').AsString;
transmitePacote(endereco, $ED, $ED);
StartTime:= now;
repeat
Application.ProcessMessages;
until now > StartTime + 1 * (1/24/60/60);
if estacoesAtivas[endereco] = false then
begin
transmitePacote(endereco, $ED, $ED);
StartTime:= now;
repeat
Application.ProcessMessages;
until now > StartTime + 1 * (1/24/60/60)
end;
if estacoesAtivas[endereco] = false then
begin
transmitePacote(endereco, $ED, $ED);
StartTime:= now;
repeat
Application.ProcessMessages;
until now > StartTime + 1 * (1/24/60/60);
showmessage('A ESTAÇÃO ' + Rnm_estacao + ' NÃO ESTÁ
RESPONDENDO');
end;
query1.Next;
end;
end;
solicitaTxVariaveis();
end;
D .< ) M " 7
# 3 .> R .S &
& % "? E ' & &
3 R
& ' S
'
StartTime:= now;
repeat
Application.ProcessMessages;
until now > StartTime + 1 * (1/24/60/60);
D .> )
%3 .G 8
J 3 4 &
GF
! & J false
SetRTS() 4 comport1 @
J WriteStr() # : ] @
.1 ! J true
SetRTS()
procedure TForm1.transmitePacote(_estacao: integer; _comando: integer;
_dado: integer);
Begin
if comport1.Connected = true then
begin
comport1.SetRTS(false);
comport1.WriteStr(chr($AA));
comport1.WriteStr(chr(_estacao));
comport1.WriteStr(chr(_comando));
comport1.WriteStr(chr(_dado));
comport1.WriteStr(chr($E0));
comport1.WriteStr(chr($55));
StartTime:= now;
repeat
Application.ProcessMessages;
until now > StartTime + 0.010 * (1/24/60/60);
comport1.SetRTS(true);
end
else
showmessage('O SUPERVISÓRIO NÃO ESTÁ CONECTADO NA REDE');
end;
D .G )
% / $
ComPort1RxChar(Sender: TObject; Count: Integer) 4 comport1 R3 .2S&
3 3 % @ 3
/ E protocolo 9 " E
' 7 R F F 0S 9 &
& " E
J atualizaVariavel(_estacao: integer; _variavel: integer;
$ Acao 3 :
E / % 4 & $ 7 E 3
E ' 6 &
Acao : J 3 E ' %
& : & "
E '
G>
query2.close;
query2.SQL.Clear;
query2.sql.text := 'select Cd_variavel as Qcd_variavel from Variavel
where Cd_estacao=:Pcd_estacao and End_variavel=:Pend_variavel';
query2.ParamByName('Pcd_estacao').AsInteger:= Rcd_estacao;
query2.ParamByName('Pend_variavel').AsInteger:= _variavel;
query2.Prepare;
query2.open;
Rcd_variavel:= Query2.fieldbyname('Qcd_variavel').asInteger;
query2.close;
query2.SQL.Clear;
query2.sql.text := 'select Cd_comando as Qcd_comando, Reg_evento as
Qreg_evento, Cd_acao as Qcd_acao, Par_cont as Qpar_cont from Acao where
Cd_variavel=:Pcd_variavel and Par_sup=:Ppar_sup';
query2.ParamByName('Pcd_variavel').AsInteger:= Rcd_variavel;
query2.ParamByName('Ppar_sup').AsInteger:= _dado;
query2.Prepare;
query2.open;
query3.close;
query3.SQL.Clear;
query3.sql.text := 'select End_comando as Qend_comando,
Cd_estacao as Qcd_estCom from Comando where Cd_comando=:Pcd_comando';
query3.ParamByName('Pcd_comando').AsInteger:= Rcd_comando;
query3.Prepare;
query3.open;
Rend_comando:= Query3.fieldbyname('Qend_comando').asInteger;
Rcd_estCom:= query3.fieldbyname('Qcd_estCom').asInteger;
query3.close;
query3.SQL.Clear;
query3.sql.text := 'select End_estacao as Qend_estCom from
Estacao where Cd_estacao=:Pcd_estCom';
query3.ParamByName('Pcd_estCom').AsInteger:= Rcd_estCom;
query3.Prepare;
query3.open;
Rend_estCom:= Query3.fieldbyname('Qend_estCom').asInteger;
query2.Next;
end;
end;
end;
D .= ) 3 7
" J E
4 " 3
" ' E : E "
Reg_evento 8 " true&
procedure TForm1.solicitaTxVariaveis();
var
Rend_estacao, Rcd_estacao, Rend_variavel: integer;
begin
while comport1.Connected = true do
begin
query1.close;
query1.sql.Clear;
query1.sql.text:= 'select End_estacao as Qend_estacao, Cd_estacao as
Qcd_estacao from Estacao';
query1.open;
if query1.Eof = false then
begin
query1.First;
while not (query1.Eof) do
begin
Rend_estacao:= Query1.fieldbyname('Qend_estacao').AsInteger;
Rcd_estacao:= query1.fieldbyname('Qcd_estacao').AsInteger;
if estacoesAtivas[Rend_estacao] = true then
begin
query6.close;
query6.SQL.Clear;
query6.SQL.Text:= 'select End_variavel as Qend_variavel
from Variavel where Cd_estacao=:Pcd_estacao';
query6.ParamByName('Pcd_estacao').AsInteger:= Rcd_estacao;
query6.Prepare;
query6.Open;
if query6.Eof = false then
begin
query6.First;
while not (query6.Eof) and comport1.Connected = true do
begin
Rend_variavel:=
query6.fieldbyname('Qend_variavel').AsInteger;
transmitePacote(Rend_estacao, Rend_variavel, $EE);
StartTime:= now;
repeat
Application.ProcessMessages;
until now > StartTime + 1 * (1/24/60/60);
query6.Next
end;
end;
end;
query1.Next;
end;
end;
end;
end;
D .I ) 8 E
" 0 . .& 7 :
: : % 3 01
registraEvento(_cd_acao: integer; _dado: integer)& E
: 7 J :
E Historico : & 3
" ' E 3
G=
FF< %
# $ "
! 3 "? & E
Conexão Conectar # 6& R
S& E & &
"? E 6
# " 0F E 3
Cadastro& $ Variáveis O $ " 3 " E
& " E % " ] 3
E % 7 &
& ' E - " E
7
GI
* 0F ) E
$ Cadastro& $ Ações E
7 R" 0<S O $ " & &
J R3 S E & &
J 3 E ' ! E : &
E " 3 & 4 & E
' 3 " & & & / O &
/ " PARÂMETRO DE SUPERVISÃO ! 3
: 6 3 E
'
21
* 0< ) 7
% E E Variáveis& $
Visualizar Variáveis R" 0>S - $
4 E 4 " # / /
E
2.
* 0> ) / E
# : " Relatórios % E
: 7 3 6 R
S 6" R" 0GS $ 3
RS R7 S 9'
3 " 7
20
* 0G ) :
# / 8+# ! 7
" & ' "6 " 4E
8O2>.2G !
R S E & /&
O & % ! .G*G0=# 3 E & #N-&
E : &" 3
"
% ! RM L %+!%O9O 8& 0112S& /
"? & $ "
2F
9 #$<=> % $ / : 8#
9 / & -9
3 E
E 3
R 0 . 0S O 7
" $
E O $ 3
3 RS % $
.
% " /
: 7 % /
IG11 N 3 " & "
/ 9 7 4
,, & :
% 4 & "? ' # $ 3
,, " / 3
&" / 3 '
O 3 0. 6 4
R 0 GS
2<
! " + !N ! "
! % 4 ! % 4 T # @
"? !
! ' ! '
8 8 O 8 O O
D 0. )
2>
- : 7
' 3 # " E
" 4 E # 3
" J
# /
: 6 ] & " 3 & / &
" & " ' &
" 3 / "
% ] 7 3
: $ 3 ] " 3
9 & $
]
- 7 & $ / 3 4 "
# 3 " &
* 3
9 #$<=> " / 7 "? #
" " " & :
: " 7 % E " J
' &
# / ! " J
"? " 6
9 #$<=> # /
% 4 ! "? "?
& & 3
# 9 #$<=>
& " " 8 "E
" 4 -
' & $ E 4
% $ "
. & E
& & 3 E
3b
' O "? & E :
E" " 9' 7 J
: 9 #$<=> R 0 <S
<. 9H 9O8X98
9' 3
$ (
S 3 "
/ 3 !N !^
S $ " / &
: $" ^
S / " & E" &
7 ^
S / " \ ? / 7
^
S 7 "
E ^
"S : "? 3 " 7
' N ^
S " R & &
$ & $ & $ $
S
22
- *-
# O9 %& 9 +
" 7 ( 89+ On % O# %O#L -9
! %- WV% 9 #O8+ 88V% -9 9O9 ; # 9Lf #& .> & .III& * /
7/19 * / ( # ! & .III O - 6 (
l (NN??? N' N' N N 01 "m # ( .1 0112