Bladeren bron

Merge remote-tracking branch 'origin/develop' into develop

Willie 5 jaren geleden
bovenliggende
commit
00fce8c201
4 gewijzigde bestanden met toevoegingen van 147 en 127 verwijderingen
  1. BIN
      ArduinoSPS.zip
  2. 7 1
      README.md
  3. 10 0
      SPS/SPS.ino
  4. 130 126
      SPS/prgmode.ino

BIN
ArduinoSPS.zip


+ 7 - 1
README.md

@@ -1,6 +1,12 @@
 # ArduinoSPS
 
-A TPS Variant for the arduino with some major enhancments.
+A TPS Variant for the Arduino and some other options with some major enhancments.
+
+For more information and description see 
+http://www.rcarduino.de/doku.php?id=en:arduino:arduinosps
+
+And there is now a print book at amazon 
+https://www.amazon.com/dp/1731232535
 
 **Version 0.10**
   9.12.2018

+ 10 - 0
SPS/SPS.ino

@@ -1,5 +1,9 @@
 /*
   SPS System mit dem Arduino.
+  Version 0.11
+  17.12.2018
+  - adding Shift left and shift right to register A
+  
   Version 0.10
   7.12.2018
   - new define for serial programming
@@ -833,6 +837,12 @@ void doCalc(byte data) {
     case 13:
       a = b - a;
       break;
+    case 14:
+      a = a >> 1;
+      break;
+    case 15:
+      a = a << 1;
+      break;
 #endif
     default:
       break;

+ 130 - 126
SPS/prgmode.ino

@@ -1,126 +1,130 @@
-/*
-  entering the programming mode
-*/
-
-#define BLINK_DELAY 250
-#define SHOW_DELAY 500
-#define KEY_DELAY 250
-
-enum PROGRAMMING_MODE {ADDRESS, COMMAND, DATA};
-
-PROGRAMMING_MODE prgMode;
-
-void programMode() {
-  // checking if advance programmer board connected?
-#ifdef SPS_ENHANCEMENT
-  if (digitalRead(SW_SEL) == 0) {
-    advancePrg();
-  }
-  else {
-#endif
-    dbgOutLn("PrgMode");
-    blinkAll();
-    prgMode = ADDRESS;
-    addr = 0;
-    do {
-      blinkD1();
-      dbgOut("Adr:");
-      dbgOutLn(addr);
-      // LoNibble Adresse anzeigen
-      doPort(addr);
-      delay(SHOW_DELAY);
-
-      blinkD2();
-      // HiNibble Adresse anzeigen
-      data = (addr & 0xf0) >> 4;                                  //Adresse anzeigen
-      doPort(data);
-      delay(SHOW_DELAY);
-
-      byte Eebyte = EEPROM.read(addr);
-      data = Eebyte & 15;
-      com = Eebyte >> 4;
-
-      blinkD3();
-      prgMode = COMMAND;
-      dbgOutLn("com");
-      doPort(com); //show command
-
-      do {
-        if (digitalRead(SW_SEL) == 0) {
-          delay(KEY_DELAY);
-          com += 1;
-          com = com & 0x0F;
-          doPort(com);
-        }
-      }
-      while (digitalRead(SW_PRG) == 1);
-      delay(DEBOUNCE);
-
-      blinkD4();
-      prgMode = DATA;
-      dbgOutLn("dat");
-      doPort(data); //show data
-
-      do {
-        if (digitalRead(SW_SEL) == 0) {
-          delay(KEY_DELAY);
-          data += 1;
-          data = data & 0x0F;
-          doPort(data);
-        }
-      }
-      while (digitalRead(SW_PRG) == 1); // S2 = 1
-      delay(DEBOUNCE);
-      
-      byte newValue = (com << 4) + data;
-      if (newValue != Eebyte) {
-        EEPROM.write(addr, newValue); //           Writeeeprom Eebyte , Addr
-        blinkAll();
-      }
-      addr += 1;
-    }
-    while (true);
-#ifdef SPS_ENHANCEMENT
-  }
-#endif
-}
-
-void blinkAll() {
-  blinkNull();
-  doPort(0x0F);
-  delay(BLINK_DELAY);
-}
-
-void blinkD1() {
-  blinkNull();
-  doPort(0x01);
-  delay(BLINK_DELAY);
-  blinkNull();
-}
-
-void blinkD2() {
-  blinkNull();
-  doPort(0x02);
-  delay(BLINK_DELAY);
-  blinkNull();
-}
-
-void blinkD3() {
-  blinkNull();
-  doPort(0x04);
-  delay(BLINK_DELAY);
-  blinkNull();
-}
-
-void blinkD4() {
-  blinkNull();
-  doPort(0x08);
-  delay(BLINK_DELAY);
-  blinkNull();
-}
-
-void blinkNull() {
-  doPort(0x00);
-  delay(BLINK_DELAY);
-}
-
+/*
+  entering the programming mode
+*/
+
+#define BLINK_DELAY 250
+#define SHOW_DELAY 500
+#define KEY_DELAY 250
+
+enum PROGRAMMING_MODE {ADDRESS, COMMAND, DATA};
+
+PROGRAMMING_MODE prgMode;
+
+void programMode() {
+  // checking if advance programmer board connected?
+#ifdef SPS_ENHANCEMENT
+  if (digitalRead(SW_SEL) == 0) {
+    advancePrg();
+  }
+  else {
+#endif
+    dbgOutLn("PrgMode");
+    // light up all LEDs
+    doPort(0x08);
+    while (digitalRead(SW_PRG) == 0) {
+      // waiting for PRG to release
+    }
+    blinkAll();
+    prgMode = ADDRESS;
+    addr = 0;
+    do {
+      blinkD1();
+      dbgOut("Adr:");
+      dbgOutLn(addr);
+      // LoNibble Adresse anzeigen
+      doPort(addr);
+      delay(SHOW_DELAY);
+
+      blinkD2();
+      // HiNibble Adresse anzeigen
+      data = (addr & 0xf0) >> 4;                                  //Adresse anzeigen
+      doPort(data);
+      delay(SHOW_DELAY);
+
+      byte Eebyte = EEPROM.read(addr);
+      data = Eebyte & 15;
+      com = Eebyte >> 4;
+
+      blinkD3();
+      prgMode = COMMAND;
+      dbgOutLn("com");
+      doPort(com); //show command
+
+      do {
+        if (digitalRead(SW_SEL) == 0) {
+          delay(KEY_DELAY);
+          com += 1;
+          com = com & 0x0F;
+          doPort(com);
+        }
+      }
+      while (digitalRead(SW_PRG) == 1);
+      delay(DEBOUNCE);
+
+      blinkD4();
+      prgMode = DATA;
+      dbgOutLn("dat");
+      doPort(data); //show data
+
+      do {
+        if (digitalRead(SW_SEL) == 0) {
+          delay(KEY_DELAY);
+          data += 1;
+          data = data & 0x0F;
+          doPort(data);
+        }
+      }
+      while (digitalRead(SW_PRG) == 1); // S2 = 1
+      delay(DEBOUNCE);
+      
+      byte newValue = (com << 4) + data;
+      if (newValue != Eebyte) {
+        EEPROM.write(addr, newValue); //           Writeeeprom Eebyte , Addr
+        blinkAll();
+      }
+      addr += 1;
+    }
+    while (true);
+#ifdef SPS_ENHANCEMENT
+  }
+#endif
+}
+
+void blinkAll() {
+  blinkNull();
+  doPort(0x0F);
+  delay(BLINK_DELAY);
+}
+
+void blinkD1() {
+  blinkNull();
+  doPort(0x01);
+  delay(BLINK_DELAY);
+  blinkNull();
+}
+
+void blinkD2() {
+  blinkNull();
+  doPort(0x02);
+  delay(BLINK_DELAY);
+  blinkNull();
+}
+
+void blinkD3() {
+  blinkNull();
+  doPort(0x04);
+  delay(BLINK_DELAY);
+  blinkNull();
+}
+
+void blinkD4() {
+  blinkNull();
+  doPort(0x08);
+  delay(BLINK_DELAY);
+  blinkNull();
+}
+
+void blinkNull() {
+  doPort(0x00);
+  delay(BLINK_DELAY);
+}