I recently started a project to do attempt to print on a dot matrix printer with a Arduino. I found this forums post which laid out some code on control over a LPT cable. I hooked everything up and the example worked perfectly.
However I need to print some small graphics too and need some formatting, so I looked around and found and read a little bit about ESC/P2 standard which was supported by my Epson FX-890. And so I tried to modify the code provided there to at first just try and define some margins, font sizes and formatting before I even tried to tackle graphics... needless to say I, for the most part, failed.
So my questions would be:
How do I properly define the page dimensions ? I have A4 continuous paper 8.2 inch in width and 12 inch in height.
How do I define margins so it does not print over the perforations and the holes on the side
I am not quite sure how the graphics printing works, could it be possible to print a graphic inline to text, and if yes - how could I do that
I can't remember a thing from dot-for-dot graphics on printers, but I do remember sending a lot of escape sequences...
from this document...
Setting the page format
ESC ( C Set page length in defined unit • — — C-10
ESC ( c Set page format • — — C-11
ESC C Set page length in lines • • • C-13
ESC C NUL Set page length in inches • • • C-15
ESC N Set bottom margin • • • C-17
ESC O Cancel bottom margin • • • C-19
ESC Q Set right margin • • • C-21
ESC l Set left margin • • • C-23
That would certantly help, I even tried finding one, however this is the only one I could find.. while it covers certain things like page length, it doesn't margins and graphics..
And the esc/p2 reference doesn't provide many examples ether, so I am a bit lost on that too..
MOD is just another counting system. We count in base 10 (mod 10). Hex is MOD 16.
INTs that are over 256 (bits?) will use MOD 256... so 257 is 11(mod 256... 1 x 256 + 1 = 257). They are showing 520 is 2 (mod 256) (remainder 8)
That is where the HIGH and LOW byte come in... probably "2" is HIGH and "8" is low in the 520 example.... or the 257 example, where HIGH is 1 and LOW is 1.