[squeak-dev] Scape code for printers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Scape code for printers

Giuseppe
Hi list.

I need to do a little program, to test if a cash drawer opens correctly
from a Ticket printer.

With some code evaluated from a workspace is enough.

Somebody can light my way, how to send scape codes to a port? (COM, LPT,
USB etc.)

Thanks in advance.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Scape code for printers

Damien Cassou-3
On Wed, Mar 11, 2009 at 10:30 AM, Giuseppe Luigi Punzi
<[hidden email]> wrote:
> Somebody can light my way, how to send scape codes to a port? (COM, LPT, USB
> etc.)

If you understand Java, you can have a look at the attached file which
controls the printer screen.

--
Damien Cassou
http://damiencassou.seasidehosting.st



PJLPrinterDisplay.java (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Scape code for printers

Giuseppe
Java and me..we are enemies hehehe

I'm trying to use Smalltalk for all on my company.

Well, I know the escape codes, I only need to know, how to send it to
LPT1, or COM2, or to a printer at USB.

It suppose, I need to sent to the printer port :
ESC p 0 25 250

This, sends the signal to "electrify" the port at the printer, to open
the cash drawer. This printers doesn't has screens.

Cheers.

Damien Cassou escribió:

> On Wed, Mar 11, 2009 at 10:30 AM, Giuseppe Luigi Punzi
> <[hidden email]> wrote:
>  
>> Somebody can light my way, how to send scape codes to a port? (COM, LPT, USB
>> etc.)
>>    
>
> If you understand Java, you can have a look at the attached file which
> controls the printer screen.
>
>  
> ------------------------------------------------------------------------
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Scape code for printers

Jon Hylands
On Wed, 11 Mar 2009 11:48:27 +0100, Giuseppe Luigi Punzi
<[hidden email]> wrote:

> I'm trying to use Smalltalk for all on my company.
>
> Well, I know the escape codes, I only need to know, how to send it to
> LPT1, or COM2, or to a printer at USB.
>
> It suppose, I need to sent to the printer port :
> ESC p 0 25 250
>
> This, sends the signal to "electrify" the port at the printer, to open
> the cash drawer. This printers doesn't has screens.

Talking through a serial port is pretty simple.

        serialPort := SerialPort new
                baudRate: 9600;
                dataBits: 8;
                stopBitsType: 1;
                parityType: 0;
                yourself.

        ((serialPort openPort: self serialPortNumber) isNil)
                ifTrue: [ self error: 'COM port not available' ].

        serialPort nextPutAll: #(1 2 3) asByteArray.
        serialPort close.

That setup does standard 9600 baud, 8n1.

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      [hidden email]      http://www.huv.com/jon

  Project: Micro Raptor (Small Biped Velociraptor Robot)
           http://www.huv.com/blog