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
- Get the memory (IRQ) for the port (this should be detailed in the manufacturer's manual)
- Get the current 8-bit (short) value from the port (so we don't mess with there settings)
- Flipping the relevant bit on or off (1 or 0) using OR to turn on, and AND to turn off to open the draw
- Waiting a second for the draw to open (else the bit will be flipped back before the draw has time to respond)
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