program recst; { zapinani a vypinani kamery pro potapeni STDB >stop> rec >stop> power off + zoom} {p1.0- =L normalni provoz RS 485 =H prime rizeni Lcontrol z PC pres RS 232} {p1.3=switch,p1.4-p1.7=led} {I0=p3.2 interrupt L,T0=p3.4 cteni a rizeni L} {p1.3 okamzik zapisu nebo vzorkovani L control L na konci int H} {p1.5 int startbitu prvniho slova Lcontrol} {p1.6 okamzik vzorkovani a vysilani seriove linky} {p1.7 cely int start bitu i casovych oken Lcontrol} {p3.4,p3.2,p3.5 p1.7,p1.6,p1.5,p1.4} var remin :array[0..10] of byte data; remout :array[0..12] of byte data ; ldat :byte data at $18; ldat1:byte data at $19; ldat4:byte data at $1A; ldat5:byte data at $1B; ldat6:byte data at $1C; ldat7:byte data at $1D; uldat:byte data at $16; citldat:byte at $1F; znak: byte data at $0A; {r2} uremin: byte data at $0B; {r3} dremin: byte data at $0C; {r4} dremout:byte data at $0D; {r5} uremout:byte data at $0F; {r7} citbit: byte data at $12; {r2} pomint: byte data at $13; {r3} lstatus:byte data at $14; {r4} crt: byte data at $15; {r5} citac:word; pok,kot,pomcit:byte; pomci,hod,min,sek,sni,hodp,snip,sekp,minp,pomcit1,nuld:byte; qdat,loknot,rezim,ldat1f1,ldat1f2,ldat1f3,kudlak,cirac:byte; p35p,rect,stopt,vypnise,krok,reminkon,LOK,timok:boolean; anuld:word; const verze:string[22] = (' recst verze 1.0 18.4.1997 '); tim1 :byte=$ff; {38400Bd pro 14745600 Hz licha parita} th0s:byte=$f0; tl0s:byte=$d6; {2089=1700ms ramec L} th0bd:byte=$ff; tl0bd:byte=$a0; {128=104ms 9600Bd write,read 80 96} th0r:byte=$ff; tl0r:byte=$56; {192=156ms read prvni 40 56} procedure interrupt timer0 ;using 2; begin tr0:=false;tl0:=tl0bd;th0:=th0bd;tr0:=true; {$A mov a,r6} {uldat} {$A cjne a,#0,koit0} {$A mov a,r2} {citbit} {$A jnz koic0} {$A mov a,ldat} {$A mov r3,a} {pomint} {$A koic0: mov a,r3} {$A clr c} {$A rrc a} {$A mov r3,a} {$A mov p3.4,c} {$A ljmp koite} {$A koit0: cjne a,#1,ksit1} {$A mov a,r2} {citbit} {$A jnz koic1} {$A mov a,ldat1} {$A mov r3,a} {pomint} {$A koic1: mov a,r3} {$A clr c} {$A rrc a} {$A mov r3,a} {$A mov p3.4,c} {$A ljmp koite} {$A ksit1: cjne a,#1,ksit2} {$A mov a,r2} {citbit} {$A jnz ksic1} {$A mov a,#0ffh} {$A mov r3,a} {pomint} {$A ksic1: mov a,r3} {$A clr c} {$A rrc a} {$A mov r3,a} {$A mov p3.4,c} {$A ljmp koite} {$A ksit2: cjne a,#1,koit1} {$A mov a,r2} {citbit} {$A jnz ksic2} {$A mov a,#0ffh} {$A mov r3,a} {pomint} {$A ksic2: mov a,r3} {$A clr c} {$A rrc a} {$A mov r3,a} {$A mov p3.4,c} {$A ljmp koite} {$A koit1: cjne a,#4,koit4} {$A mov a,r3} {pomint} {$A mov c,p3.2} {$A rrc a} {$A mov r3,a} {$A mov a,r2} {citbit} {$A cjne a,#7,koite} {$A mov a,r3} {$A cpl a} {$A mov ldat4,a} {$A ljmp koite} {$A koit4: cjne a,#5,koit5} {$A mov a,r3} {pomint} {$A mov c,p3.2} {$A rrc a} {$A mov r3,a} {$A mov a,r2} {citbit} {$A cjne a,#7,koite} {$A mov a,r3} {$A cpl a} {$A mov ldat5,a} {$A ljmp koite} {$A koit5: cjne a,#6,koit6} {$A mov a,r3} {pomint} {$A mov c,p3.2} {$A rrc a} {$A mov r3,a} {$A mov a,r2} {citbit} {$A cjne a,#7,koite} {$A mov a,r3} {$A cpl a} {$A mov ldat6,a} {$A ljmp koite} {$A koit6: cjne a,#7,koit7} {$A mov a,r3} {pomint} {$A mov c,p3.2} {$A rrc a} {$A mov r3,a} {$A mov a,r2} {citbit} {$A cjne a,#7,koite} {$A mov a,r3} {$A cpl a} {$A mov ldat7,a} {$A mov r6,#255} {uldat} lok:=true; {L KONEC} tr0:=false;tl0:=tl0s; {hledej synchron L skupiny} th0:=th0s;tr0:=true;ex0:=true; {$A ljmp koite} {$A koit7: cjne a,#255,koite} {$A mov r2,#8} {citbit=8}; {$A koite: inc citbit} if citbit=9 then begin {$A mov r2,#0} { citbit:=0; } tr0:=false;ie0:=false;ex0:=true;p3.4:=false; {$A inc r6} {uldat} end; end; procedure interrupt int0 ;using 2; begin if uldat=255 then begin tr0:=false;tl0:=tl0s; {hledej synchron L skupiny} th0:=th0s;tr0:=true; end else if uldat<4 then begin tr0:=false;tl0:=$ba; {set write} th0:=$ff;tr0:=true;ex0:=false; end else begin tr0:=false;tl0:=$80; {set read} th0:=$ff;tr0:=true;ex0:=false; end; inc(cirac); end; begin p1:=$ff; p3:=$ff; tl0:=tl0s; th0:=th0s; tl1:=tim1; th1:=tim1; tmod:=$21; tcon:=$51; scon:=$d0; ti:=true; pcon:=$0; ip:=$3; uldat:=255; ie:=$83; dremout:=0; reminkon:=false; es:=false; {nak comand error kvuli synchronizaci} vypnise:=false;p3.4:=false; ldat1f1:=$30;kot:=1;rezim:=$30;citldat:=0;krok:=false;qdat:=$18; sni:=0;min:=0;sek:=0;hod:=0;lstatus:=0;lok:=false;rect:=false; kot:=3;citldat:=0;ldat1f3:=$30;ldat1f2:=$30;ldat1f1:=$30;stopt:=false; repeat until (lok or not(p3.5));p35p:=false; loknot:=0; repeat if ((kot=0) and (citldat=0)) then begin if vypnise then begin {mali se vypnout} ea:=false;p3.4:=false; for pomci:=0 to 10 do for citac:=0 to 60000 do ea:=false; ea:=true; end; if (stopt=true) then begin {zastav kameru a vypni se} qdat:=$18;kot:=3;citldat:=0;ldat1f3:=$5e;ldat1f2:=$5e ;ldat1f1:=$5e ; {$30 5e 5e} vypnise:=true; {prikaz power off} end; {nenili normal rec dej start/stop} if (rect=true) then begin qdat:=$18;kot:=3;citldat:=0;ldat1f3:=$33;ldat1f2:=$0;ldat1f1:=$0;rect:=false; end; if (lstatus<>4) then p1.0:=false else begin if cirac>50 then begin cirac:=0;p1.0:=not(p1.0); end; end; end; {zoom mimo poradi} if not(p1.7) then begin citldat:=5;ldat:=$28;ldat1:=$35; end; if not(p1.6) then begin citldat:=5;ldat:=$28;ldat1:=$37; end; if not(p1.5) then begin citldat:=5;ldat:=$28;ldat1:=$45; end; {focus far } if not(p1.4) then begin citldat:=5;ldat:=$28;ldat1:=$47; end; {focus near } if not(p1.3) then begin citldat:=5;ldat:=$28;ldat1:=$41; end; {focus auto } if not(p1.2) then begin citldat:=5;ldat:=$28;ldat1:=$49; end; {white toggle} if not(p3.7) then begin citldat:=5;ldat:=$28;ldat1:=$77; end; {white reset } IF LOK THEN BEGIN { obsluha Lcontrol } loknot:=0; lok:=false;lstatus:=ldat4; if citldat=0 then begin if kot>0 then begin dec(kot);citldat:=7;end; end else dec(citldat); if citldat<3 then begin { prazdny prikaz 3 cykly} ldat:=$18;ldat1:=$ff; end else begin {provedeni prikazu ve fronte} case kot of 0:begin ldat:=$18;ldat1:=ldat1f1;end; 1:begin ldat:=$18;ldat1:=ldat1f2;end; 2:begin ldat:=$18;ldat1:=ldat1f3;end; end; end; end; crt:=20; repeat dec(crt) until crt=0; {obsluha LED diod timer 100mikros} inc(nuld);if nuld=250 then begin {25ms} inc(loknot); if loknot>20 then stopt:=true; end; inc(anuld);if anuld=2500 then begin anuld:=0; {25ms} if (p35p and not(p3.5)) then rect:=true; p35p:=p3.5; end; until false; end.