Browse Source

Merge branch 'develop'

Willie 4 years ago
parent
commit
c698939adb
18 changed files with 548 additions and 4799 deletions
  1. 12 9
      Beispiele/SimpleServo.tps
  2. 7 0
      Beispiele/blink.tps
  3. 16 0
      Beispiele/examples.json
  4. 12 0
      Beispiele/servo.tps
  5. 0 9
      Beispiele/simple_blink.tps
  6. 4 4
      SPS_EMU.000
  7. 19 6
      SPS_EMU.001
  8. 17 5
      SPS_EMU.044
  9. 18 5
      SPS_EMU.049
  10. 21 7
      SPS_Emu.lpi
  11. BIN
      SPS_Emu.lsu
  12. 7 0
      blink.tps
  13. 13 0
      tone.tps
  14. 115 4711
      ugui.lfm
  15. 250 35
      ugui.pas
  16. 19 6
      uselectcom.lfm
  17. 1 0
      uselectcom.pas
  18. 17 2
      usps.pas

+ 12 - 9
Beispiele/SimpleServo.tps

@@ -1,9 +1,12 @@
-#TPS:Willies SPS Arduino
-0x00,1,F,""
-0x01,2,8,""
-0x02,1,0,""
-0x03,2,7,""
-0x04,3,4,""
-0x05,0,0,""
-0x06,0,0,""
-0x07,0,0,""
+#TPS:Willies SPS Arduino 
+0x00,4,4,"" 
+0x01,5,1,"" 
+0x02,4,F,"" 
+0x03,7,C,"" 
+0x04,F,8,"" 
+0x05,4,0,"" 
+0x06,F,8,"" 
+0x07,2,0,"" 
+0x08,3,6,"" 
+0x09,F,F,"" 
+0x0A,0,,"" 

+ 7 - 0
Beispiele/blink.tps

@@ -0,0 +1,7 @@
+#TPS:Willies SPS Arduino
+0x00,1,5,""
+0x01,2,8,""
+0x02,1,A,""
+0x03,2,8,""
+0x04,3,4,""
+0x05,0,0,""

+ 16 - 0
Beispiele/examples.json

@@ -0,0 +1,16 @@
+{
+	"examples": [{
+			"name": "Blink",
+			"index": 1,
+			"file": "blink.tps"
+		}, {
+			"name": "Servo",
+			"index": 2,
+			"file": "servo.tps"
+		}, {
+			"name": "Tone",
+			"index": 3,
+			"file": "tone.tps"
+		}
+	]
+}

+ 12 - 0
Beispiele/servo.tps

@@ -0,0 +1,12 @@
+#TPS:Willies SPS Arduino 
+0x00,4,4,"" 
+0x01,5,1,"" 
+0x02,4,F,"" 
+0x03,7,C,"" 
+0x04,F,8,"" 
+0x05,4,0,"" 
+0x06,F,8,"" 
+0x07,2,0,"" 
+0x08,3,6,"" 
+0x09,F,F,"" 
+0x0A,0,,"" 

+ 0 - 9
Beispiele/simple_blink.tps

@@ -1,9 +0,0 @@
-#TPS:Willies SPS Arduino
-0x00,4,0,""
-0x01,1,5,""
-0x02,2,8,""
-0x03,1,A,""
-0x04,2,8,""
-0x05,3,4,""
-0x06,0,0,""
-0x07,0,0,""

+ 4 - 4
SPS_EMU.000

@@ -2,9 +2,9 @@
 LSUTextFile=1
 LSUTextFile=1
 Copyrigth=MCS Media Computer Software
 Copyrigth=MCS Media Computer Software
 [LSUInfo]
 [LSUInfo]
-CompileDate=12.12.2018
-CompileTime=00:25:33
+CompileDate=30.12.2020
+CompileTime=18:00:02
 Name=Wilfried Klaas
 Name=Wilfried Klaas
-LSUBinFile=E:\daten\git-sourcen\SPS_Emulator\SPS_Emu.lsu
-LSUTextFile=E:\daten\git-sourcen\SPS_Emulator\SPS_Emu.
+LSUBinFile=E:\DATEN\Git-box\SPS_Emulator\SPS_Emu.lsu
+LSUTextFile=E:\DATEN\Git-box\SPS_Emulator\SPS_Emu.
 RegString=
 RegString=

+ 19 - 6
SPS_EMU.001

@@ -6,6 +6,7 @@ ID_EXIT=&Exit
 ID_NEW=&New
 ID_NEW=&New
 ID_OPEN=&Open
 ID_OPEN=&Open
 ID_SAVE=&Save
 ID_SAVE=&Save
+ID_SAVE_AS=S&ave as
 ID_NEWLINE=New &Line
 ID_NEWLINE=New &Line
 ID_DELLINE=Delete Line
 ID_DELLINE=Delete Line
 ID_PRGFILE=Prog. File
 ID_PRGFILE=Prog. File
@@ -26,6 +27,7 @@ ID_EXIT=Exit the program
 ID_NEW=Create a new file
 ID_NEW=Create a new file
 ID_OPEN=open a file
 ID_OPEN=open a file
 ID_SAVE=save the actual file
 ID_SAVE=save the actual file
+ID_SAVE_AS=save as
 ID_NEWLINE=Add a new line to the program
 ID_NEWLINE=Add a new line to the program
 ID_DELLINE=Delete the actual line
 ID_DELLINE=Delete the actual line
 ID_PRGFILE=Show the programming file
 ID_PRGFILE=Show the programming file
@@ -40,10 +42,11 @@ ID_RESETPRESETS=reset all presets
 ID_SAVEPRESETS=save presets to file
 ID_SAVEPRESETS=save presets to file
 ID_LOADPRESETS=load presets from file
 ID_LOADPRESETS=load presets from file
 ID_NEXT_INSERT=goto next row, add row if necessary
 ID_NEXT_INSERT=goto next row, add row if necessary
+ID_EXAMPLE=Load example from web
 
 
 [infobox]
 [infobox]
 ID_APPTITLE=TPS/PLC Emulator
 ID_APPTITLE=TPS/PLC Emulator
-ID_COPYRIGHT=MCS (C) 2018 Wilfried Klaas #13#10 EMail: w.klaas@gmx.de
+ID_COPYRIGHT=MCS (C) 2020 Wilfried Klaas #13#10 EMail: w.klaas@gmx.de
 
 
 [form1Captions]
 [form1Captions]
 ID_TPS_VERSION=PLC target: 
 ID_TPS_VERSION=PLC target: 
@@ -55,10 +58,10 @@ ID_OUTPUT_1=Output 1
 ID_OUTPUT_2=Output 2
 ID_OUTPUT_2=Output 2
 ID_OUTPUT_3=Output 3
 ID_OUTPUT_3=Output 3
 ID_OUTPUT_4=Output 4
 ID_OUTPUT_4=Output 4
-ID_INPUT_4=Input 4
-ID_INPUT_3=Input 3
-ID_INPUT_2=Input 2
-ID_INPUT_1=Input 1
+ID_INPUT_4=Input &4
+ID_INPUT_3=Input &3
+ID_INPUT_2=Input &2
+ID_INPUT_1=Input &1
 ID_REFRESH_ADDR=Refresh address
 ID_REFRESH_ADDR=Refresh address
 ID_MNEMONIC=Instruction
 ID_MNEMONIC=Instruction
 ID_MNE_DATA=Data
 ID_MNE_DATA=Data
@@ -72,6 +75,7 @@ ID_SAVE_TPS=File save as
 ID_SAVE_HEX=File save as
 ID_SAVE_HEX=File save as
 ID_OPEN=Open program
 ID_OPEN=Open program
 ID_SAVE=Save program
 ID_SAVE=Save program
+ID_SAVE_AS=Save program as
 ID_CLICK_HERE= or click here.
 ID_CLICK_HERE= or click here.
  
  
 [form1Hints]
 [form1Hints]
@@ -97,6 +101,11 @@ ID_GRID_MNEMONIC=Instruction
 ID_GRID_DATA=Data
 ID_GRID_DATA=Data
 ID_GRID_DESCRIPTION=Description
 ID_GRID_DESCRIPTION=Description
 ID_GRID_COMMENT=Notes / Comment
 ID_GRID_COMMENT=Notes / Comment
