0

Arudino pushing binary command codes for other peripherals
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Arudino pushing binary command codes for other peripherals

by playertwo on Mon Mar 30, 2009 12:32 pm

Hello, fellow tinkerers!

I seem to have run into a brick wall and I'd welcome another set of fresh eyes to perhaps shed some light. I've been working on a little project to use an Arduino to handle i/o for an old photo printer. Now, the printer, itself, has no other means of being controlled, other than a proprietary port set to receive binary commands. The manufacturer has provided the spec in the user's manual, likely with the intent that OEM integrators would use it. (pls see attached image file)

I've written a very rudimentary sketch to send the pulses just to see if it can, indeed, be done. In this case, I'm trying to emulate the command depicted in the example provided by the manufacturer (PRINT/13):

//1
digitalWrite(outPin, HIGH);
delayMicroseconds(400);
digitalWrite(outPin, LOW);
delayMicroseconds(2800);
//1
digitalWrite(outPin, HIGH);
delayMicroseconds(400);
digitalWrite(outPin, LOW);
delayMicroseconds(2800);
//0
digitalWrite(outPin, HIGH);
delayMicroseconds(400);
digitalWrite(outPin, LOW);
delayMicroseconds(1200);
//0
digitalWrite(outPin, HIGH);
delayMicroseconds(400);
digitalWrite(outPin, LOW);
delayMicroseconds(1200);
//1
digitalWrite(outPin, HIGH);
delayMicroseconds(400);
digitalWrite(outPin, LOW);
delayMicroseconds(2800);
//0
digitalWrite(outPin, HIGH);
delayMicroseconds(400);
digitalWrite(outPin, LOW);
delayMicroseconds(1200);
//EOL
digitalWrite(outPin, HIGH);
delayMicroseconds(400);
digitalWrite(outPin, LOW);

I've scoped the output to confirm that it's sending TTL logic levels, that the signal is clean and the rises/falls look good. For lack of a better word, when compared to the example in the manual, the waveform looks perfect. However, the printer doesn't respond to it.

I've tried a variety of things:

* Tempering the output current with a 1k resistor (turns out this is unneccesary, as the internals of the printer already provide one)
* Sending the code 5x with delay padding so each command sends at 38.4ms intervals
* Cycling the highs at a frequency of 38.4KHz, not unlike IR, just in case the mention of 38.4ms was a typo or was otherwise lost in translation
* Sending it forwards, backwards, etc.

The parts of the spec that are confusing me are the mentions of:
"In case of the codes with * mark, 5 words are sent"
and
"Input timing: 1 word 38.4ms"

I realize that, in any given context, the term "word" can be a bit ambiguous. I've tried approaching it as if the entire binary string were the word (which makes the most sense) as well as if it were just the bits (which clearly, makes far less sense). The waveform pictured is 15.2ms from the start until the end of the last high, so sending it multiple times in succession doesn't add up to the 38.4ms mentioned.

Oh, I have multiple printers and have tried this on each, so I'm thinking it's not likely the input's fried or otherwise disabled.

Any thoughts? I can't help but feel as if I'm close to the answer, just not seeing what's likely right in front of me.

Very respectfully,
Kristopher Sandrick
Attachments
printer_remote_signal_specs.gif
Specs for printer command codes and input.
printer_remote_signal_specs.gif (39.33 KiB) Viewed 2154 times
playertwo
 
Posts: 5
Joined: Mon Mar 30, 2009 10:27 am

Re: Arudino pushing binary command codes for other peripherals

by adafruit_support_bill on Tue Mar 31, 2009 6:32 am

It looks like your bit order is reversed. The timing diagram shown reads left-to-right.

The 6-bit word for the command 13 is 010011. Your hard-coded timings are putting out 110010. That code doesn't match any commands in the table.

Also, is there any spec for framing these words other than 38.4 ms per word? Do they say anything about start-bits or stop-bits?

adafruit_support_bill
 
Posts: 75758
Joined: Sat Feb 07, 2009 10:11 am

Re: Arudino pushing binary command codes for other peripherals

by playertwo on Wed Apr 01, 2009 3:53 am

Hey, 'wino. Thanks for taking the time to respond. I appreciate any input I can get. Even just talking it through helps.

