(****************************************************************************) (* Das Microcontroller-Programmiergerät-Programm, Version 2.1 *) (* ---------------------------------------------------------------------- *) (* copyright (c) 1999 by Hubersoft Corp. All rights reserved. *) (****************************************************************************) uses crt; var flash:array[0..1999] of byte; flashsize: word; f: file; counter, result: word; dir: string; procedure wb(p,b:byte); begin port[$378]:=b; if p and 1<>0 then port[$37A]:=port[$37A] and not 2 else port[$37A]:=port[$37A] or 2; if p and 2<>0 then port[$37A]:=port[$37A] or 4 else port[$37A]:=port[$37A] and not 4; port[$37A]:=port[$37A] or 1; port[$37A]:=port[$37A] and not 1; end; procedure writechip(bytes: word); var count: word; begin wb(3, 128); {IO WR mode} wb(2, 128); {LED1 on} wb(1, 12); {erase config} wb(2, 130); delay(100); {DC/DC starten} write('--> Insert Chip and press button...'); while port[$379] and 64=0 do if keypressed then readkey; writeln(' OK'); writeln('Programming...'); wb(2, 70); delay(2); {12V+LED2 on} wb(1, 8); delay(20); {3.2 low} wb(1, 12); {3.2 high} wb(1,180); {write config} for count:=0 to bytes-1 do begin wb(0, flash[count]); {new data} wb(2, 78); {speaker on} wb(1,176); delay(1); {3.2 low} wb(1, 180); {3.2 high} wb(2, 70); delay(1); {speaker off} wb(2, 71); {clock high} wb(2, 70); {clock low} end; wb(2, 32); delay(300); {LED3 on} wb(2, 0); {LED3 off} end; begin writeln('The Hubersoft Flasher (v2.0) - copyright (c) 1999 by Hubersoft Corp.'); if paramstr(1)='' then begin writeln('Usage: flash [filename]'); halt; end; getdir(0, dir); if dir[0]>#3 then dir:=dir+'\'; assign(f,dir+paramstr(1)); {$I-} reset(f, 1); {$I+} if ioresult<>0 then begin writeln('File not found!'); halt; end; if filesize(f)>2000 then counter:=2000 else counter:=filesize(f); blockread(f,flash,counter,result); flashsize:=result; close(f); writeln('Got ', result, ' bytes of data from file.'); {-------------------} port[$37A]:=port[$37A] and not 1; {WR high} port[$37A]:=port[$37A] and not 8; delay(100); {Ger„t einschalten} if port[$379] and 64<>0 then begin writeln('Error: No flasher found on LPT1!'); port[$378]:=0; port[$37A]:=port[$37A] or 8; {Strom aus!} halt; end; writechip(flashsize); port[$378]:=0; port[$37A]:=port[$37A] or 8; {Ger„t ausschalten} writeln('Done.'); writeln; end.