Commits

Trammell Hudson committed a0bd0f9 Draft

mdc interface

Comments (0)

Files changed (2)

+pinout is (from left to right)
+1 +5v (connect to pin 8 of db9 on motor 1)
+2 encoder x1 (connect to pin 1 of db9)
+3 encoder y1 (connect to pin 5 of db9)
+4 encoder x2
+5 encoder y2
+6 gnd (connect to pin 9 of db9 on motor 1)
+
+
+query commands:
+?c		Display counters
+!c		Clear counters
+
+?m		Motor outputs
+
+!g 1 100	Move at speed 100 (open loop)
+
+# Disable pulse mode
+^pina 1 0
+^pina 2 0
+
+# Enable encoder mode
+^emod 1 17	Enable counter 1 as feedback for motor 1
+^emod 2 33	Enable counter 2 as feedback for motor 2
+~mmod		Query mode
+^mmod 1 3	enable closed loop mode?
+
+
+
+however, using the software to configure
+^mmod 1 4
+~emod 1 18
+^mmod 2 4
+~emod 2 34
+
+# watchdog timeouts must be disabled in closed loop mode!
+# otherwise it will return to home all the time
+^rwd 0
+
+# Write to the EEPROM
+%eesav
+
+# Slow down the accel
+^mac 1 5000
+^mdec 1 5000
+
+#!/usr/bin/perl
+use Device::SerialPort;
+
+my $dev_file = shift;
+
+my $dev = Device::SerialPort->new($dev_file)
+	or die "$dev_file: Unable to open: $!\n";
+
+my $rc = $dev->write("?c\r")
+	or die "$dev_file: write failed: $!\n";
+
+while (1)
+{
+	my $s = $dev->input
+		or next;
+
+	print "READ: $s\n";
+}