Actually, if you read the diagram left-to-right, it is reversed. The example shows 13=010011 but the waveform shows 110010 with what appears to be a final 0 to cap off the last bit. The output from the provided script, when scoped, creates a waveform identical to the one shown in the spec. Perhaps the mfr. wants the device to be fed each bit from lowest to highest positions? 1,2,4,8,1,2, maybe? Just to be sure, I have transmitted it both ways.

Image

Unfortunately, no. No other spec is provided other than what's seen here. No further mention of a start or stop bit, save for the final high shown in the diagram. Makes sense that would be necessary, given the space modulated spec.

I've tried to dig up more info. Looked at Mitsubishi's other similar devices. Even looked at the IR spec for some of their consumer electronics (tvs, vcrs, etc.) and found it to be nearly identical in description with no other telling info. The only other pertinent info provided in the manual is a look at the ins and outs (see attached). In this case, we're looking at pin 6, remote.

K
Attachments
printer_remote_vcp_internals.gif
i/o schems
printer_remote_vcp_internals.gif (25.07 KiB) Viewed 2081 times
playertwo
 
Posts: 5
Joined: Mon Mar 30, 2009 10:27 am

Re: Arudino pushing binary command codes for other peripherals

by adafruit_support_bill on Wed Apr 01, 2009 6:39 am

Sorry, I often confuse my left from my right. But it sounds like you have tried it both ways.

Have you tried sending the words 5 times with 23.2 ms. (38.4 - 15.2) between words? That would be my interpretation of "Input timing: 1 word 38.4ms".

adafruit_support_bill
 
Posts: 75758
Joined: Sat Feb 07, 2009 10:11 am

Re: Arudino pushing binary command codes for other peripherals

by playertwo on Wed Apr 01, 2009 11:50 am

I sure have, 'wino:

I've tried a variety of things:

* Tempering the output current with a 1k resistor (turns out this is unneccesary, as the internals of the printer already provide one)
* Sending the code 5x with delay padding so each command sends at 38.4ms intervals
* Cycling the highs at a frequency of 38.4KHz, not unlike IR, just in case the mention of 38.4ms was a typo or was otherwise lost in translation
* Sending it forwards, backwards, etc.


We thought the same thing while trying to interpret the 5 words @ 38.4ms/word portions of the spec, to no avail.

K
playertwo
 
Posts: 5
Joined: Mon Mar 30, 2009 10:27 am

Re: Arudino pushing binary command codes for other peripherals

by playertwo on Wed Apr 01, 2009 4:27 pm

Finally gave in and purchased a remote. I need to rig up a way to scope its output but we should be able to figure out this spec, once we have a known good source to compare it to.

K
playertwo
 
Posts: 5
Joined: Mon Mar 30, 2009 10:27 am

Re: Arudino pushing binary command codes for other peripherals

by adafruit_support_bill on Fri Apr 03, 2009 3:16 pm

Yea, a working implementation is always the best reference. You have to wonder why they didn't go with something like a standard serial port implementation in the first place.

adafruit_support_bill
 
Posts: 75758
Joined: Sat Feb 07, 2009 10:11 am

Re: Arudino pushing binary command codes for other peripherals

by playertwo on Sat Apr 04, 2009 12:11 pm

Oh, ain't it the truth? Well, the original thought was that I could forego the purchase of the actual OEM remote and save the money, since I had the mfr. spec handy. You know how well THAT went, heh.

I gave the remote's signal a quick look and, so far, it doesn't appear to quite match the provided spec. Not a very clean looking signal, at that (though the artifacts could have something with the upstream point I'm trying to capture it at) Did answer a few questions, though:

* It does appear to send the entire word 5x before it flatlines.
* High pulses ARE comprised of higher freq. square waves.
* Logic level provided is 2v, not 5, though I'm guessing it's not too discriminating in its threshold, just watches for a rise/fall.

I'll hook it back up and try to get some real timing measurements to see what it's doing.

I went ahead and reconfigured one of the printers using the remote and am working on controlling it using the Arduino. So far, so good. I can fire off MEMORY and PRINT as well as listen for busy or error states. Right now it's just a rat's nest of wires, LEDs and pushbuttons routed through a breadboard but it's working more/less as intended.

I do have a general-purpose Arduino question, though. In terms of best-practices, is it preferable to use an external pull-up resistor vs. the internal one on an input pin?

Kris
playertwo
 
Posts: 5
Joined: Mon Mar 30, 2009 10:27 am

Please be positive and constructive with your questions and comments.