“Trace”

Work in Progress:

“Trace” is a hack-development of a plotter based on a Epson Stylus Pro XL printer .

here is an attempt at driving the motors with the internal drivers of the motherboard by injecting serial data directly onto them, you can read more about the idea behind it here

// http://www.datasheetcatalog.org/datasheets/50/338893_DS.pdf
#include <ctype.h>

#define bit9600Delay 84
//#define halfBit9600Delay 42
//#define bit4800Delay 188
//#define halfBit4800Delay 94

int DATAA = 0;
int DATAB = 1;
int CLOCKA = 2;
int CLOCKB = 3;
int STROBA = 4;
int STROBB = 5;

//byte SWval;

//byte n0,n1,n2,n3,n4,n5,n6,n7,i0,i1,i2,i3,i4,i5,i6,i7;
// nx is a normal out  , ix is a invert out                     as on page 46    http://www.datasheetcatalog.org/datasheets/50/338893_DS.pdf
byte n0 = 11000000;
byte n1 = 11110000;
byte n2 = 11001100;
byte n3 = 11111100;
byte n4 = 11000011;
byte n5 = 11110011;
byte n6 = 11000011;
byte n7 = 11111111;
byte i0 = 00000000;
byte i1 = 00110000;
byte i2 = 00001100;
byte i3 = 00111100;
byte i4 = 00000011;
byte i5 = 00110011;
byte i6 = 00001111;
byte i7 = 00111111;

void setup() {
pinMode(DATAA,OUTPUT);
pinMode(DATAB,OUTPUT);
pinMode(CLOCKA,OUTPUT);
pinMode(CLOCKB,OUTPUT);
pinMode(STROBA,OUTPUT);
pinMode(STROBB,OUTPUT);

//digitalWrite(tx,HIGH);
//digitalWrite(13,HIGH); //turn on debugging LED
//SWprint('h');  //debugging hello
//SWprint('i');
//SWprint(10); //carriage return
}

void dataAPrint(int data)
{
byte mask;
//byte maskb;
//startbit
//digitalWrite(tx,LOW);

delayMicroseconds(bit9600Delay);

for (mask = 0x01; mask>0; mask <<= 1) {
digitalWrite(CLOCKA,HIGH);
if (data & mask){ // choose bit
digitalWrite(DATAA,HIGH); // send 1
}
else{
digitalWrite(DATAA,LOW); // send 0
}
delayMicroseconds(bit9600Delay);

digitalWrite(CLOCKA,LOW);

if (data & mask){ // choose bit
digitalWrite(DATAA,HIGH); // send 1
}
else{
digitalWrite(DATAA,LOW); // send 0
}
delayMicroseconds(bit9600Delay);
}

//stop bit
//digitalWrite(tx, HIGH);
digitalWrite(STROBA,HIGH);
delayMicroseconds(bit9600Delay);
digitalWrite(STROBA,LOW);
}

void dataBPrint(int data)
{
byte mask;
//byte maskb;
//startbit
//digitalWrite(tx,LOW);

delayMicroseconds(bit9600Delay);

for (mask = 0x01; mask>0; mask <<= 1) {
digitalWrite(CLOCKB,HIGH);
if (data & mask){ // choose bit
digitalWrite(DATAB,HIGH); // send 1
}
else{
digitalWrite(DATAB,LOW); // send 0
}
delayMicroseconds(bit9600Delay);

digitalWrite(CLOCKB,LOW);

if (data & mask){ // choose bit
digitalWrite(DATAB,HIGH); // send 1
}
else{
digitalWrite(DATAB,LOW); // send 0
}
delayMicroseconds(bit9600Delay);
}

//stop bit
//digitalWrite(tx, HIGH);
digitalWrite(STROBB,HIGH);
delayMicroseconds(bit9600Delay);
digitalWrite(STROBB,LOW);
}

void loop()
{   // the exemple sequence from the page 47 of the datasheet          http://www.datasheetcatalog.org/datasheets/50/338893_DS.pdf
dataAPrint(n4);
dataBPrint(n4);
dataAPrint(n3);
dataBPrint(n5);
dataAPrint(n2);
dataBPrint(n6);
dataAPrint(n1);
dataBPrint(n7);
dataAPrint(n0);
dataBPrint(n7);
dataAPrint(i1);
dataBPrint(n7);
dataAPrint(i2);
dataBPrint(n6);
dataAPrint(i3);
dataBPrint(n5);
dataAPrint(i4);
dataBPrint(n4);
dataAPrint(i5);
dataBPrint(n3);
dataAPrint(i6);
dataBPrint(n2);
dataAPrint(i7);
dataBPrint(n1);
dataAPrint(i7);
dataBPrint(n0);
dataAPrint(i7);
dataBPrint(i1);
dataAPrint(i6);
dataBPrint(i2);
dataAPrint(i5);
dataBPrint(i3);
dataAPrint(i4);
dataBPrint(i4);
dataAPrint(i3);
dataBPrint(i5);
dataAPrint(i2);
dataBPrint(i6);
dataAPrint(i1);
dataBPrint(i7);
dataAPrint(i0);
dataBPrint(i7);
dataAPrint(n1);
dataBPrint(i7);
dataAPrint(n2);
dataBPrint(i6);
dataAPrint(n3);
dataBPrint(i5);
dataAPrint(n4);
dataBPrint(i4);
dataAPrint(n5);
dataBPrint(i3);
dataAPrint(n6);
dataBPrint(i2);
dataAPrint(n7);
dataBPrint(i1);
dataAPrint(n7);
dataBPrint(i0);
dataAPrint(n7);
dataBPrint(n1);
dataAPrint(n6);
dataBPrint(n2);
dataAPrint(n5);
dataBPrint(n3);
dataAPrint(n4);
dataBPrint(n4);

}