PROBLEM ON DRAWER KICK

  • 15 years ago

    problem on drawer kick want somebody help me. im using visual


    basic 6 and using printer TM-U220.


    THIS IS MY CODE TO OPEN IT BUT FAILED TO OPEN DRAWER.


           Print #1, "chr(27) + chr(112) + chr(49) + Chr(49) + Chr(48) + Chr(48)"
           Printer.Print "chr(27)+ chr(112) + chr(49) + Chr(49) + Chr(48) + Chr(48)"
           Printer.Print "&%H1B&%D1"
           Printer.Print KeyAscii = 27 & KeyAscii = 112 & KeyAscii = 48 & KeyAscii = 48 & KeyAscii = 49 & KeyAscii
                                           = 49  
           Printer.Print Chr(27) + " " + Chr(112) + " " + Chr(48) + " " + Chr(48) + " " + Chr(49) + " " + Chr(49)  
           Close #1


           Please I need your HELP.......


           Thank You In Advance


    mhel

  • 15 years ago
    In your post you state you have a problem, but there is no mention of it.  What is the problem you are having?  Is the drawer not opening?  Are you getting syntax errors, or runtime errors?  If so, please post them.
  • 15 years ago
    A primera vista el problema que tenes es que la serie ASCII para abrir la gaveta es:
       PRINT #1, chr$(27);chr$(112);chr$(0);chr$(48);
       PRINT #1, chr$(27);chr$(112);chr$(1);chr$(49);

    Como ves son dos lines y no una
  • 15 years ago

    To: [email protected]


        I tried your code


                  using visual basic 6 with printer EPSON TM-U220


                  Open "COM3" For Output Access Write As #1
                  Print #1, "Chr$(27); Chr$(112); Chr$(0); Chr$(48);"
                  Print #1, "Chr$(27); Chr$(112); Chr$(1); Chr$(49);"
                  Close #1


        No error display but still the drawer doesn't open


        Please I need your help (Im stuck with this problem)


        thanks


    Mhel Manuel

  • 15 years ago

    To Webjose,


        Sorry not to mention the problem.


        The Problem Is I Cant Open My Cash Drawer using EPSON TM-U220 with rj-11 connection


        Im using visual basic 6 with printer EPSON TM-U220 with rj-11 connection


         I tried this code


                 using visual basic 6 with printer EPSON TM-U220  with r-j 11 connection


                 Open "COM3" For Output Access Write As #1
                 Print #1, "Chr$(27); Chr$(112); Chr$(0); Chr$(48);"
                 Print #1, "Chr$(27); Chr$(112); Chr$(1); Chr$(49);"
                 Close #1


                 No error display but still the drawer doesn't open


                  Also try this one :


                         Printer.Print "Chr$(27); Chr$(112); Chr$(0); Chr$(48);"
                         Printer.Print "Chr$(27); Chr$(112); Chr$(1); Chr$(49);"


                 No error display but still the drawer doesn't open


       Please Help


       thanks .......


    Mhel Manuel




  • 15 years ago

    To [email protected]



        I'll try to edit your code you sent to me.
        change it with this one:


              Printer.Print "Chr$(27); Chr$(112); Chr$(0); Chr$(48);"
              Printer.Print "Chr$(27); Chr$(112); Chr$(1); Chr$(49);"


        with this kind of code in visual basic 6 using printer EPSON TM-U220.
        No error were receive but still the drawer did not open...
        I dont know what is the problem.


        Please Somebody Help Me Please
        I Really stuck on this problem


    Mhel Manuel

  • 15 years ago

    Assuming you have the correct data on how to open the drawer, try it like this:

    Code:
    Dim iFile as Integer
    Dim arrbData() as Byte


    iFile = FreeFile
    Open "COM3" For Binary Access Write As #iFile
    ReDim arrbData(1 To 4)
    arrbData(1) = &H1B '27 in hexadecimal
    arrbData(2) = &H70 '112 in hexadecimal
    arrbData(3) = &H0 '0 in hexadecimal
    arrbData(4) = &H30 '48 in hexadecimal
    Put #iFile, , arrbData
    arrbData(3) = &H1
    arrbData(4) = &H31
    Put #iFile, , arrbData
    Close #iFile


    Try it out; it is the binary equivalent of what you are trying to do.

  • 15 years ago

    Yo apenas estoy empezando a programar en visual, pero al momento de dar el PRINT #1, "CHR----" me parece que al encerrarlo en comillas estas mandando una literal y no se ejecuta la conversion ASCII

  • 15 years ago
    Hi Webjose,

          I'll try your code youve given. But still the drawer doesnt open with no error message. I Dont know what's

          wrong with this.  Please send me another sample to make this work im really stuck in this problem for one

          week now.

          Thanks in advance and may God bless you abundantly for setting aside your time to assist me.

    Mhel Manuel
  • 15 years ago
    Are you certain those codes open the drawer?  Are those the codes specified by the drawer vendor in the drawer's manual?  The code I've given should have worked ok to the best of my knowledge.
  • 15 years ago
    To Webjose,

       I dont know but this is the code specified by the drawer vendor.

       
       This code worked with visual foxpro but if i try it to visual basic 6, it doesnt open the drawer

       Printer.Print Chr(27); Chr(112); Chr(48); Chr(48); Chr(49); Chr(49);  
       Printer.Print Chr(27) + " " + Chr(112) + " " + Chr(48) + " " + Chr(48) + " " + Chr(49) + " " + Chr(49)

       Please Help....

    Mhel Manuel
  • 15 years ago
    I do not know Fox Pro, but if we are trying to open a drawer, why in the world are we printing chars to a printer??  In other words, how is it possible that printing some characters in a printer will make the drawer open?  That could only be if the drawer were programmed to somehow monitor the default printer, and to automatically open when those chars are printed, in which case my efforts are useless.

    I'm confused.
  • 15 years ago

    Yes I.m sure, I use it to oprn drawer on epson tm printers

  • 15 years ago

    To: Webjose


         Maybe there something wrong with my printer. I try to used another set of printer. I'll inform you whatever


         will be the problem. Thanks


    Mhel Manuel

  • 15 years ago

    To: Technodata


         Maybe there something wrong with my printer. I try to used another set of printer. I'll inform you whatever


         will be the problem. Thanks


    Mhel Manuel

  • 15 years ago
    I have same problem with open cash drawer which have RJ 11 port connect to printer Posiflex PP5600.
    I have try that peripheral and it work with Visual foxpro and clipper. But it can not work with visual basic. Any bady have some Idea ? What's the code to open cash drawer connect to printer ?
    Please Help me
  • 15 years ago

     
    I have no idea yet. right now i'm still working on it. if you have an idea please share it with me.


    Mhel Manuel

  • 15 years ago

    Please Try This Code        
           Open "LPT1" For Output Access Write As #1
           Print #1, Chr$(27); Chr$(112); Chr$(0); Chr$(25); Chr$(250); "A"
           Close #1


    Please Tell me, is that work ?


    Do you have code for customer display? I want to make running message on my customers display.


    Thx

  • 15 years ago

    Hello I am Torsten Schmitz from Overath Germany,


    the Problem is solved by taking this Visual Basic 6 Code:


    Attention: If it doesnt work with LPT1 (Parallelport) then take Com1 (Com2-Comx) for serial ports
    Dim iFile As Integer
    Dim arrbData() As Byte


    iFile = FreeFile
    Open "LPT1" For Binary Access Write As #iFile
    ReDim arrbData(1 To 4)
    arrbData(1) = &H1B '27 in hexadecimal
    arrbData(2) = &H70 '112 in hexadecimal
    arrbData(3) = &H0 '0 in hexadecimal
    arrbData(4) = &H30 '48 in hexadecimal
    Put #iFile, , arrbData
    arrbData(3) = &H1
    arrbData(4) = &H31
    Put #iFile, , arrbData
    Close #iFile
    Exit Sub


    I hope i could help you - had the same problems


    by Torsten Schmitz
    schmitzIT Salonmanagement
    51491 Overath, Germany
    http://www.schmitzit.de



    after edit:


    this works too:
    Open "LPT1" For Output Access Write As #1
                 Print #1, Chr$(27) + Chr$(112) + Chr$(0) + Chr$(48)
                 Print #1, Chr$(27) + Chr$(112) + Chr$(1) + Chr$(49)
                 Close #1


  • 15 years ago

    First, are you sure that the device is connected to com1?, some computers configure it with a different number and specially if it has 2 serial ports, this may be the problem.


    Other point is the avility of VB to manage com ports, why don't try to send the characters to a file and within DOS prompt sent it by COPY FILENAME.TXT > COM1 the file


  • 15 years ago

    hi all,


    i have the same problem. also tried the codes posted here. and still doesnt work. i consulted firich's website find this code:


    PRINT #1,CHR$(&H1B);"p";CHR$(0);CHR$(100);CHR$(250);


    written in qbasic. i cant seem to convert this to vb.


    thanks

  • 15 years ago

    Hello,


    first you need to read the Help for the special cash-draw you got.
    the esc sequenz may be another then 27,112,0,48 but in general the code below
    must work !


    there are 2 possiple methodes to open the cash drawer, dependend on the connection
    you choosed.
    you can send a message to the drawer connected over a printer (e.g. Epson TM-T88 II)


    for parallel
    Open "LPT1" For Output Access Write As #1
                Print #1, Chr$(27) + Chr$(112) + Chr$(0) + Chr$(48)
                Print #1, Chr$(27) + Chr$(112) + Chr$(1) + Chr$(49)
                Close #1


    or you choose a connection on seriell ports over COM1, COM2
    then this code will work...


    Open "COM1:9600,n,8,1,DS0,CS0" For Output As #1
    Print #1, "A"
    Close #1


    greats from Torsten Schmitzt, Overath
    schmitzIT

  • 15 years ago

    i already tried it but still did not work.  i aslo check my printer setting.  its on LPT1 and is set as "Generic / Text Only"

  • 15 years ago
    update.

    i have found the answer... wel, actually, WE have found the answer. i just mixed and match the codes here... and then, it just worked.  

    but then i have a new problem... well actually, im just wondering if it is on a networked. i mean two ore more computers are accesing the the same printer and the same cash drawer. i know no one would set it up this way. but as i have said i migrating a visual foxpro program. in visual foxpro, it still work in a network setup...  

    anyway the code is:
    'Open "LPT1" For Output As #1
    'Print #1, Chr$(27) & Chr$(112) & Chr$(1) & Chr$(48) & Chr$(48)
    'Close #1
  • 15 years ago
    Yes it does, so looks like the problem was the drawer coding.

    No need for generic text printer, the driver works for the printer object.

    Open "\\SERVER\Shared_Printer_Name"  For Output As #1
    Print #1, Chr$(27) & Chr$(112) & Chr$(1) & Chr$(48) & Chr$(48)
    Close #1

    Being SERVER the machine where the printer is (the route to the printer)
    and Shared_Printer_Name the networked name for the printer.
  • 15 years ago

    thax Darius... i worked!


    but the problem is i would still have to hardcode the printer object (\SERVER\SharedPrinterName). im still trying to find ways not to. i alreadly used "printer.devicename" but it returned "\server\Generic / Text Only" while the the working value should be "\server\GenericT" . i think its because of the lone printer name... im still tryin to find a way to do this...


  • 14 years ago

    Hi

    I am searching to get an activex.

    I would like to know how to print to a Epson TMU-220PD  from an application made in .NET c#.

    Can you please help?

  • 14 years ago

    Hi all.

    I have problem in linking vb to access, can someone help me?

    Thank you

    Sido.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond