Program Mereni_napeti_s_obvodem_C520D; {$M 4096,0,0} uses au_crt, au_c520; var Napeti : string[5]; key : char; function NapToStr(i: integer): String; var s: String; begin Str(i, s); if Length(s) = 4 then s := ' ' +s[1]+s[2]+s[3]+s[4]; if Length(s) = 3 then s := ' '+s[1]+s[2]+s[3]; if Length(s) = 2 then s := ' ' + s; if Length(s) = 1 then s := ' ' + s; NapToStr := s; if i>1000 then begin NapToStr[2]:='-';NapToStr[3]:=' '; end; if i=1221 then NapToStr:=' >999'; end; procedure Mereni; begin AtClrScr; AtText('Mereni napeti ... konec Escape'); repeat If AtKeyPressed then begin {pokud byla stisknuta klavesa, tak ji sejmi} key := AtReadKey; If key = #0 then key := AtReadKey; end; Napeti := NapToStr(C520); {sejmi napeti z voltmetru a preved na text} AtGoToXY(10,2); AtText(Napeti+' mV '); until (key = #27); {zustan ve smycce dokud nebude stisknuto Escape} end; begin OutPortCW(146); {nastaveni portu A in, B in, C out} If not C520ready then begin {kontrola, jestli je C520 pripojen} AtClrScr; AtText('Voltmetr neni pripojen'); Halt(1); end; Mereni; end.