--- /dev/null
+<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\r
+<WORKSPACE>\r
+ <FRAME activewindow="0">\r
+ <PLACEMENT>2c0000000000000001000000ffffffffffffffffffffffffffffffff670000001a000000de06000010040000</PLACEMENT>\r
+ <WINDOW type="default" module="ISIS"/>\r
+ </FRAME>\r
+ <MODULE name="VSMDEBUG">\r
+ <PWI>\r
+ <POPUP w="668" x="166" flags="00008003" y="105" h="210" pid="0" iid="-1">\r
+ <PROPERTIES>\r
+ <ITEM name="Message Column Width">524</ITEM>\r
+ <ITEM name="ShowGrid">No</ITEM>\r
+ <ITEM name="Source Column Width">107</ITEM>\r
+ <ITEM name="Version">100</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="350" x="6" flags="00000032" y="114" h="100" pid="1" iid="-1">\r
+ <PROPERTIES>\r
+ <ITEM name="Address Column Width">87</ITEM>\r
+ <ITEM name="AutoResize">No</ITEM>\r
+ <ITEM name="Gridlines">Yes</ITEM>\r
+ <ITEM name="Name Column Width">87</ITEM>\r
+ <ITEM name="ShowAddresses">Yes</ITEM>\r
+ <ITEM name="ShowPreviousValues">No</ITEM>\r
+ <ITEM name="ShowTypes">No</ITEM>\r
+ <ITEM name="ShowWatchPoint">Yes</ITEM>\r
+ <ITEM name="TriggerMode">0</ITEM>\r
+ <ITEM name="Value Column Width">87</ITEM>\r
+ <ITEM name="Version">100</ITEM>\r
+ <ITEM name="Watch Expression Column Width">87</ITEM>\r
+ <ITEM name="nItems">0</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="226" x="6" flags="00000008" y="114" h="215" pid="3" iid="1">\r
+ <PROPERTIES/>\r
+ </POPUP>\r
+ <POPUP w="1" x="6" flags="0000000a" y="114" h="1" pid="10" iid="1">\r
+ <PROPERTIES>\r
+ <ITEM name="DataType">2</ITEM>\r
+ <ITEM name="DispChars">Yes</ITEM>\r
+ <ITEM name="DispFormat">2</ITEM>\r
+ <ITEM name="ShowChanges">Yes</ITEM>\r
+ <ITEM name="ShowToolTips">Yes</ITEM>\r
+ <ITEM name="TopLineAddress">00000000</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="1" x="6" flags="0000000a" y="114" h="2" pid="6" iid="1">\r
+ <PROPERTIES>\r
+ <ITEM name="DataType">2</ITEM>\r
+ <ITEM name="DispChars">Yes</ITEM>\r
+ <ITEM name="DispFormat">2</ITEM>\r
+ <ITEM name="ShowChanges">Yes</ITEM>\r
+ <ITEM name="ShowToolTips">Yes</ITEM>\r
+ <ITEM name="TopLineAddress">00000000</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="1" x="6" flags="0000000a" y="114" h="2" pid="7" iid="1">\r
+ <PROPERTIES>\r
+ <ITEM name="DataType">2</ITEM>\r
+ <ITEM name="DispChars">Yes</ITEM>\r
+ <ITEM name="DispFormat">2</ITEM>\r
+ <ITEM name="ShowChanges">Yes</ITEM>\r
+ <ITEM name="ShowToolTips">Yes</ITEM>\r
+ <ITEM name="TopLineAddress">00000000</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="16" x="159" flags="00000000" y="285" h="32" pid="14" iid="1">\r
+ <PROPERTIES>\r
+ <ITEM name="DataType">2</ITEM>\r
+ <ITEM name="DispChars">Yes</ITEM>\r
+ <ITEM name="DispFormat">2</ITEM>\r
+ <ITEM name="ShowChanges">Yes</ITEM>\r
+ <ITEM name="ShowToolTips">Yes</ITEM>\r
+ <ITEM name="TopLineAddress">00000000</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="1" x="6" flags="0000000a" y="114" h="2" pid="4" iid="1">\r
+ <PROPERTIES>\r
+ <ITEM name="DataType">2</ITEM>\r
+ <ITEM name="DispChars">Yes</ITEM>\r
+ <ITEM name="DispFormat">2</ITEM>\r
+ <ITEM name="ShowChanges">Yes</ITEM>\r
+ <ITEM name="ShowToolTips">Yes</ITEM>\r
+ <ITEM name="TopLineAddress">00000100</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="1" x="6" flags="0000000a" y="114" h="1" pid="13" iid="1">\r
+ <PROPERTIES>\r
+ <ITEM name="DataType">2</ITEM>\r
+ <ITEM name="DispChars">Yes</ITEM>\r
+ <ITEM name="DispFormat">2</ITEM>\r
+ <ITEM name="ShowChanges">Yes</ITEM>\r
+ <ITEM name="ShowToolTips">Yes</ITEM>\r
+ <ITEM name="TopLineAddress">00000020</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="944" x="7" flags="0000002b" y="135" h="724" pid="1" iid="1">\r
+ <PROPERTIES>\r
+ <ITEM name="CaseSensitive">No</ITEM>\r
+ <ITEM name="DISPADDRS">Yes</ITEM>\r
+ <ITEM name="DISPLNUMS">No</ITEM>\r
+ <ITEM name="DISPOPCODES">No</ITEM>\r
+ <ITEM name="FIXUPBPTS">Yes</ITEM>\r
+ <ITEM name="WordsOnly">No</ITEM>\r
+ <ITEM name="nBreakpoints">0</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ <POPUP w="1910" x="6" flags="0000000b" y="899" h="121" pid="2" iid="1">\r
+ <PROPERTIES>\r
+ <ITEM name="Address Column Width">636</ITEM>\r
+ <ITEM name="AutoResize">No</ITEM>\r
+ <ITEM name="Gridlines">Yes</ITEM>\r
+ <ITEM name="Name Column Width">636</ITEM>\r
+ <ITEM name="ShowAddresses">Yes</ITEM>\r
+ <ITEM name="ShowGlobals">Yes</ITEM>\r
+ <ITEM name="ShowPreviousValues">No</ITEM>\r
+ <ITEM name="ShowTypes">No</ITEM>\r
+ <ITEM name="ShowWatchPoint">No</ITEM>\r
+ <ITEM name="TriggerMode">0</ITEM>\r
+ <ITEM name="Value Column Width">636</ITEM>\r
+ <ITEM name="Version">100</ITEM>\r
+ <ITEM name="nItems">0</ITEM>\r
+ </PROPERTIES>\r
+ </POPUP>\r
+ </PWI>\r
+ </MODULE>\r
+</WORKSPACE>\r
--- /dev/null
+#include <inttypes.h>
+
+#define A1_PIN 9
+#define A2_PIN 8
+#define B1_PIN 11
+#define B2_PIN 10
+#define EN_PIN 12
+
+#define STEP_TIME 200 // ms, max 1000
+
+#define FULL_STEP
+//#define HALF_STEP
+
+#ifdef FULL_STEP
+#define NUM_STEPS 4
+const uint8_t coil_current[NUM_STEPS][4] =
+{
+ {1, 0, 0, 1},
+ {1, 1, 0, 0},
+ {0, 1, 1, 0},
+ {0, 0, 1, 1}
+};
+#endif
+
+#ifdef HALF_STEP
+#define NUM_STEPS 8
+const uint8_t coil_current[NUM_STEPS][4] =
+{
+ {1, 0, 0, 1},
+ {1, 0, 0, 0},
+ {1, 1, 0, 0},
+ {0, 1, 0, 0},
+ {0, 1, 1, 0},
+ {0, 0, 1, 0},
+ {0, 0, 1, 1},
+ {0, 0, 0, 1}
+};
+#endif
+
+void timer1_init(void);
+void stepper_init(void);
+
+const uint8_t stepper_pins[4] = {A2_PIN, A1_PIN, B1_PIN, B2_PIN};
+
+void setup()
+{
+ stepper_init();
+ timer1_init();
+}
+
+void loop()
+{}
+
+void timer1_init(void)
+{
+ // Disable interrupts during timer configuration
+ noInterrupts();
+ // Select CTC mode (4) and set the prescaler to divide the clock by 256
+ // resulting in timer frequency of 62.5 kHz
+ TCCR1A = 0;
+ TCCR1B = (1 << WGM12) | (1 << CS12);
+ // Enable interrupt when reaching the maximum value (OCR1A)
+ TIMSK1 = (1 << OCIE1A);
+ // Set the timer period to 50 ms (50 * 62.5 = 3125)
+ OCR1A = (int) STEP_TIME * 62.5;
+ // Reset OC register B and the input capture register. They are not used
+ ICR1 = OCR1B = 0;
+ // Reset the counter register
+ TCNT1 = 0;
+ // Enable inerrupts
+ interrupts();
+}
+
+ISR(TIMER1_COMPA_vect)
+{
+ static volatile uint8_t step = 0;
+
+ for (uint8_t i = 0; i < 4; i++)
+ {
+ digitalWrite(stepper_pins[i], coil_current[step][i]);
+ }
+
+ step++;
+ if (step >= NUM_STEPS)
+ {
+ step = 0;
+ }
+}
+
+void stepper_init(void)
+{
+ for (uint8_t i = 0; i < 4; i++)
+ {
+ pinMode(stepper_pins[i], OUTPUT);
+ }
+ pinMode(EN_PIN, OUTPUT);
+ digitalWrite(EN_PIN, HIGH);
+}
+\r