+ID_BTN_PRG_SEL=PRG selected
+ID_BTN_PRG_NON=PRG not selected
+ID_BTN_SEL_SEL=SEL selected
+ID_BTN_SEL_NON=SEL not selected
+
 
 
 [form2Captions]
 [form2Captions]
 ID_CAPTION=Program file
 ID_CAPTION=Program file
@@ -111,7 +120,7 @@ ID_CLOSE=&Close
 ID_CLOSE=Close window
 ID_CLOSE=Close window
 
 
 [form1Filter]
 [form1Filter]
-ID_SAVE_TPS=TPS/PLC files (*.tps)|*.tps|all files (*.*)|*.*
+ID_SAVE_TPS=TPS/SPS files (*.tps)|*.tps|all files (*.*)|*.*
 ID_SAVE_HEX=Intel Hex file (*.hex)|*.hex|all files (*.*)|*.*
 ID_SAVE_HEX=Intel Hex file (*.hex)|*.hex|all files (*.*)|*.*
 ID_OPEN=TPS/SPS file (*.tps)|*.tps|all files (*.*)|*.*
 ID_OPEN=TPS/SPS file (*.tps)|*.tps|all files (*.*)|*.*
 ID_SAVE=TPS/SPS file (*.tps)|*.tps|all files (*.*)|*.*
 ID_SAVE=TPS/SPS file (*.tps)|*.tps|all files (*.*)|*.*
@@ -162,12 +171,16 @@ ID_START_LINE=Addr   BD   Inst.    Data      Comment
 [MessagesMSG]
 [MessagesMSG]
 ID_MB_WARNINGT=Warning
 ID_MB_WARNINGT=Warning
 ID_MB_QUESTIONT=Question
 ID_MB_QUESTIONT=Question
+ID_MB_INFOT=Information
 SAVE_CHANGESM=The program has been changed. Do you want to save the changes?
 SAVE_CHANGESM=The program has been changed. Do you want to save the changes?
+ID_UPLOAD_OKM=Pogram uploaded.
+ID_NOT_READYM=Arduino not responding. Maybe not connected, SEL not pressed oder wrong firmware version^?
 
 
 [frmSelectComCaptions]
 [frmSelectComCaptions]
 ID_COMPORT=Port
 ID_COMPORT=Port
 ID_ARDUINO_INST=Arduino installation
 ID_ARDUINO_INST=Arduino installation
 ID_COMMENT=Please select the port of the arduino.
 ID_COMMENT=Please select the port of the arduino.
+ID_COMMAND_HINT=To upload, please hold the SEL button down until a message appears.
 
 
 [frmSelectComHints]
 [frmSelectComHints]
 ID_COMPORT=Com Port
 ID_COMPORT=Com Port

+ 17 - 5
SPS_EMU.044

@@ -6,6 +6,7 @@ ID_EXIT=&Exit
 ID_NEW=&New
 ID_NEW=&New
 ID_OPEN=&Open
 ID_OPEN=&Open
 ID_SAVE=&Save
 ID_SAVE=&Save
+ID_SAVE_AS=&Save as
 ID_NEWLINE=New &Line
 ID_NEWLINE=New &Line
 ID_DELLINE=Delete Line
 ID_DELLINE=Delete Line
 ID_PRGFILE=Prog. File
 ID_PRGFILE=Prog. File
@@ -26,6 +27,7 @@ ID_EXIT=Exit the program
 ID_NEW=Create a new file
 ID_NEW=Create a new file
 ID_OPEN=open a file
 ID_OPEN=open a file
 ID_SAVE=save the actual file
 ID_SAVE=save the actual file
+ID_SAVE_AS=save as
 ID_NEWLINE=Add a new line to the program
 ID_NEWLINE=Add a new line to the program
 ID_DELLINE=Delete the actual line
 ID_DELLINE=Delete the actual line
 ID_PRGFILE=Show the programming file
 ID_PRGFILE=Show the programming file
@@ -40,10 +42,11 @@ ID_RESETPRESETS=reset all presets
 ID_SAVEPRESETS=save presets to file
 ID_SAVEPRESETS=save presets to file
 ID_LOADPRESETS=load presets from file
 ID_LOADPRESETS=load presets from file
 ID_NEXT_INSERT=goto next row, add row if necessary
 ID_NEXT_INSERT=goto next row, add row if necessary
+ID_EXAMPLE=Load example from web
 
 
 [infobox]
 [infobox]
 ID_APPTITLE=TPS/PLC Emulator
 ID_APPTITLE=TPS/PLC Emulator
-ID_COPYRIGHT=MCS (C) 2018 Wilfried Klaas #13#10 EMail: w.klaas@gmx.de
+ID_COPYRIGHT=MCS (C) 2020 Wilfried Klaas #13#10 EMail: w.klaas@gmx.de
 
 
 [form1Captions]
 [form1Captions]
 ID_TPS_VERSION=PLC target: 
 ID_TPS_VERSION=PLC target: 
@@ -55,10 +58,10 @@ ID_OUTPUT_1=Output 1
 ID_OUTPUT_2=Output 2
 ID_OUTPUT_2=Output 2
 ID_OUTPUT_3=Output 3
 ID_OUTPUT_3=Output 3
 ID_OUTPUT_4=Output 4
 ID_OUTPUT_4=Output 4
-ID_INPUT_4=Input 4
-ID_INPUT_3=Input 3
-ID_INPUT_2=Input 2
-ID_INPUT_1=Input 1
+ID_INPUT_4=Input &4
+ID_INPUT_3=Input &3
+ID_INPUT_2=Input &2
+ID_INPUT_1=Input &1
 ID_REFRESH_ADDR=Refresh address
 ID_REFRESH_ADDR=Refresh address
 ID_MNEMONIC=Instruction
 ID_MNEMONIC=Instruction
 ID_MNE_DATA=Data
 ID_MNE_DATA=Data
@@ -72,6 +75,7 @@ ID_SAVE_TPS=File save as
 ID_SAVE_HEX=File save as
 ID_SAVE_HEX=File save as
 ID_OPEN=Open program
 ID_OPEN=Open program
 ID_SAVE=Save program
 ID_SAVE=Save program
+ID_SAVE_AS=Save program as
 ID_CLICK_HERE= or click here.
 ID_CLICK_HERE= or click here.
  
  
 [form1Hints]
 [form1Hints]
@@ -97,6 +101,10 @@ ID_GRID_MNEMONIC=Instruction
 ID_GRID_DATA=Data
 ID_GRID_DATA=Data
 ID_GRID_DESCRIPTION=Description
 ID_GRID_DESCRIPTION=Description
 ID_GRID_COMMENT=Notes / Comment
 ID_GRID_COMMENT=Notes / Comment
+ID_BTN_PRG_SEL=PRG selected
+ID_BTN_PRG_NON=PRG not selected
+ID_BTN_SEL_SEL=SEL selected
+ID_BTN_SEL_NON=SEL not selected
 
 
 [form2Captions]
 [form2Captions]
 ID_CAPTION=Program file
 ID_CAPTION=Program file
@@ -162,12 +170,16 @@ ID_START_LINE=Addr   BD   Inst.    Data      Comment
 [MessagesMSG]
 [MessagesMSG]
 ID_MB_WARNINGT=Warning
 ID_MB_WARNINGT=Warning
 ID_MB_QUESTIONT=Question
 ID_MB_QUESTIONT=Question
+ID_MB_INFOT=Information
 SAVE_CHANGESM=The program has been changed. Do you want to save the changes?
 SAVE_CHANGESM=The program has been changed. Do you want to save the changes?
+ID_UPLOAD_OKM=Pogram uploaded.
+ID_NOT_READYM=Arduino not responding. Maybe not connected, SEL not pressed oder wrong firmware version^?
 
 
 [frmSelectComCaptions]
 [frmSelectComCaptions]
 ID_COMPORT=Port
 ID_COMPORT=Port
 ID_ARDUINO_INST=Arduino installation
 ID_ARDUINO_INST=Arduino installation
 ID_COMMENT=Please select the port of the arduino.
 ID_COMMENT=Please select the port of the arduino.
+ID_COMMAND_HINT=To upload, please hold the SEL button down until a message appears.
 
 
 [frmSelectComHints]
 [frmSelectComHints]
 ID_COMPORT=Com Port
 ID_COMPORT=Com Port

+ 18 - 5
SPS_EMU.049

@@ -6,6 +6,7 @@ ID_EXIT=B&eenden
 ID_NEW=&Neu
 ID_NEW=&Neu
 ID_OPEN=Ö&ffnen
 ID_OPEN=Ö&ffnen
 ID_SAVE=&Speichern
 ID_SAVE=&Speichern
+ID_SAVE_AS=&Speichern als
 ID_NEWLINE=Neue &Zeile
 ID_NEWLINE=Neue &Zeile
 ID_DELLINE=Zeile löschen
 ID_DELLINE=Zeile löschen
 ID_PRGFILE=Programmierdatei
 ID_PRGFILE=Programmierdatei
@@ -26,6 +27,7 @@ ID_EXIT=Beenden
 ID_NEW=Neue Datei erzeugen
 ID_NEW=Neue Datei erzeugen
 ID_OPEN=Datei öffnen
 ID_OPEN=Datei öffnen
 ID_SAVE=Aktuelle Datei speichern
 ID_SAVE=Aktuelle Datei speichern
+ID_SAVE_AS=Datei speichern unter
 ID_NEWLINE=Neue Zeile hinzufügen
 ID_NEWLINE=Neue Zeile hinzufügen
 ID_DELLINE=Aktuelle Zeile löschen
 ID_DELLINE=Aktuelle Zeile löschen
 ID_PRGFILE=Programmierdatei anzeigen
 ID_PRGFILE=Programmierdatei anzeigen
@@ -40,10 +42,11 @@ ID_RESETPRESETS=Einstellungen zurücksetzen
 ID_LOADPRESETS=Presets aus Datei laden
 ID_LOADPRESETS=Presets aus Datei laden
 ID_SAVEPRESETS=Presets in Datei speichern
 ID_SAVEPRESETS=Presets in Datei speichern
 ID_NEXT_INSERT=nächste Zeile, wenn nötig, lege neue Zeile an
 ID_NEXT_INSERT=nächste Zeile, wenn nötig, lege neue Zeile an
+ID_EXAMPLE=Beispiele aus dem Internet laden
 
 
 [infobox]
 [infobox]
 ID_APPTITLE=TPS/SPS Emulator
 ID_APPTITLE=TPS/SPS Emulator
-ID_COPYRIGHT=MCS (C) 2018 Wilfried Klaas #13#10 EMail: w.klaas@gmx.de
+ID_COPYRIGHT=MCS (C) 2020 Wilfried Klaas #13#10 EMail: w.klaas@gmx.de
 
 
 [form1Captions]
 [form1Captions]
 ID_TPS_VERSION=TPS Zielsystem: 
 ID_TPS_VERSION=TPS Zielsystem: 
@@ -55,10 +58,10 @@ ID_OUTPUT_1=Ausgang 1
 ID_OUTPUT_2=Ausgang 2
 ID_OUTPUT_2=Ausgang 2
 ID_OUTPUT_3=Ausgang 3
 ID_OUTPUT_3=Ausgang 3
 ID_OUTPUT_4=Ausgang 4
 ID_OUTPUT_4=Ausgang 4
-ID_INPUT_4=Eingang 4
-ID_INPUT_3=Eingang 3
-ID_INPUT_2=Eingang 2
-ID_INPUT_1=Eingang 1
+ID_INPUT_4=Eingang &4
+ID_INPUT_3=Eingang &3
+ID_INPUT_2=Eingang &2
+ID_INPUT_1=Eingang &1
 ID_REFRESH_ADDR=Adresse aktualisieren
 ID_REFRESH_ADDR=Adresse aktualisieren
 ID_MNEMONIC=Befehle
 ID_MNEMONIC=Befehle
 ID_MNE_DATA=Daten
 ID_MNE_DATA=Daten
@@ -72,6 +75,7 @@ ID_SAVE_TPS=Datei sichern als
 ID_SAVE_HEX=Datei sichern als
 ID_SAVE_HEX=Datei sichern als
 ID_OPEN=Programm öffnen
 ID_OPEN=Programm öffnen
 ID_SAVE=Programm speichern
 ID_SAVE=Programm speichern
+ID_SAVE_AS=Programm speichern untern
 ID_CLICK_HERE= oder clicken sie hier.
 ID_CLICK_HERE= oder clicken sie hier.
  
  
 [form1Hints]
 [form1Hints]
@@ -97,6 +101,11 @@ ID_GRID_MNEMONIC=
 ID_GRID_DATA=
 ID_GRID_DATA=
 ID_GRID_DESCRIPTION=
 ID_GRID_DESCRIPTION=
 ID_GRID_COMMENT=
 ID_GRID_COMMENT=
+ID_BTN_PRG_SEL=PRG selektiert
+ID_BTN_PRG_NON=PRG nicht selektiert
+ID_BTN_SEL_SEL=SEL selektiert
+ID_BTN_SEL_NON=SEL nicht selektiert
+
 
 
 [form2Captions]
 [form2Captions]
 ID_CAPTION=Programmdatei
 ID_CAPTION=Programmdatei
@@ -162,12 +171,16 @@ ID_START_LINE=Addr   BD   Befehl   Daten     Kommentar
 [MessagesMSG]
 [MessagesMSG]
 ID_MB_WARNINGT=Warnung
 ID_MB_WARNINGT=Warnung
 ID_MB_QUESTIONT=Frage
 ID_MB_QUESTIONT=Frage
+ID_MB_INFOT=Information
 SAVE_CHANGESM=Die Datei wurde geändert. Wollen Sie die Änderungen speichern?
 SAVE_CHANGESM=Die Datei wurde geändert. Wollen Sie die Änderungen speichern?
+ID_UPLOAD_OKM=Pogramm übertragen.
+ID_NOT_READYM=Arduino antwortet nicht. Evtl. Arduino nicht angeschlossen, SEL nicht gedrückt oder falsche Firmware?
 
 
 [frmSelectComCaptions]
 [frmSelectComCaptions]
 ID_COMPORT=Schnittstelle
 ID_COMPORT=Schnittstelle
 ID_ARDUINO_INST=Arduinoinstallation
 ID_ARDUINO_INST=Arduinoinstallation
 ID_COMMENT=Bitte wählen Sie die Schnittstelle des Arduino.
 ID_COMMENT=Bitte wählen Sie die Schnittstelle des Arduino.
+ID_COMMAND_HINT=Zum Upload halten Sie bitte die SEL Taste gedrückt bis eine Meldung erscheint.
 
 
 [frmSelectComHints]
 [frmSelectComHints]
 ID_COMPORT=
 ID_COMPORT=

+ 21 - 7
SPS_Emu.lpi

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
 <CONFIG>
   <ProjectOptions>
   <ProjectOptions>
-    <Version Value="10"/>
+    <Version Value="11"/>
     <PathDelim Value="\"/>
     <PathDelim Value="\"/>
     <General>
     <General>
       <SessionStorage Value="InProjectDir"/>
       <SessionStorage Value="InProjectDir"/>
@@ -10,7 +10,8 @@
       <ResourceType Value="res"/>
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
       <UseXPManifest Value="True"/>
       <XPManifest>
       <XPManifest>
-        <DpiAware Value="True"/>
+        <DpiAware Value="Per-monitor"/>
+        <ExecutionLevel Value="highestAvailable"/>
       </XPManifest>
       </XPManifest>
       <Icon Value="0"/>
       <Icon Value="0"/>
     </General>
     </General>
@@ -22,7 +23,7 @@
       <AutoIncrementBuild Value="True"/>
       <AutoIncrementBuild Value="True"/>
       <MinorVersionNr Value="2"/>
       <MinorVersionNr Value="2"/>
       <RevisionNr Value="1"/>
       <RevisionNr Value="1"/>
