Last change
on this file was 363, checked in by chronos, 12 years ago |
- Added: Package ISPProgrammer for in-system programming of various chips. Supports Dallas ISP protocol, Presto, Rabbit RFU and some others Atmel devices.
|
File size:
1.3 KB
|
Line | |
---|
1 | unit ISP_UserSign;
|
---|
2 |
|
---|
3 | {$MODE Delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | function ISPReadUserSign_MakeRequest(adres:integer; buf:pointer):integer;
|
---|
8 | function ISPReadUserSign(adres:integer):byte;
|
---|
9 | procedure ISPWriteUserSign(adres:integer; dana:byte);
|
---|
10 |
|
---|
11 | implementation
|
---|
12 |
|
---|
13 | uses Delays, Globals, Processors, SPI;
|
---|
14 |
|
---|
15 | function ISPReadUserSign_MakeRequest(adres:integer; buf:pointer):integer;
|
---|
16 | var data:array[0..3] of byte;
|
---|
17 | begin
|
---|
18 | Result := 0;
|
---|
19 | if proctype = PROC_TYPE_S2051 then
|
---|
20 | begin
|
---|
21 | // AT89S2051/4051 User Signature Bytes
|
---|
22 | data[0] := $22;
|
---|
23 | data[1] := Hi(word(adres));
|
---|
24 | data[2] := Lo(word(adres));
|
---|
25 | data[3] := 0;
|
---|
26 | Result := 4;
|
---|
27 | end;
|
---|
28 | Move (data, buf^, Result);
|
---|
29 | end;
|
---|
30 |
|
---|
31 | function ISPReadUserSign(adres:integer):byte;
|
---|
32 | var
|
---|
33 | data:array[0..3] of byte;
|
---|
34 | len:integer;
|
---|
35 | begin
|
---|
36 | Result:=$ff;
|
---|
37 | len:=ISPReadUserSign_MakeRequest(adres, @data);
|
---|
38 | if len > 0 then
|
---|
39 | begin
|
---|
40 | WriteBytes(@data, len - 1);
|
---|
41 | Result:=ReadByte;
|
---|
42 | end;
|
---|
43 | end;
|
---|
44 |
|
---|
45 | procedure ISPWriteUserSign(adres:integer; dana:byte);
|
---|
46 | var data:array[0..3] of byte;
|
---|
47 | begin
|
---|
48 | if proctype = PROC_TYPE_S2051 then
|
---|
49 | begin
|
---|
50 | // AT89S2051/4051 User Signature Bytes
|
---|
51 | data[0] := $42;
|
---|
52 | data[1] := Hi(word(adres));
|
---|
53 | data[2] := Lo(word(adres));
|
---|
54 | data[3] := dana;
|
---|
55 | WriteBytes(@data, 4);
|
---|
56 | Sync;
|
---|
57 | end;
|
---|
58 | WaitMS(Signatures[devicenr].prog_time);
|
---|
59 | end;
|
---|
60 |
|
---|
61 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.