|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 17280 (0x4380) Types: TextFile Names: »KONTROL.PAS«
└─⟦042fc77f4⟧ Bits:30004107/disk4.imd SW1400 CCP/M 86 Distributionsdiskette 3.1 └─⟦this⟧ »KONTROL.PAS« └─⟦255a2b22f⟧ Bits:30004229/disk4.imd SW1400 CCP/M 86 Distributionsdiskette 3.1a └─⟦this⟧ »KONTROL.PAS«
Program controle_board; (*$I GSX*) CONST bdos_int = 224; c_rawio = 6; inp_stat = 255; xios_int = 40; Xnvm_read = 3; RemXY = @27@106; GoRem = @27@107; RevOn = @27@112; RevOff = @27@113; CurOn = @27@109; (* tændcursor *) CurOff = @27@110; (* slukcursor *) Marker = @27@112@32@27@113@27@68; (* RevOn,' ',RevOff,CurLe *) ant_switch_ind = 4; ant_switch_ud = 4; ant_meters = 5; PICCOLINE = 254; (* PICCOLINE => (6MHz -> FF) V (8MHz -> FE) *) Partner = 0; TYPE motor_step = 0..1000; VAR ind : ArrayÆ1..ant_switch_ind,1..8Å OF coor; relae : ArrayÆ1..ant_switch_ud,1..2Å OF coor; neadle : ArrayÆ1..ant_meters,1..2Å OF coor; motor : ArrayÆ0..2Å OF motor_step; direction : ArrayÆ0..2Å OF Integer; frame : ArrayÆ1..5Å OF coor; pot : ArrayÆ1..5Å OF coor; volt : ArrayÆ1..5Å OF Real; i, x, y, tast : Integer; step_type : Integer; sw_ind : Integer; sw_ud : Integer; step, slut : Boolean; s : Real; Regs : Record ax,bx,cx,dx,bp,si,di,ds,es,flags : Integer; End; FUNCTION get_type : Integer; BEGIN regs.ax:= Xnvm_read; swint(xios_int,regs); get_type:= memÆregs.es:regs.si+53Å; END; (* get_type *) FUNCTION key : Integer; VAR ch : Char; BEGIN if keypress then Begin read(kbd,ch); key:= ord(ch); End else key:= 0; END; (* key *) FUNCTION pwr(x,y: Integer):Integer; BEGIN pwr:= round(exp(y*ln(x))); END; (* pwr *) PROCEDURE slet_funk_keys; VAR i : Integer; BEGIN for i:= 1 to 42 do write(@27@58,chr(i),@0); (* her ligger den numeriske talblok *) for i:= 58 to 126 do write(@27@58,chr(i),@0); END; (* Slet_funk_keys *) PROCEDURE esc_test; VAR ch : Char; BEGIN gotoxy(43,16); write(@7,RemXY,RevOn,'Ønsker du at slutte (J/N) :',RevOff); Repeat ch:= chr(key); Until pos(ch,'jJnN'+@27)>0; if pos(ch,'jJ')>0 then slut:= TRUE; write(GoRem,'':27); END; (* esc_test *) PROCEDURE init_stats; BEGIN step_type:= 0; for i:= 0 to 2 do Begin motorÆiÅ:= 0; directionÆiÅ:= 0; End; sw_ind:= 15; sw_ud := 0; portÆ776Å:= sw_ud; for i:= 1 to 5 do voltÆiÅ:= 0; portÆ784Å:= round(voltÆ5Å); END; (* init_stats *) PROCEDURE init_meters; VAR v : 1..41; met : ArrayÆ1..40Å OF COOR; co, si : Real; r : Integer; PROCEDURE scale(x,y,r:Integer); VAR st : StringÆ2Å; co,si,i : Integer; BEGIN for i:= 0 to 10 do Begin charupvec(round(4050-(i*90)) mod 3600); str(i,st); co:= round(1.1*r*cos((43-3*i)*s))+x; si:= round(1.7*r*sin((43-3*i)*s))+y; gtext(co,si,st); End; charupvec(0); END; (* scale *) BEGIN (* init_meters *) s:= 2*PI/108; for i:= 1 to ant_meters do Begin CASE i OF 1 : Begin x:= 5000; y:= 22000; r:= 3300; End; 2 : Begin x:= 12000; y:= 22000; r:= 3300; End; 3 : Begin x:= 5000; y:= 13800; r:= 3300; End; 4 : Begin x:= 12000; y:= 13800; r:= 3300; End; 5 : Begin x:= 27000; y:= 22000; r:= 3300; End; End; (* CASE *) metÆ1Å.x:= x; metÆ1Å.y:= y; v:= 2; repeat co:= cos((v+7)*s); si:= sin((v+7)*s); metÆvÅ.x:= round(r*CO)+x; metÆvÅ.y:= round(1.5*r*SI)+y; metÆv+1Å.x:= round(0.9*r*co)+x; metÆv+1Å.y:= round(1.35*r*si)+y; metÆv+2Å.x:= metÆvÅ.x; metÆv+2Å.y:= metÆvÅ.y; v:= v+3; until v=41; metÆ40Å:= metÆ1Å; polyline(40,met); frameÆ1Å.x:= round(x+1.04*r); frameÆ1Å.y:= round(y-0.3*r); frameÆ2Å.x:= round(x+1.04*r); frameÆ2Å.y:= round(y+2.1*r); frameÆ3Å.x:= round(x-1.04*r); frameÆ3Å.y:= round(y+2.1*r); frameÆ4Å.x:= round(x-1.04*r); frameÆ4Å.y:= y-round(0.3*r); frameÆ5Å := frameÆ1Å; polyline(5,frame); scale(x,y,r); neadleÆi,1Å.x:= x; neadleÆi,1Å.y:= y+200; neadleÆi,2Å.x:= round(0.8*r*cos(43*s))+x; neadleÆi,2Å.y:= round(1.3*r*sin(43*s))+y; polyline(2,neadleÆiÅ); if i<>5 then gtext(x-r+400,y,chr(i+47)); End; (* FOR *) s:= 2*pi/1024; END; (* init_meters *) PROCEDURE init_switches; VAR ud : ArrayÆ1..ant_switch_ud,1..8Å OF coor; BEGIN for i:= 1 to ant_switch_ind do Begin case i of 1 : Begin x:= 5000; y:= 7000; End; 2 : Begin x:= 12000; y:= 7000; End; 3 : Begin x:= 5000; y:= 3900; End; 4 : Begin x:= 12000; y:= 3900; End; End; (* CASE *) indÆi,1Å.x:= x; indÆi,1Å.y:= y; indÆi,2Å.x:= x; indÆi,2Å.y:= y+1000; indÆi,3Å.x:= x-1000; indÆi,3Å.y:= y+1000; indÆi,4Å.x:= x-1000; indÆi,4Å.y:= y; indÆi,5Å.x:= x; indÆi,5Å.y:= y; indÆi,6Å.x:= x+1000; indÆi,6Å.y:= y; indÆi,7Å.x:= x+1000; indÆi,7Å.y:= y+1000; indÆi,8Å.x:= x; indÆi,8Å.y:= y+1000; polyline(8,indÆiÅ); polyfill(5,indÆiÅ); gtext(x-2400,y+100,'HØJ'); gtext(x+1200,y+100,'LAV'); gtext(x-100,y-1000,chr(i+47)); End; (* FOR *) for i:=1 to ant_switch_ud do Begin case i of 1 : Begin x:= 20000; y:= 7000; End; 2 : Begin x:= 27000; y:= 7000; End; 3 : Begin x:= 20000; y:= 3900; End; 4 : Begin x:= 27000; y:= 3900; End; End; (* CASE *) udÆi,1Å.x:= x-1000; udÆi,1Å.y:= y+500; udÆi,2Å.x:= x-1000; udÆi,2Å.y:= y+1000; udÆi,3Å.x:= x-400; udÆi,3Å.y:= y+500; udÆi,4Å.x:= x-1000; udÆi,4Å.y:= y; udÆi,5Å:= udÆi,1Å; udÆi,6Å.x:= x-2000; udÆi,6Å.y:= y+500; udÆi,7Å.x:= x-2000; udÆi,7Å.y:= y; polyline(7,udÆiÅ); udÆi,1Å.x:= x+1000; udÆi,1Å.y:= y+500; udÆi,2Å.x:= x+1000; udÆi,2Å.y:= y+1000; udÆi,3Å.x:= x+400; udÆi,3Å.y:= y+500; udÆi,4Å.x:= x+1000; udÆi,4Å.y:= y; udÆi,5Å:= udÆi,1Å; udÆi,6Å.x:= x+2000; udÆi,6Å.y:= y+500; udÆi,7Å.x:= x+2000; udÆi,7Å.y:= y; udÆi,8Å:= udÆi,6Å; polyfill(8,udÆiÅ); relaeÆi,1Å.x:= x; relaeÆi,1Å.y:= y-50; relaeÆi,2Å.x:= x+400; relaeÆi,2Å.y:= y+900; polyline(2,relaeÆiÅ); gtext(x-100,y-1000,chr(i+47)); End; (* for *) END; (* init_switches *) PROCEDURE init_pot_meter; VAR pkt : ArrayÆ1..31Å OF coor; st : StringÆ2Å; BEGIN pktÆ1Å.x:= 21000; pktÆ1Å.y:= 19000; i:= 2; repeat pktÆiÅ.x:= 21500; pktÆiÅ.y:= 19000+trunc(i/3)*1000; pktÆi+1Å.x:= 21500; pktÆi+1Å.y:= 19000+trunc(i/3+1)*1000; pktÆi+2Å.x:= 21000; pktÆi+2Å.y:= 19000+trunc(i/3+1)*1000; i:= i+3; until i>=30; polyline(31,pkt); pktÆ1Å.x:= 20000; pktÆ1Å.y:= 29000; pktÆ2Å.x:= 20000; pktÆ2Å.y:= 19000; polyline(2,pkt); potÆ1Å.x:= 19250; potÆ1Å.y:= 18872; potÆ2Å.x:= 19250; potÆ2Å.y:= 19000; potÆ3Å.x:= 20750; potÆ3Å.y:= 19000; potÆ4Å.x:= 20750; potÆ4Å.y:= 18872; potÆ5Å.x:= potÆ1Å.x+50; potÆ5Å.y:= potÆ1Å.y; writemode(3); polyline(5,pot); writemode(1); for i:= 0 to 10 do Begin str(i,st); gtext(22000,18700+i*1000,st); End; (* FOR *) END; (* init_pot_meter *) PROCEDURE pynt; BEGIN (* ramme om skærm *) frameÆ1Å.x:= 0; frameÆ1Å.y:= 32000; frameÆ2Å.x:= 32000; frameÆ2Å.y:= 32000; frameÆ3Å.x:= 32000; frameÆ3Å.y:= 0; frameÆ4Å.x:= 0; frameÆ4Å.y:= 0; frameÆ5Å:= frameÆ1Å; polyline(5,frame); frameÆ1Å.y:= 30500; frameÆ2Å.y:= 30500; polyline(2,frame); gtext(9600,30800,'PICCOLINE-ADAM KONTROL BORD'); (* ramme om digital ind *) frameÆ1Å.x:= 1000; frameÆ1Å.y:= 1000; frameÆ2Å.x:= 16000; frameÆ2Å.y:= 1000; frameÆ3Å.x:= 16000; frameÆ3Å.y:= 9000; frameÆ4Å.x:= 1000; frameÆ4Å.y:= 9000; frameÆ5Å:= frameÆ1Å; polyline(5,frame); frameÆ1Å.y:= 2200; frameÆ2Å.y:= 2200; polyline(2,frame); gtext(5500,1200,'DIGITAL MÅLING'); (* ramme om digital ud *) frameÆ1Å.x:= 17000; frameÆ1Å.y:= 1000; frameÆ2Å.x:= 31000; frameÆ2Å.y:= 1000; frameÆ3Å.x:= 31000; frameÆ3Å.y:= 9000; frameÆ4Å.x:= 17000; frameÆ4Å.y:= 9000; frameÆ5Å:= frameÆ1Å; polyline(5,frame); frameÆ1Å.y:= 2200; frameÆ2Å.y:= 2200; polyline(2,frame); gtext(20000,1200,'DIGITAL STYRING'); (* ramme om analog ind *) frameÆ1Å.x:= 1000; frameÆ1Å.y:= 11000; frameÆ2Å.x:= 16000; frameÆ2Å.y:= 11000; frameÆ3Å.x:= 16000; frameÆ3Å.y:= 30000; frameÆ4Å.x:= 1000; frameÆ4Å.y:= 30000; frameÆ5Å:= frameÆ1Å; polyline(5,frame); frameÆ1Å.y:= 12200; frameÆ2Å.y:= 12200; polyline(2,frame); gtext(5500,11200,'ANALOG MÅLING'); (* ramme om analog ud *) frameÆ1Å.x:= 17000; frameÆ1Å.y:= 30000; frameÆ2Å.x:= 17000; frameÆ2Å.y:= 16200; frameÆ3Å.x:= 24000; frameÆ3Å.y:= 16200; frameÆ4Å.x:= 24000; frameÆ4Å.y:= 20000; polyline(4,frame); (* - fortsat *) frameÆ2Å.x:= 31000; frameÆ2Å.y:= 30000; frameÆ3Å.x:= 31000; frameÆ3Å.y:= 20000; polyline(4,frame); frameÆ1Å.x:= 17000; frameÆ1Å.y:= 17500; frameÆ2Å.x:= 24000; frameÆ2Å.y:= 17500; polyline(2,frame); gtext(17400,16500,'ANALOG STYRING'); (* ramme om stepmotor styring *) frameÆ1Å.x:= 17000; frameÆ1Å.y:= 11000; frameÆ2Å.x:= 17000; frameÆ2Å.y:= 15500; frameÆ3Å.x:= 24300; frameÆ3Å.y:= 15500; frameÆ4Å.x:= 24300; frameÆ4Å.y:= 19500; polyline(4,frame); (* - fortsat *) frameÆ2Å.x:= 31000; frameÆ2Å.y:= 11000; frameÆ3Å.x:= 31000; frameÆ3Å.y:= 19500; polyline(4,frame); frameÆ1Å.x:= 17000; frameÆ1Å.y:= 14300; frameÆ2Å.x:= 24300; frameÆ2Å.y:= 14300; frameÆ3Å.x:= 24300; frameÆ3Å.y:= 15500; polyline(3,frame); gtext(17600,14500,'MOTOR STYRING'); gotoxy(60,11); write('MOTOR 0:'); gotoxy(60,13); write('MOTOR 1:'); gotoxy(60,15); write('MOTOR 2:'); (* skriv RC logoet i øverste højre hjørne *) frameÆ1Å.x:= 31400; frameÆ1Å.y:= 31600; frameÆ2Å.x:= 31000; frameÆ2Å.y:= 31600; frameÆ3Å.x:= 31000; frameÆ3Å.y:= 30800; polyline(3,frame); frameÆ1Å.x:= 31400; frameÆ1Å.y:= 31300; frameÆ2Å.x:= 31150; frameÆ2Å.y:= 31300; frameÆ3Å.x:= 31150; frameÆ3Å.y:= 30800; frameÆ4Å.x:= 31400; frameÆ4Å.y:= 30800; polyline(4,frame); END; (* pynt *) PROCEDURE init_motor; VAR nr, dummy, long : Integer; ch : Char; BEGIN step:= false; gotoxy(65,16); write(RevOn,'PAUSERER',RevOff); gotoxy(42,15); write(RemXY,'':17,GoRem,'MOTOR NR : ',Marker); repeat ch:= chr(key); until pos(ch,'012')>0; write(ch); nr:= ord(ch)-48; gotoxy(42,16); write(RemXY,'':17,GoRem,'HEL/HALV Step (0/1) ',Marker); repeat ch:= chr(key); until pos(ch,'01')>0; write(ch); gotoxy(42,16); if ch='1' then Begin step_type:= (step_type and 255) or pwr(2,nr+5); (* det drejer sig om bit 5,6 og 7 *) write('HEL/',RevOn,'HALV',RevOff); End else Begin step_type:= step_type and (255-pwr(2,nr+5)); write(RevOn,'HEL',RevOff); End; (* læs antal steps fra keyboard *) long:= 0; gotoxy(69,11+nr*2); write(RemXY,'':5,GoRem,Marker); repeat ch:= chr(key); until pos(ch,'+-0123456789'+@27)<>0; if ch<>@27 then Begin if ch='-' then Begin directionÆnrÅ:= 2; write(ch,Marker); End else Begin directionÆnrÅ:= 0; write('+',Marker); End; if pos(ch,'0123456789')>0 then Begin motorÆnrÅ:= ord(ch)-48; write(ch,Marker); long:= succ(long); End else motorÆnrÅ:= 0; repeat repeat ch:= chr(key); until (pos(ch,'0123456789')>0) or (ch=@13) or (ch=@27); if (ch<>@13) and (ch<>@27) then Begin motorÆnrÅ:= motorÆnrÅ*10+ord(ch)-48; write(ch,Marker); long:= succ(long); End; until (long=3) or (ch=@13) or (ch=@27); write(' '); if ch=@27 then motorÆnrÅ:= 0; End; (* if *) if motorÆnrÅ=0 then Begin gotoxy(69,11+nr*2); write('':5); end; gotoxy(42,15); write('':16); gotoxy(42,16); write('':33); step:= TRUE; END;(* init_motor *) PROCEDURE update_neadle(n,r:Integer;volt:Real); BEGIN x:= round(0.85*r*cos((384-(volt*256/10))*s))+neadleÆn,1Å.x; y:= round(1.1*r*sin((384-(volt*256/10))*s))+neadleÆn,1Å.y-200; polyline(2,neadleÆnÅ); neadleÆn,2Å.x:= x; neadleÆn,2Å.y:= y; polyline(2,neadleÆnÅ); END; (* update_neadle *) PROCEDURE update_pot_meter; VAR dy : Integer; BEGIN if (((tast=43) and (potÆ2Å.y<29000)) or ((tast=45) AND (potÆ2Å.y>19000))) then Begin polyline(5,pot); if tast=43 then dy:= +125 else dy:= -125; potÆ1Å.y:= potÆ1Å.y+dy; potÆ2Å.y:= potÆ2Å.y+dy; potÆ3Å.y:= potÆ3Å.y+dy; potÆ4Å.y:= potÆ4Å.y+dy; potÆ5Å.y:= potÆ1Å.y; polyline(5,pot); voltÆ5Å:= (potÆ2Å.y-19000)/1000; update_neadle(5,3300,voltÆ5Å); End; (* IF *) END; (* update_pot_meter *) PROCEDURE skift(nr : Integer); BEGIN polyline(2,relaeÆnrÅ); relaeÆnr,2Å.x:= relaeÆnr,1Å.x+(relaeÆnr,1Å.x-relaeÆnr,2Å.x); polyline(2,relaeÆnrÅ); END; (* skift *) PROCEDURE switch(VAR points); BEGIN polyfill(8,points); writemode(1); polyline(8,points); writemode(3); END; (* switch *) PROCEDURE set_output; VAR times : Integer; BEGIN times:= 0; repeat if (tast=43) or (tast=45) then Begin update_pot_meter; portÆ784Å:= round(voltÆ5Å/0.03937); End else Begin (* tast = 0,1,2,3 *) sw_ud:= sw_ud exor pwr(2,tast-48); portÆ776Å:= sw_ud; skift(tast-47); End; (* if *) times:= succ(times); if times<4 then tast:= key; until (times=4) or (NOT (chr(tast) IN Æ'+','-','0','1','2','3'Å)); END; (* set_output *) PROCEDURE read_input; VAR wait, digiind, nr, channel, test : Integer; BEGIN (* digi ind *) digiind:= portÆ770Å mod 256; test:= sw_ind exor digiind; for i:= 0 to 3 do if (test and pwr(2,i))=pwr(2,i) then switch(indÆi+1Å); sw_ind:= digiind; (* ana ind *) for channel:= 0 to 3 do Begin portÆ774Å:= channel+16+step_type; if step then Begin (* kør step motor *) step:= FALSE; for nr:= 0 to 2 do Begin gotoxy(70,11+nr*2); if motorÆnrÅ>0 then Begin motorÆnrÅ:= pred(motorÆnrÅ); write(motorÆnrÅ:3); portÆ768+nr*2Å:= directionÆnrÅ+1; if motorÆnrÅ>0 then step:= TRUE else Begin gotoxy(69,11+nr*2); write('':4); End; portÆ768+nr*2Å:= directionÆnrÅ; End;(* if *) End;(* for *) End else Begin wait:= 10; while wait>=0 do wait:= pred(wait); End; portÆ774Å:= channel+step_type; repeat until (portÆ768Å and 1)=1; voltÆchannel+1Å:= (portÆ784Å mod 256)*0.03937; portÆ774Å:= channel+16+step_type; update_neadle(channel+1,3300,voltÆchannel+1Å); End; (* for *) END; (* read_input *) BEGIN if get_type >= PICCOLINE then Begin slet_funk_keys; (* programering af cursor pilene *) write(@27@58@72@43@0); (* ▶92◀ := + *) write(@27@58@80@45@0); (* ▶93◀ := - *) write(@27@58@78@43@43@43@43@0); (* A3 := ++++ *) write(@27@58@79@45@45@45@45@0); (* A4 := ---- *) (* programering af motor tasterne *) write(@27@58@59,'M00',@0); (* F1 := M00 *) write(@27@58@60,'M01',@0); (* F2 := M01 *) write(@27@58@64,'M10',@0); (* F6 := M10 *) write(@27@58@65,'M11',@0); (* F7 := M11 *) write(@27@58@69,'M20',@0); (* F11:= M20 *) write(@27@58@70,'M21',@0); (* F12:= M21 *) (* programering af num retur til retur *) write(@27@58@76@13@0); (* num ▶90◀▶83◀ := ▶90◀▶83◀ *) openws(1); init_meters; init_switches; init_stats; init_pot_meter; pynt; writemode(3); slut := FALSE; repeat tast:= key; if (chr(tast) IN Æ'+','-','0','1','2','3'Å) then set_output; if (chr(tast) IN Æ'm','M'Å) then init_motor; read_input; if tast=27 then esc_test; until slut; æ tast=27; å (* ESC *) writemode(1); closews; End (* if *) else (* Partner *) writeln('Maskine IKKE PICCOLINE'); END.«eof»