-      <BuildNr Value="57"/>
+      <BuildNr Value="72"/>
       <Language Value="0407"/>
       <Language Value="0407"/>
       <StringTable CompanyName="MCS" FileDescription="TPS/SPS Emulator" InternalName="SPS_EMU" LegalCopyright="MCS (C) Wilfried Klaas" OriginalFilename="SPS_EMU.exe" ProductName="TPS/SPS Emulator" ProductVersion="0.2"/>
       <StringTable CompanyName="MCS" FileDescription="TPS/SPS Emulator" InternalName="SPS_EMU" LegalCopyright="MCS (C) Wilfried Klaas" OriginalFilename="SPS_EMU.exe" ProductName="TPS/SPS Emulator" ProductVersion="0.2"/>
     </VersionInfo>
     </VersionInfo>
@@ -32,12 +33,9 @@
     <PublishOptions>
     <PublishOptions>
       <Version Value="2"/>
       <Version Value="2"/>
       <DestinationDirectory Value="$(ProjPath)\published\"/>
       <DestinationDirectory Value="$(ProjPath)\published\"/>
-      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
-      <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
     </PublishOptions>
     </PublishOptions>
     <RunParams>
     <RunParams>
       <local>
       <local>
-        <FormatVersion Value="1"/>
         <CommandLineParams Value="beispiele/tone.tps"/>
         <CommandLineParams Value="beispiele/tone.tps"/>
       </local>
       </local>
       <environment>
       <environment>
@@ -45,6 +43,19 @@
           <Variable0 Name="lazarus_debuglog" Value="c:\temp\debug.txt"/>
           <Variable0 Name="lazarus_debuglog" Value="c:\temp\debug.txt"/>
         </UserOverrides>
         </UserOverrides>
       </environment>
       </environment>
+      <FormatVersion Value="2"/>
+      <Modes Count="1">
+        <Mode0 Name="default">
+          <local>
+            <CommandLineParams Value="beispiele/tone.tps"/>
+          </local>
+          <environment>
+            <UserOverrides Count="1">
+              <Variable0 Name="lazarus_debuglog" Value="c:\temp\debug.txt"/>
+            </UserOverrides>
+          </environment>
+        </Mode0>
+      </Modes>
     </RunParams>
     </RunParams>
     <RequiredPackages Count="2">
     <RequiredPackages Count="2">
       <Item1>
       <Item1>
@@ -136,7 +147,7 @@
     </Linking>
     </Linking>
   </CompilerOptions>
   </CompilerOptions>
   <Debugging>
   <Debugging>
-    <Exceptions Count="4">
+    <Exceptions Count="5">
       <Item1>
       <Item1>
         <Name Value="EAbort"/>
         <Name Value="EAbort"/>
       </Item1>
       </Item1>
@@ -149,6 +160,9 @@
       <Item4>
       <Item4>
         <Name Value="Exception"/>
         <Name Value="Exception"/>
       </Item4>
       </Item4>
+      <Item5>
+        <Name Value="EScannerError"/>
+      </Item5>
     </Exceptions>
     </Exceptions>
   </Debugging>
   </Debugging>
 </CONFIG>
 </CONFIG>

BIN
SPS_Emu.lsu


+ 7 - 0
blink.tps

@@ -0,0 +1,7 @@
+#TPS:Willies SPS Arduino
+0x00,1,5,""
+0x01,2,8,""
+0x02,1,A,""
+0x03,2,8,""
+0x04,3,4,""
+0x05,0,0,""

+ 13 - 0
tone.tps

@@ -0,0 +1,13 @@
+#TPS:Willies SPS Arduino
+0x00,4,4,""
+0x01,5,1,""
+0x02,4,F,""
+0x03,7,C,""
+0x04,F,8,""
+0x05,2,8,""
+0x06,4,0,""
+0x07,F,8,""
+0x08,2,8,""
+0x09,3,6,""
+0x0A,F,F,""
+0x0B,0,0,""

File diff suppressed because it is too large
+ 115 - 4711
ugui.lfm


+ 250 - 35
ugui.pas

@@ -9,7 +9,8 @@ interface
 uses
 uses
   Windows, Classes, SysUtils, FileUtil, SdpoSerial, Forms, Controls, Graphics, Dialogs,
   Windows, Classes, SysUtils, FileUtil, SdpoSerial, Forms, Controls, Graphics, Dialogs,
   Grids, ExtCtrls, Menus, ComCtrls, ActnList, StdActns, LCLProc, StdCtrls, Spin,
   Grids, ExtCtrls, Menus, ComCtrls, ActnList, StdActns, LCLProc, StdCtrls, Spin,
-  XMLPropStorage, uSPS, LCLType, Buttons, types, MCSWINAPI, Math, fpjson, jsonparser, Midi;
+  XMLPropStorage, uSPS, LCLType, Buttons, types, MCSWINAPI, Math,
+  fpjson, jsonparser, Midi;
 
 
 type
 type
 
 
@@ -29,10 +30,10 @@ type
     acHelpAbout: TAction;
     acHelpAbout: TAction;
     acHexFile: TAction;
     acHexFile: TAction;
     acNextInsert: TAction;
     acNextInsert: TAction;
+    acSaveAs: TAction;
     acUpload: TAction;
     acUpload: TAction;
     ActionList1: TActionList;
     ActionList1: TActionList;
     acFileOpen: TFileOpen;
     acFileOpen: TFileOpen;
-    acFileSaveAs: TFileSaveAs;
     btnTone: TBitBtn;
     btnTone: TBitBtn;
     cbTPSVersion: TComboBox;
     cbTPSVersion: TComboBox;
     cbAdrActual: TCheckBox;
     cbAdrActual: TCheckBox;
@@ -44,11 +45,14 @@ type
     acPresetSave: TFileSaveAs;
     acPresetSave: TFileSaveAs;
     GBControl: TGroupBox;
     GBControl: TGroupBox;
     ImageList2: TImageList;
     ImageList2: TImageList;
+    ImageList3: TImageList;
     Label3: TLabel;
     Label3: TLabel;
     Label4: TLabel;
     Label4: TLabel;
     Label5: TLabel;
     Label5: TLabel;
     lbStack: TListBox;
     lbStack: TListBox;
     MCSLabel: TLabel;
     MCSLabel: TLabel;
+    MenuItem1: TMenuItem;
+    pmExamples: TPopupMenu;
     RC1: TSpinEdit;
     RC1: TSpinEdit;
     RC2: TSpinEdit;
     RC2: TSpinEdit;
     cbCommand: TComboBox;
     cbCommand: TComboBox;
@@ -60,7 +64,6 @@ type
     GBOutput: TGroupBox;
     GBOutput: TGroupBox;
     GBInput: TGroupBox;
     GBInput: TGroupBox;
     GBInternal: TGroupBox;
     GBInternal: TGroupBox;
-    ImageList1: TImageList;
     Label1: TLabel;
     Label1: TLabel;
     Label10: TLabel;
     Label10: TLabel;
     Label11: TLabel;
     Label11: TLabel;
@@ -127,6 +130,8 @@ type
     tbPreset6: TToolButton;
     tbPreset6: TToolButton;
     tbPreset7: TToolButton;
     tbPreset7: TToolButton;
     tbPreset8: TToolButton;
     tbPreset8: TToolButton;
+    ToolButton20: TToolButton;
+    ToolButton21: TToolButton;
     ToolButton3: TToolButton;
     ToolButton3: TToolButton;
     ToolButton4: TToolButton;
     ToolButton4: TToolButton;
     ToolButton5: TToolButton;
     ToolButton5: TToolButton;
@@ -140,7 +145,6 @@ type
     procedure acDeleteRowExecute(Sender: TObject);
     procedure acDeleteRowExecute(Sender: TObject);
     procedure acExitExecute(Sender: TObject);
     procedure acExitExecute(Sender: TObject);
     procedure acFileOpenAccept(Sender: TObject);
     procedure acFileOpenAccept(Sender: TObject);
-    procedure acFileSaveAsAccept(Sender: TObject);
     procedure acDebugExecute(Sender: TObject);
     procedure acDebugExecute(Sender: TObject);
     procedure acHelpAboutExecute(Sender: TObject);
     procedure acHelpAboutExecute(Sender: TObject);
     procedure acHexFileExecute(Sender: TObject);
     procedure acHexFileExecute(Sender: TObject);
@@ -150,6 +154,7 @@ type
     procedure acNextStepExecute(Sender: TObject);
     procedure acNextStepExecute(Sender: TObject);
     procedure acPresetLoadAccept(Sender: TObject);
     procedure acPresetLoadAccept(Sender: TObject);
     procedure acPresetSaveAccept(Sender: TObject);
     procedure acPresetSaveAccept(Sender: TObject);
+    procedure acSaveAsExecute(Sender: TObject);
     procedure acShowHexFileExecute(Sender: TObject);
     procedure acShowHexFileExecute(Sender: TObject);
     procedure acStopExecute(Sender: TObject);
     procedure acStopExecute(Sender: TObject);
     procedure acThisStepExecute(Sender: TObject);
     procedure acThisStepExecute(Sender: TObject);
@@ -163,14 +168,19 @@ type
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
     procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
     procedure MCSLabelClick(Sender: TObject);
     procedure MCSLabelClick(Sender: TObject);
+    procedure MenuItem1Click(Sender: TObject);
     procedure mnSaveClick(Sender: TObject);
     procedure mnSaveClick(Sender: TObject);
+    procedure pmExamplesPopup(Sender: TObject);
     procedure Shape1Paint(Sender: TObject);
     procedure Shape1Paint(Sender: TObject);
     procedure Shape2Paint(Sender: TObject);
     procedure Shape2Paint(Sender: TObject);
     procedure StringGrid1EditingDone(Sender: TObject);
     procedure StringGrid1EditingDone(Sender: TObject);
     procedure StringGrid1Selection(Sender: TObject; aCol, aRow: integer);
     procedure StringGrid1Selection(Sender: TObject; aCol, aRow: integer);
     procedure tbPreset1Click(Sender: TObject);
     procedure tbPreset1Click(Sender: TObject);
-    procedure tbPreset1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: boolean);
+    procedure tbPreset1ContextPopup(Sender: TObject; MousePos: TPoint;
+      var Handled: boolean);
+    procedure tbPrgChange(Sender: TObject);
     procedure tbResetClick(Sender: TObject);
     procedure tbResetClick(Sender: TObject);
+    procedure tbSelChange(Sender: TObject);
     procedure Timer1Timer(Sender: TObject);
     procedure Timer1Timer(Sender: TObject);
   private
   private
     { private declarations }
     { private declarations }
@@ -179,8 +189,10 @@ type
     activeFile: string;
     activeFile: string;
     dirty: boolean;
     dirty: boolean;
     lastNote: byte;
     lastNote: byte;
+    Examples: TStringList;
     procedure initMidi;
     procedure initMidi;
     procedure playNote(note: byte);
     procedure playNote(note: byte);
+    procedure loadFromList(Lines: TStringList; filename: string);
     function readString(var line: string): boolean;
     function readString(var line: string): boolean;
     procedure saveSection(filename: string; key: string);
     procedure saveSection(filename: string; key: string);
     procedure loadSection(filename: string; key: string);
     procedure loadSection(filename: string; key: string);
@@ -214,7 +226,7 @@ var
 implementation
 implementation
 
 
 uses MCSAbout, uTextUi, uSelectCom, MCSTools, MCSStrings, synaser,
 uses MCSAbout, uTextUi, uSelectCom, MCSTools, MCSStrings, synaser,
-  MCSIO, mcsintelhex, MCSLSU, MCSIniFiles;
+  MCSIO, mcsintelhex, MCSLSU, MCSIniFiles, MCSWinHttp, luijsonutils;
 
 
 {$R *.lfm}
 {$R *.lfm}
 
 
@@ -238,11 +250,12 @@ begin
   Infobox.Build := MCSGetVersion(Application.ExeName);
   Infobox.Build := MCSGetVersion(Application.ExeName);
   Infobox.AppID := 31;
   Infobox.AppID := 31;
   Infobox.AppURL :=
   Infobox.AppURL :=
-    'http://www.wk-music.de/pages/mcs/microcontroller/tps-sps-emulator.php';
+    'http://www.wk-music.de/willie/pages/mcs/microcontroller/tps-sps-emulator.php';
   sps := TSPS.Create();
   sps := TSPS.Create();
   sps.setDelayCallback(@delayCallback);
   sps.setDelayCallback(@delayCallback);
   addHeaderText;
   addHeaderText;
   renumberGrid();
   renumberGrid();
+  cbTPSVersion.ItemIndex := 0;
   cbTPSVersionChange(Sender);
   cbTPSVersionChange(Sender);
   acStop.Enabled := False;
   acStop.Enabled := False;
   ToolButton18.Align := alRight;
   ToolButton18.Align := alRight;
@@ -259,6 +272,7 @@ begin
   Timer1.Enabled := True;
   Timer1.Enabled := True;
   MCSLSU.MakeForm('form1', 'ID_', form1);
   MCSLSU.MakeForm('form1', 'ID_', form1);
   initMidi;
   initMidi;
+  Examples := TStringList.Create;
 end;
 end;
 
 
 procedure TForm1.initMidi;
 procedure TForm1.initMidi;
@@ -290,6 +304,55 @@ begin
   lastNote := note;
   lastNote := note;
 end;
 end;
 
 
+procedure TForm1.loadFromList(Lines: TStringList; filename: string);
+var
+  i, x: integer;
+  line: string;
+  list: TStringList;
+begin
+  acNew.Execute;
+  list := TStringList.Create;
+  i := 1;
+  for x := 0 to Lines.Count - 1 do
+  begin
+    if (i + 1 > StringGrid1.RowCount) then
+    begin
+      StringGrid1.RowCount := StringGrid1.RowCount + 1;
+    end;
+    line := Lines[x];
+    if (Pos('#', line) = 1) then
+    begin
+      line := RightstrPos(line, 2);
+      if (Pos('TPS:', line) = 1) then
+      begin
+        line := RightstrPos(line, 5);
+        cbTPSVersion.Text := line;
+        cbTPSVersionChange(nil);
+      end;
+    end
+    else
+    begin
+      MCSStrings.DelimSepTextToStringlist(line, '"', ',', list);
+      if list.Count > 0 then
+        Stringgrid1.Cells[0, i] := list[0];
+      if list.Count > 1 then
+        Stringgrid1.Cells[1, i] := list[1];
+      if list.Count > 2 then
+        Stringgrid1.Cells[2, i] := list[2];
+      if list.Count > 3 then
+        Stringgrid1.Cells[4, i] := list[3];
+      list.Clear;
+      Inc(i);
+    end;
+  end;
+  list.Free;
+  activeFile := filename;
+  renumberGrid();
+  addHeaderText;
+  setCaption();
+  setDirty(False);
+end;
+
 procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of string);
 procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of string);
 var
 var
   line: string;
   line: string;
@@ -306,11 +369,105 @@ begin
   ShExec2(self.Handle, InfoBox.AppURL);
   ShExec2(self.Handle, InfoBox.AppURL);
 end;
 end;
 
 
+procedure TForm1.MenuItem1Click(Sender: TObject);
+var
+  i: integer;
+  fileName, Data: string;
+  Lines: TStringList;
+begin
+  if (Sender is TMenuItem) then
+  begin
+    if (checkDirty()) then
+    begin
+      i := TMenuItem(Sender).Tag;
+      if (i >= 0) then
+      begin
+        filename := examples[i];
+        Data := DownloadFile('http://wkla.no-ip.biz/down/tps_examples/' + filename);
+        Lines := TStringList.Create;
+        Lines.Text := Data;
+        loadFromList(Lines, filename);
+        Lines.Free;
+      end;
+    end;
+  end;
+end;
+
 procedure TForm1.mnSaveClick(Sender: TObject);
 procedure TForm1.mnSaveClick(Sender: TObject);
 begin
 begin
   Statusbar1.SimpleText := Sender.ClassName;
   Statusbar1.SimpleText := Sender.ClassName;
 end;
 end;
 
 
