printing - Thermal Printer - Laptop via FTDI Basic Board and C# -


i'm attempting set link between laptop thermal printer (bought sparkfun) through ftdi basic board using c# (running mono 3.2 under mac 10.8). i've been using .net library from:

http://electronicfields.wordpress.com/2011/09/29/thermal-printer-dot-net/

https://github.com/yukimizake/thermaldotnet

the code doesn't seem have errors (i've changed serial ports , baudrate match settings) , seems run through whole program on terminal. however, fails interact printer , consequence nothing printed.

this exact code i'm using:

using system; using system.io; using system.text;  using system.threading; using system.io.ports; //using system.collections.generic; //using system.drawing; using thermaldotnet; using microsoft.spot;  namespace thermalprintertestapp { class printerclass {     serialport printerport;     thermalprinter printer;      public printerclass(string printerportname = "/dev/tty.usbserial-ad025hp0")     {         //serial port init         printerport = new serialport(printerportname, 19200);          if (printerport != null)         {             debug.print("port ok");             if (printerport.isopen)             {                 printerport.close();             }         }          debug.print("opening port");          try         {             printerport.open();         }         catch         {             debug.print("i/o error");             //environment.exit(0);         }          //printer init         printer = new thermalprinter(printerport, 9, 110, 10);         printer.reset();     }      public void testbarcode()     {         printer.wakeup();          thermalprinter.barcodetype mytype = thermalprinter.barcodetype.ean13;         string mydata = "3350030103392";         printer.setbarcodeleftspace(25);         printer.writeline(mytype.tostring() + ", data: " + mydata);         printer.setlargebarcode(true);         printer.linefeed();         printer.printbarcode(mytype,mydata);         printer.linefeed(2);     }      /*     static void testimage(thermalprinter printer)     {         printer.writeline("test image:");         bitmap img = new bitmap("../../../mono-logo.png");         printer.linefeed();         printer.printimage(img);         printer.linefeed();         printer.writeline("image ok");     }*/      public void printtest()     {         printer.wakeup();         debug.print(printer.tostring());          //system.threading.thread.sleep(5000);         printer.setbarcodeleftspace(25);         testbarcode();         printer.linefeed(3);          //system.threading.thread.sleep(5000);         //testimage();          //system.threading.thread.sleep(5000);          printer.writelinesleeptimems = 200;         printer.writeline("default style");         printer.writeline("printingstyle.bold",thermalprinter.printingstyle.bold);         printer.writeline("printingstyle.deleteline",thermalprinter.printingstyle.deleteline);         printer.writeline("printingstyle.doubleheight",thermalprinter.printingstyle.doubleheight);         printer.writeline("printingstyle.doublewidth",thermalprinter.printingstyle.doublewidth);         printer.writeline("printingstyle.reverse",thermalprinter.printingstyle.reverse);         printer.writeline("printingstyle.underline",thermalprinter.printingstyle.underline);         printer.writeline("printingstyle.updown",thermalprinter.printingstyle.updown);         printer.writeline("printingstyle.thickunderline",thermalprinter.printingstyle.thickunderline);         printer.setaligncenter();         printer.writeline("big text!",((byte)thermalprinter.printingstyle.bold +             (byte)thermalprinter.printingstyle.doubleheight +             (byte)thermalprinter.printingstyle.doublewidth));         printer.setalignleft();         printer.writeline("default style again");                    printer.linefeed(3);          printer.sleep();     } } } 

this terminal log after run program:

port ok opening port thermalprinter:     _serialport=/dev/tty.usbserial-ad025hp0,     _maxprintingdots=2,     _heatingtime=180,     _heatinginterval=2,     picturelinesleeptimems=40,     writelinesleeptimems=0,     encoding=ibm850 printer offline.  press key continue... 

any ideas problem is?

few things note:

  1. the printer has been able print out sample seems working.
  2. when play program, i've noticed on ftdi tx (transmitting?) lights while rx (receiving?) stays unlit. i've checked wiring , seems in order not sure if wrong (i've attached images) [edit: not enough rep points images!]
  3. i've tried using arduino comparison had similar errors (debugging fine no interaction)
  4. i'm beginner apologies oversimplifications or grand oversights!

thanks, fionn

it looks me wiring might not correct.

tx (transmit) on ftdi board should connected rx (receive) on printer. likewise, rx (receive) on ftdi board should connected tx (transmit) on printer.

see tutorial example further explanation: https://www.sparkfun.com/tutorials/224


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -