1

I've a software made in VB.Net which opened a cash drawer connected to a receipt printer. A few days before came up a problem, the model of printer has changed and i have to connect the cash drawer to a rj11 port in the computer. I know nothing about this port, this is not a COM port neither is a modem.

Has anybody faced this problem before?

Thanks in advance

  • Are you sure it's RJ11? Usually they're using RJ12 (6-pin connector), and it is used for just delivering a +24V pulse to open the drawer (no proper serial protocol in use). http://www.transact-tech.com/tsg/ithaca_8040_info_pinouts.html – onon15 Nov 08 '12 at 16:59
  • Right, is rj12, my fault. Anyway, what i need is know how send data to this "port". I have no idea – Rafael Osuna Dominguez Nov 08 '12 at 17:09
  • As you can see in the link I sent, there is not actually a serial protocol on this cable, rather a +24 pulse needs to be sent on it. I'm guessing the printer you had, had an interface that could send this pulse. I don't think you'd find something that does that on a PC; perhaps you can connect a +24 transformer to a relay and control the relay using a serial port. – onon15 Nov 08 '12 at 17:21
  • But i've seen software opening the drawer and this was directly wired to the computer. No transformer beetween. Anyway i'll investigate your way. Thx – Rafael Osuna Dominguez Nov 08 '12 at 17:28
  • Is there an adapter in your computer that connects to RJ12? – onon15 Nov 08 '12 at 17:29
  • @RafaelOsunaDominguez Are you able to open the cash drawer directly with code only? – Moons Jun 03 '15 at 10:59

1 Answers1

0

I don't have a lot of experience with VB.net, but I have communicated with these ports in Delphi so here is what I know.

The way these port usually work is they have fixed IRQ locations, these are detailed in the manufactures manual

The process for opening the cash draw is as follows

  1. Get the memory (IRQ) for the port (this should be detailed in the manufacturer's manual)
  2. Get the current 8-bit (short) value from the port (so we don't mess with there settings)
  3. Flipping the relevant bit on or off (1 or 0) using OR to turn on, and AND to turn off to open the draw
  4. Waiting a second for the draw to open (else the bit will be flipped back before the draw has time to respond)
  5. Flipping the relevant bit on or off (1 or 0) using OR to turn on, and AND to turn off to re-engage the locking pin on the draw (else the draw will just spring open again when they close it)*

    • Note: That you don't just set the value back to the value you got in the first place because if the program crashed before flipping it back to locked you cant lock the draw without a reboot, so using an AND or OR on the original value will ensure that the 1 is a 0 or the other way round.

The biggest problem is that accessing these ports in Windows is a bit of a pain, as most of the commands are now restricted (i.e. classed as privileged instructions) there are 3rd party DLLs out there that can by pass this however (such as Inpout32.dll) - Although VB.net may not have this restriction.


From the Tysso 5700 User Manual

Cash Drawer Controller Register
Register Location: I/O port 280h
Size: 8 bit
Bit 0~3, 5~7: Reserved
Bit 4: Cash Drawer “DIO OUTPUT”, pin output control. 1: Open the Cash Drawer 0: Close the Cash Drawer

Re0sless
  • 10,678
  • 6
  • 51
  • 66