+procedure TForm1.pmExamplesPopup(Sender: TObject);
+var
+  x, i, j, pos, index: integer;
+  myName: string;
+  myMenu, my2Menu: TMenuItem;
+  jsonString: string;
+  JsonObject: TJsonObject;
+  Data, JArray: TJSONData;
+  JItem: TJSONData;
+  subMenuName: string;
+  subMenu: TMenuItem;
+begin
+  for i := pmExamples.Items.Count - 1 downto 0 do
+  begin
+    myMenu := pmExamples.Items[i];
+    if (myMenu.Count > 0) then
+    begin
+      for j := myMenu.Count - 1 downto 0 do
+      begin
+        my2Menu := myMenu.Items[j];
+        my2Menu.Free;
+      end;
+      myMenu.Clear;
+    end;
+    myMenu.Free;
+  end;
+  pmExamples.Items.Clear;
+  Examples.Clear;
+
+  try
+    jsonString := DownloadFile('http://wkla.no-ip.biz/down/tps_examples/examples.json');
+    Data := StringToJSONData(jsonString);
+    JsonObject := TJSONObject(Data);
+
+    i := JsonObject.Count;
+    for x := 0 to JsonObject.Count - 1 do
+    begin
+      subMenuName := JsonObject.Names[x];
+      JArray := GetJSONProp(TJSONObject(Data), subMenuName);
+      if (JArray <> nil) then
+      begin
+        subMenu := TMenuItem.Create(pmExamples);
+        subMenu.Caption := subMenuName;
+        pmExamples.Items.Add(subMenu);
+        for i := 1 to TJSONArray(JArray).Count do
+        begin
+          JItem := TJSONArray(JArray).Items[i - 1];
+          myName := GetJsonProp(TJSONObject(JItem), 'name', '');
+          pos := -1;
+          index := GetJsonProp(TJSONObject(JItem), 'index', -1);
+          if (index > -1) then
+          begin
+            pos := Examples.Add(GetJsonProp(TJSONObject(JItem), 'file', ''));
+            myName := format('%.2d - %s', [index, myName]);
+          end;
+          myMenu := TMenuItem.Create(subMenu);
+          myMenu.Caption := myName;
+          myMenu.Tag := pos;
+          if (index > -1) then
+          begin
+            myMenu.OnClick := @MenuItem1Click;
+          end;
+          subMenu.Add(myMenu);
+        end;
+      end;
+    end;
+  except
+  end;
+end;
+
 procedure TForm1.Shape1Paint(Sender: TObject);
 procedure TForm1.Shape1Paint(Sender: TObject);
 var
 var
   radius: integer;
   radius: integer;
@@ -419,12 +576,15 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TForm1.acFileSaveAsAccept(Sender: TObject);
+procedure TForm1.acSaveAsExecute(Sender: TObject);
 var
 var
   filename: string;
   filename: string;
 begin
 begin
-  filename := (Sender as TFileSaveAs).Dialog.FileName;
-  saveFile(filename);
+  if SaveDialog1.Execute() then
+  begin
+    filename := SaveDialog1.FileName;
+    saveFile(filename);
+  end;
 end;
 end;
 
 
 procedure TForm1.saveFile(filename: string);
 procedure TForm1.saveFile(filename: string);
@@ -451,8 +611,8 @@ begin
     begin
     begin
       if (StringGrid1.Cells[1, x] <> '') then
       if (StringGrid1.Cells[1, x] <> '') then
       begin
       begin
-        line := StringGrid1.Cells[0, x] + ',' + StringGrid1.Cells[1, x] + ',' +
-          StringGrid1.Cells[2, x] + ',"' + StringGrid1.Cells[4, x] + '"';
+        line := StringGrid1.Cells[0, x] + ',' + StringGrid1.Cells[1, x] +
+          ',' + StringGrid1.Cells[2, x] + ',"' + StringGrid1.Cells[4, x] + '"';
         Writeln(f, line);
         Writeln(f, line);
       end;
       end;
     end;
     end;
@@ -473,7 +633,7 @@ begin
   begin
   begin
     activateSps(True);
     activateSps(True);
     acDebug.Enabled := True;
     acDebug.Enabled := True;
-    acDebug.ImageIndex := 10;
+    acDebug.ImageIndex := 57;
     cbAdrActual.Enabled := True;
     cbAdrActual.Enabled := True;
     acNextStep.Enabled := False;
     acNextStep.Enabled := False;
     // sps programmieren
     // sps programmieren
@@ -720,7 +880,8 @@ begin
         tmp := tmp + '0';
         tmp := tmp + '0';
       line := line + tmp;
       line := line + tmp;
 
 
-      line := line + '      ' + StringGrid1.Cells[3, x] + '   ,"' + StringGrid1.Cells[4, x] + '"';
+      line := line + '      ' + StringGrid1.Cells[3, x] + '   ,"' +
+        StringGrid1.Cells[4, x] + '"';
       list.add(line);
       list.add(line);
     end;
     end;
   end;
   end;
@@ -736,7 +897,7 @@ begin
   begin
   begin
     stopit := True;
     stopit := True;
     sps.break();
     sps.break();
-    acDebug.ImageIndex := 18;
+    acDebug.ImageIndex := 40;
     //   repeat
     //   repeat
     //     Application.ProcessMessages;
     //     Application.ProcessMessages;
     //   until (not sps.isDelayActive());
     //   until (not sps.isDelayActive());
@@ -785,6 +946,7 @@ end;
 procedure TForm1.btnToneClick(Sender: TObject);
 procedure TForm1.btnToneClick(Sender: TObject);
 begin
 begin
   MidiOutput.SendAllSoundOff(0, 0);
   MidiOutput.SendAllSoundOff(0, 0);
+  ImageList2.GetBitmap(22, btnTone.Glyph);
 end;
 end;
 
 
 function TForm1.serialUpload: string;
 function TForm1.serialUpload: string;
@@ -873,9 +1035,10 @@ begin
 
 
       if (error) then
       if (error) then
       begin
       begin
-        Application.MessageBox('Arduino antwortet nicht. Evtl. Arduino nicht angeschlossen oder falsche Firmware?',
-          'Keine Antwort',
-          MB_OK + MB_ICONEXCLAMATION);
+        LSUAutoMsgBox('Messages', 'ID_NOT_READY', MB_OK + MB_ICONERROR);
+      end else
+      begin
+        LSUAutoMsgBox('Messages', 'ID_UPLOAD_OK', MB_OK + MB_ICONINFORMATION);
       end;
       end;
       SdpoSerial1.Active := False;
       SdpoSerial1.Active := False;
       DeleteFile(hexFile);
       DeleteFile(hexFile);
@@ -929,7 +1092,8 @@ var
 begin
 begin
   if (dirty) then
   if (dirty) then
   begin
   begin
-    i := MCSLSU.LSUAutoMsgBox('Messages', 'SAVE_CHANGES', MB_ICONQUESTION or MB_YESNOCANCEL);
+    i := MCSLSU.LSUAutoMsgBox('Messages', 'SAVE_CHANGES', MB_ICONQUESTION or
+      MB_YESNOCANCEL);
     if (i = mrYes) then
     if (i = mrYes) then
     begin
     begin
       saveFile(activeFile);
       saveFile(activeFile);
@@ -1029,7 +1193,8 @@ begin
   end
   end
   else
   else
   begin
   begin
-    Caption := MCSLSU.GetLSUText('form1Captions', 'ID_CAPTION', lsuCode) + ':' + ExtractFileName(activeFile);
+    Caption := MCSLSU.GetLSUText('form1Captions', 'ID_CAPTION', lsuCode) +
+      ':' + ExtractFileName(activeFile);
   end;
   end;
 
 
 end;
 end;
@@ -1044,7 +1209,8 @@ begin
     StringGrid1.Columns[i].Title.Caption :=
     StringGrid1.Columns[i].Title.Caption :=
       MCSLSU.GetLSUText('form1Captions', StringGrid1.Columns[i].Title.Caption, lsuCode);
       MCSLSU.GetLSUText('form1Captions', StringGrid1.Columns[i].Title.Caption, lsuCode);
   end;
   end;
-  StringGrid1.Cells[0, 0] := MCSLSU.GetLSUText('form1Captions', 'ID_GRID_STORAGE', lsuCode);
+  StringGrid1.Cells[0, 0] := MCSLSU.GetLSUText('form1Captions',
+    'ID_GRID_STORAGE', lsuCode);
   StringGrid1.Repaint;
   StringGrid1.Repaint;
 end;
 end;
 
 
