Skip to content

Commit

Permalink
Поддержка 3 байта sreg
Browse files Browse the repository at this point in the history
  • Loading branch information
nofeletru committed Jan 22, 2017
1 parent d210617 commit 0e0044a
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 50 deletions.
2 changes: 1 addition & 1 deletion software/main.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ object MainForm: TMainForm
Font.Height = -12
HideSelection = False
Lines.Strings = (
'Программатор SPI, I2C, Microwire EEPROM v1.3.9'
'Программатор SPI, I2C, Microwire FLASH/EEPROM v1.3.10'
'http://forum.easyelectronics.ru/viewtopic.php?f=17&t=10947'
'tifa@nm.ru'
)
Expand Down
7 changes: 5 additions & 2 deletions software/main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ procedure WriteFlash25(var RomStream: TMemoryStream; StartAddress, WriteSize: ca
UsbAsp25_ReadSR(hUSBDev, sreg, $15);
if isBitSet(sreg, 0) then addr32bit4byte := true;
//Сбрасываем регистр адреса
UsbAsp25_WREN(hUSBDev);
sreg := 0;
UsbAsp25_WriteSR(hUSBDev, sreg, $c5);
end;
Expand Down Expand Up @@ -1884,7 +1885,7 @@ procedure TMainForm.MenuItemLockFlashClick(Sender: TObject);

procedure TMainForm.MenuItemReadSregClick(Sender: TObject);
var
sreg, sreg2: byte;
sreg, sreg2, sreg3: byte;
begin
try
ButtonCancel.Tag := 0;
Expand All @@ -1898,8 +1899,10 @@ procedure TMainForm.MenuItemReadSregClick(Sender: TObject);
begin
UsbAsp25_ReadSR(hUSBDev, sreg); //Читаем регистр
UsbAsp25_ReadSR(hUSBDev, sreg2, $35); //Второй байт
UsbAsp25_ReadSR(hUSBDev, sreg3, $15); //Третий байт
LogPrint('Sreg: '+IntToBin(sreg, 8)+'(0x'+(IntToHex(sreg, 2)+'), ')
+IntToBin(sreg2, 8)+'(0x'+(IntToHex(sreg2, 2)+')'));
+IntToBin(sreg2, 8)+'(0x'+(IntToHex(sreg2, 2)+'), ')
+IntToBin(sreg3, 8)+'(0x'+(IntToHex(sreg3, 2)+')'));
end;

if ComboSPICMD.ItemIndex = SPI_CMD_95 then
Expand Down
170 changes: 130 additions & 40 deletions software/sregedit.lfm
Original file line number Diff line number Diff line change
@@ -1,138 +1,138 @@
object sregeditForm: TsregeditForm
Left = 673
Height = 172
Left = 669
Height = 155
Top = 379
Width = 200
Align = alCustom
BorderStyle = bsToolWindow
Caption = 'SREG'
ClientHeight = 172
ClientHeight = 155
ClientWidth = 200
FormStyle = fsStayOnTop
Position = poOwnerFormCenter
LCLVersion = '1.4.4.0'
object CheckBoxSB7: TCheckBox
Left = 16
Left = 22
Height = 19
Top = 29
Top = 28
Width = 20
OnChange = CheckBoxChange
TabOrder = 0
end
object CheckBoxSB6: TCheckBox
Left = 32
Left = 38
Height = 19
Top = 29
Top = 28
Width = 20
OnChange = CheckBoxChange
TabOrder = 1
end
object CheckBoxSB5: TCheckBox
Left = 48
Left = 54
Height = 19
Top = 29
Top = 28
Width = 20
OnChange = CheckBoxChange
TabOrder = 2
end
object CheckBoxSB4: TCheckBox
Left = 64
Left = 70
Height = 19
Top = 29
Top = 28
Width = 20
OnChange = CheckBoxChange
TabOrder = 3
end
object CheckBoxSB3: TCheckBox
Left = 80
Left = 86
Height = 19
Top = 29
Top = 28
Width = 20
OnChange = CheckBoxChange
TabOrder = 4
end
object CheckBoxSB2: TCheckBox
Left = 96
Left = 102
Height = 19
Top = 29
Top = 28
Width = 20
OnChange = CheckBoxChange
TabOrder = 5
end
object CheckBoxSB1: TCheckBox
Left = 112
Left = 118
Height = 19
Top = 29
Top = 28
Width = 20
OnChange = CheckBoxChange
TabOrder = 6
end
object CheckBoxSB0: TCheckBox
Left = 128
Left = 134
Height = 19
Top = 29
Top = 28
Width = 20
OnChange = CheckBoxChange
TabOrder = 7
end
object CheckBoxSB15: TCheckBox
Left = 16
Left = 22
Height = 19
Top = 56
Width = 20
OnChange = CheckBoxChange
TabOrder = 8
end
object CheckBoxSB14: TCheckBox
Left = 32
Left = 38
Height = 19
Top = 56
Width = 20
OnChange = CheckBoxChange
TabOrder = 9
end
object CheckBoxSB13: TCheckBox
Left = 48
Left = 54
Height = 19
Top = 56
Width = 20
OnChange = CheckBoxChange
TabOrder = 10
end
object CheckBoxSB12: TCheckBox
Left = 64
Left = 70
Height = 19
Top = 56
Width = 20
OnChange = CheckBoxChange
TabOrder = 11
end
object CheckBoxSB11: TCheckBox
Left = 80
Left = 86
Height = 19
Top = 56
Width = 20
OnChange = CheckBoxChange
TabOrder = 12
end
object CheckBoxSB10: TCheckBox
Left = 96
Left = 102
Height = 19
Top = 56
Width = 20
OnChange = CheckBoxChange
TabOrder = 13
end
object CheckBoxSB9: TCheckBox
Left = 112
Left = 118
Height = 19
Top = 56
Width = 20
OnChange = CheckBoxChange
TabOrder = 14
end
object CheckBoxSB8: TCheckBox
Left = 128
Left = 134
Height = 19
Top = 56
Width = 20
Expand All @@ -142,7 +142,7 @@ object sregeditForm: TsregeditForm
object ButtonReadSreg: TButton
Left = 16
Height = 25
Top = 128
Top = 120
Width = 75
Caption = 'Прочитать'
OnClick = ButtonReadSregClick
Expand All @@ -151,24 +151,24 @@ object sregeditForm: TsregeditForm
object ButtonWriteSreg: TButton
Left = 104
Height = 25
Top = 128
Top = 120
Width = 75
Caption = 'Записать'
OnClick = ButtonWriteSregClick
TabOrder = 17
end
object EditSreg1: TEdit
Left = 160
Left = 166
Height = 23
Top = 25
Top = 24
Width = 24
MaxLength = 2
OnChange = EditSreg1Change
TabOrder = 18
Text = '00'
end
object EditSreg2: TEdit
Left = 160
Left = 166
Height = 23
Top = 52
Width = 24
Expand All @@ -178,35 +178,125 @@ object sregeditForm: TsregeditForm
Text = '00'
end
object Label1: TLabel
Left = 16
Left = 14
Height = 15
Top = 12
Top = 28
Width = 6
Caption = '7'
ParentColor = False
end
object Label2: TLabel
Left = 136
Left = 150
Height = 15
Top = 12
Top = 28
Width = 6
Caption = '0'
ParentColor = False
end
object Label3: TLabel
Left = 16
Left = 8
Height = 15
Top = 80
Top = 56
Width = 12
Caption = '15'
ParentColor = False
end
object Label4: TLabel
Left = 136
Left = 150
Height = 15
Top = 80
Top = 56
Width = 6
Caption = '8'
ParentColor = False
end
object CheckBoxSB23: TCheckBox
Left = 22
Height = 19
Top = 84
Width = 20
OnChange = CheckBoxChange
TabOrder = 20
end
object CheckBoxSB22: TCheckBox
Left = 38
Height = 19
Top = 84
Width = 20
OnChange = CheckBoxChange
TabOrder = 21
end
object CheckBoxSB21: TCheckBox
Left = 54
Height = 19
Top = 84
Width = 20
OnChange = CheckBoxChange
TabOrder = 22
end
object CheckBoxSB20: TCheckBox
Left = 70
Height = 19
Top = 84
Width = 20
OnChange = CheckBoxChange
TabOrder = 23
end
object CheckBoxSB19: TCheckBox
Left = 86
Height = 19
Top = 84
Width = 20
OnChange = CheckBoxChange
TabOrder = 24
end
object CheckBoxSB18: TCheckBox
Left = 102
Height = 19
Top = 84
Width = 20
OnChange = CheckBoxChange
TabOrder = 25
end
object CheckBoxSB17: TCheckBox
Left = 118
Height = 19
Top = 84
Width = 20
OnChange = CheckBoxChange
TabOrder = 26
end
object CheckBoxSB16: TCheckBox
Left = 136
Height = 19
Top = 84
Width = 20
OnChange = CheckBoxChange
TabOrder = 27
end
object Label5: TLabel
Left = 8
Height = 15
Top = 84
Width = 12
Caption = '23'
ParentColor = False
end
object Label6: TLabel
Left = 150
Height = 15
Top = 84
Width = 12
Caption = '16'
ParentColor = False
end
object EditSreg3: TEdit
Left = 166
Height = 23
Top = 80
Width = 24
MaxLength = 2
OnChange = EditSreg3Change
TabOrder = 28
Text = '00'
end
end
Loading

0 comments on commit 0e0044a

Please sign in to comment.