@@ -1096,6 +1262,10 @@ begin
     acUpload.Enabled := False;
     acUpload.Enabled := False;
     Label5.Visible := False;
     Label5.Visible := False;
     btnTone.Visible := False;
     btnTone.Visible := False;
+    ADC1.Value := 0;
+    ADC1.MaxValue := 15;
+    ADC2.Value := 0;
+    ADC2.MaxValue := 15;
   end;
   end;
   if (cbTPSVersion.ItemIndex = 1) then
   if (cbTPSVersion.ItemIndex = 1) then
   begin
   begin
@@ -1118,6 +1288,10 @@ begin
     acUpload.Enabled := False;
     acUpload.Enabled := False;
     Label5.Visible := False;
     Label5.Visible := False;
     btnTone.Visible := False;
     btnTone.Visible := False;
+    ADC1.Value := 0;
+    ADC1.MaxValue := 15;
+    ADC2.Value := 0;
+    ADC2.MaxValue := 15;
   end;
   end;
   if ((cbTPSVersion.ItemIndex = 2) or (cbTPSVersion.ItemIndex = 3)) then
   if ((cbTPSVersion.ItemIndex = 2) or (cbTPSVersion.ItemIndex = 3)) then
   begin
   begin
@@ -1152,6 +1326,10 @@ begin
 
 
     EditE.Visible := True;
     EditE.Visible := True;
     EditF.Visible := True;
     EditF.Visible := True;
+    ADC1.Value := 0;
+    ADC1.MaxValue := 255;
+    ADC2.Value := 0;
+    ADC2.MaxValue := 255;
   end;
   end;
   cbCommand.Items.Clear;
   cbCommand.Items.Clear;
   sps.getCommands(cbCommand.Items);
   sps.getCommands(cbCommand.Items);
@@ -1184,7 +1362,8 @@ begin
   begin
   begin
     x := StringGrid1.Row;
     x := StringGrid1.Row;
     StringGrid1.Cells[3, x] :=
     StringGrid1.Cells[3, x] :=
-      sps.getCommandText(HexToInt(StringGrid1.Cells[1, x]), HexToInt(StringGrid1.Cells[2, x]));
+      sps.getCommandText(HexToInt(StringGrid1.Cells[1, x]),
+      HexToInt(StringGrid1.Cells[2, x]));
     setDirty(True);
     setDirty(True);
   end;
   end;
 end;
 end;
@@ -1237,10 +1416,14 @@ begin
   WriteIniBool(key, 'set', XMLPropStorage1.ReadBoolean(key + '.set', False), filename);
   WriteIniBool(key, 'set', XMLPropStorage1.ReadBoolean(key + '.set', False), filename);
   WriteIniBool(key, 'prg', XMLPropStorage1.ReadBoolean(key + '.prg', False), filename);
   WriteIniBool(key, 'prg', XMLPropStorage1.ReadBoolean(key + '.prg', False), filename);
   WriteIniBool(key, 'sel', XMLPropStorage1.ReadBoolean(key + '.sel', False), filename);
   WriteIniBool(key, 'sel', XMLPropStorage1.ReadBoolean(key + '.sel', False), filename);
-  WriteIniBool(key, 'input1', XMLPropStorage1.ReadBoolean(key + '.input1', False), filename);
-  WriteIniBool(key, 'input2', XMLPropStorage1.ReadBoolean(key + '.input2', False), filename);
-  WriteIniBool(key, 'input3', XMLPropStorage1.ReadBoolean(key + '.input3', False), filename);
-  WriteIniBool(key, 'input4', XMLPropStorage1.ReadBoolean(key + '.input4', False), filename);
+  WriteIniBool(key, 'input1', XMLPropStorage1.ReadBoolean(key + '.input1', False),
+    filename);
+  WriteIniBool(key, 'input2', XMLPropStorage1.ReadBoolean(key + '.input2', False),
+    filename);
+  WriteIniBool(key, 'input3', XMLPropStorage1.ReadBoolean(key + '.input3', False),
+    filename);
+  WriteIniBool(key, 'input4', XMLPropStorage1.ReadBoolean(key + '.input4', False),
+    filename);
   WriteIniInteger(key, 'adc1', XMLPropStorage1.ReadInteger(key + '.adc1', 0), filename);
   WriteIniInteger(key, 'adc1', XMLPropStorage1.ReadInteger(key + '.adc1', 0), filename);
   WriteIniInteger(key, 'adc2', XMLPropStorage1.ReadInteger(key + '.adc2', 0), filename);
   WriteIniInteger(key, 'adc2', XMLPropStorage1.ReadInteger(key + '.adc2', 0), filename);
   WriteIniInteger(key, 'rc1', XMLPropStorage1.ReadInteger(key + '.rc1', 0), filename);
   WriteIniInteger(key, 'rc1', XMLPropStorage1.ReadInteger(key + '.rc1', 0), filename);
@@ -1252,10 +1435,14 @@ begin
   XMLPropStorage1.WriteBoolean(key + '.set', ReadIniBool(key, 'set', False, filename));
   XMLPropStorage1.WriteBoolean(key + '.set', ReadIniBool(key, 'set', False, filename));
   XMLPropStorage1.WriteBoolean(key + '.prg', ReadIniBool(key, 'prg', False, filename));
   XMLPropStorage1.WriteBoolean(key + '.prg', ReadIniBool(key, 'prg', False, filename));
   XMLPropStorage1.WriteBoolean(key + '.sel', ReadIniBool(key, 'sel', False, filename));
   XMLPropStorage1.WriteBoolean(key + '.sel', ReadIniBool(key, 'sel', False, filename));
-  XMLPropStorage1.WriteBoolean(key + '.input1', ReadIniBool(key, 'input1', False, filename));
-  XMLPropStorage1.WriteBoolean(key + '.input2', ReadIniBool(key, 'input2', False, filename));
-  XMLPropStorage1.WriteBoolean(key + '.input3', ReadIniBool(key, 'input3', False, filename));
-  XMLPropStorage1.WriteBoolean(key + '.input4', ReadIniBool(key, 'input4', False, filename));
+  XMLPropStorage1.WriteBoolean(key + '.input1', ReadIniBool(key,
+    'input1', False, filename));
+  XMLPropStorage1.WriteBoolean(key + '.input2', ReadIniBool(key,
+    'input2', False, filename));
+  XMLPropStorage1.WriteBoolean(key + '.input3', ReadIniBool(key,
+    'input3', False, filename));
+  XMLPropStorage1.WriteBoolean(key + '.input4', ReadIniBool(key,
+    'input4', False, filename));
   XMLPropStorage1.WriteInteger(key + '.adc1', ReadIniInteger(key, 'adc1', 0, filename));
   XMLPropStorage1.WriteInteger(key + '.adc1', ReadIniInteger(key, 'adc1', 0, filename));
   XMLPropStorage1.WriteInteger(key + '.adc2', ReadIniInteger(key, 'adc2', 0, filename));
   XMLPropStorage1.WriteInteger(key + '.adc2', ReadIniInteger(key, 'adc2', 0, filename));
   XMLPropStorage1.WriteInteger(key + '.rc1', ReadIniInteger(key, 'rc1', 0, filename));
   XMLPropStorage1.WriteInteger(key + '.rc1', ReadIniInteger(key, 'rc1', 0, filename));
@@ -1302,7 +1489,8 @@ begin
   RC2.Value := XMLPropStorage1.ReadInteger(key + '.rc2', RC2.Value);
   RC2.Value := XMLPropStorage1.ReadInteger(key + '.rc2', RC2.Value);
 end;
 end;
 
 
-procedure TForm1.tbPreset1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: boolean);
+procedure TForm1.tbPreset1ContextPopup(Sender: TObject; MousePos: TPoint;
+  var Handled: boolean);
 var
 var
   key: string;
   key: string;
 begin
 begin
@@ -1344,10 +1532,24 @@ begin
   checkPresets();
   checkPresets();
 end;
 end;
 
 
+procedure TForm1.tbPrgChange(Sender: TObject);
+begin
+  if tbPrg.Checked then
+  begin
+    tbPrg.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_PRG_SEL', lsuCode);
+  end
+  else
+  begin
+    tbPrg.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_PRG_NON', lsuCode);
+  end;
+end;
+
 procedure TForm1.tbResetClick(Sender: TObject);
 procedure TForm1.tbResetClick(Sender: TObject);
 begin
 begin
   tbPrg.Checked := False;
   tbPrg.Checked := False;
+  tbPrg.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_PRG_NON', lsuCode);
   tbSel.Checked := False;
   tbSel.Checked := False;
+  tbSel.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_SEL_NON', lsuCode);
   Din1.Checked := False;
   Din1.Checked := False;
   Din2.Checked := False;
   Din2.Checked := False;
   Din3.Checked := False;
   Din3.Checked := False;
@@ -1358,6 +1560,18 @@ begin
   RC2.Value := 8;
   RC2.Value := 8;
 end;
 end;
 
 
+procedure TForm1.tbSelChange(Sender: TObject);
+begin
+  if tbSel.Checked then
+  begin
+    tbSel.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_SEL_SEL', lsuCode);
+  end
+  else
+  begin
+    tbSel.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_SEL_NON', lsuCode);
+  end;
+end;
+
 procedure TForm1.Timer1Timer(Sender: TObject);
 procedure TForm1.Timer1Timer(Sender: TObject);
 var
 var
   jsonString: string;
   jsonString: string;
@@ -1372,8 +1586,8 @@ begin
   if (InfoBox.newVersion) then
   if (InfoBox.newVersion) then
   begin
   begin
     MCSLabel.Font.Color := clred;
     MCSLabel.Font.Color := clred;
-    MCSLabel.Hint := InfoBox.versionHint + chr($0a) + chr($0d) + MCSLSU.GetLSUText(
-      'form1Captions', 'ID_CLICK_HERE', lsuCode);
+    MCSLabel.Hint := InfoBox.versionHint + chr($0a) + chr($0d) +
+      MCSLSU.GetLSUText('form1Captions', 'ID_CLICK_HERE', lsuCode);
   end;
   end;
   MCSLabel.Caption := InfoBox.versionText;
   MCSLabel.Caption := InfoBox.versionText;
 end;
 end;
@@ -1392,7 +1606,8 @@ begin
     if (StringGrid1.Cells[2, x] = '') then
     if (StringGrid1.Cells[2, x] = '') then
       StringGrid1.Cells[2, x] := '0';
       StringGrid1.Cells[2, x] := '0';
     StringGrid1.Cells[3, x] :=
     StringGrid1.Cells[3, x] :=
-      sps.getCommandText(HexToInt(StringGrid1.Cells[1, x]), HexToInt(StringGrid1.Cells[2, x]));
+      sps.getCommandText(HexToInt(StringGrid1.Cells[1, x]),
+      HexToInt(StringGrid1.Cells[2, x]));
   end;
   end;
 end;
 end;
 
 
@@ -1476,7 +1691,7 @@ begin
     begin
     begin
       playNote(0);
       playNote(0);
     end;
     end;
-    btntone.Enabled := False;
+    btntone.Enabled := True;
   end;
   end;
   List := TStringList.Create;
   List := TStringList.Create;
   try
   try

+ 19 - 6
uselectcom.lfm

@@ -9,7 +9,7 @@ object frmSelectCom: TfrmSelectCom
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnShow = FormShow
   OnShow = FormShow
   Position = poMainFormCenter
   Position = poMainFormCenter
-  LCLVersion = '1.8.4.0'
+  LCLVersion = '2.0.10.0'
   object ButtonPanel1: TButtonPanel
   object ButtonPanel1: TButtonPanel
     Left = 6
     Left = 6
     Height = 34
     Height = 34
@@ -30,10 +30,10 @@ object frmSelectCom: TfrmSelectCom
     AnchorSideTop.Control = cbServices
     AnchorSideTop.Control = cbServices
     AnchorSideTop.Side = asrCenter
     AnchorSideTop.Side = asrCenter
     AnchorSideRight.Side = asrBottom
     AnchorSideRight.Side = asrBottom
-    Left = 78
+    Left = 79
     Height = 15
     Height = 15
     Top = 52
     Top = 52
-    Width = 73
+    Width = 72
     Anchors = [akTop, akRight]
     Anchors = [akTop, akRight]
     Caption = 'ID_COMPORT'
     Caption = 'ID_COMPORT'
     ParentColor = False
     ParentColor = False
@@ -49,13 +49,26 @@ object frmSelectCom: TfrmSelectCom
   end
   end
   object Label2: TLabel
   object Label2: TLabel
     AnchorSideRight.Side = asrBottom
     AnchorSideRight.Side = asrBottom
-    Left = 0
+    Left = 4
     Height = 15
     Height = 15
-    Top = 0
-    Width = 401
+    Top = 4
+    Width = 393
     Align = alTop
     Align = alTop
+    BorderSpacing.Around = 4
     Caption = 'ID_COMMENT'
     Caption = 'ID_COMMENT'
     ParentColor = False
     ParentColor = False
     WordWrap = True
     WordWrap = True
   end
   end
+  object Label3: TLabel
+    Left = 4
+    Height = 39
+    Top = 87
+    Width = 393
+    Align = alBottom
+    AutoSize = False
+    BorderSpacing.Around = 4
+    Caption = 'ID_COMMAND_HINT'
+    ParentColor = False
+    WordWrap = True
+  end
 end
 end

+ 1 - 0
uselectcom.pas

@@ -17,6 +17,7 @@ type
     cbServices: TComboBox;
     cbServices: TComboBox;
     Label1: TLabel;
     Label1: TLabel;
     Label2: TLabel;
     Label2: TLabel;
+    Label3: TLabel;
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormShow(Sender: TObject);
     procedure FormShow(Sender: TObject);
   private
   private

+ 17 - 2
usps.pas

@@ -84,7 +84,7 @@ const
   A_CALC_LIST_AT: array[0..15] of string = ('', 'A=A+1',
   A_CALC_LIST_AT: array[0..15] of string = ('', 'A=A+1',
     'A=A-1', 'A=A+B', 'A=A-B', 'A=A*B', 'A=A/B',
     'A=A-1', 'A=A+B', 'A=A-B', 'A=A*B', 'A=A/B',
     'A=A And B', 'A=A Or B', 'A=A Xor B', 'A=Not A', 'A=A % B',
     'A=A And B', 'A=A Or B', 'A=A Xor B', 'A=Not A', 'A=A % B',
-    'A=A+16*B', 'A = B - A', '', '');
+    'A=A+16*B', 'A = B - A', 'A=A SHR 1', 'A=A SHL 1');
   PAGE_LIST_H: array[0..15] of string = ('Page 0', 'Page 1',
   PAGE_LIST_H: array[0..15] of string = ('Page 0', 'Page 1',
     'Page 2', 'Page 3', 'Page 4', 'Page 5', 'Page 6',
     'Page 2', 'Page 3', 'Page 4', 'Page 5', 'Page 6',
     'Page 7', '', '', '', '', '', '', '', '');
     'Page 7', '', '', '', '', '', '', '', '');
@@ -903,7 +903,16 @@ begin
     6: dout2 := (a and $01) > 0;
     6: dout2 := (a and $01) > 0;
     7: dout3 := (a and $01) > 0;
     7: dout3 := (a and $01) > 0;
     8: dout4 := (a and $01) > 0;
     8: dout4 := (a and $01) > 0;
-    9: pwm1 := a * 16;
+    9:
+    begin
+      pwm1 := a * 16;
+      case version of
+        Holtek:
+        begin
+          pwm1 := a;
+        end;
+      end;
+    end;
     10: pwm2 := a * 16;
     10: pwm2 := a * 16;
     11:
     11:
     begin
     begin
@@ -944,6 +953,12 @@ begin
     13: case version of
     13: case version of
         ATTiny84, Arduino: a := b - a;
         ATTiny84, Arduino: a := b - a;
       end;
       end;
+    14: case version of
+        ATTiny84, Arduino: a := a SHR 1;
+      end;
+    15: case version of
+        ATTiny84, Arduino: a := a SHL 1;
+      end;
   end;
   end;
   case version of
   case version of
     Holtek, ATMega8: a := a and 15;
     Holtek, ATMega8: a := a and 15;

Some files were not shown because too many files changed in this diff