Hi guys,
Just signed up so I can post this so I hope it's of some help. I've just been programming a till system here, only I'm using Excel VBA not Access but the theory is the same.
The code you mentioned is used to write to a COM port in much the same way you would open a TXT file and write to it. Here's a brief explanation:
OPEN "COM1:9600,N8,1"
This says COM1 (obvious), 9600 BAUD, N = the Parity (in this case NONE), 1 = Stop bits.
You can just say OPEN "COM1", but this will use whatever settings were last used for that port. If you reboot, those settings are lost so it's a good idea to specify the settings.
As for cash drawer control (plus a few others), here's what I discovered after much digging. The following are all ESC/POS commands (most sent in HEX code) that are compatible with most (please test) ESC/POS thermal printers. I'm using an Epson TM-H6000II thermal printer just FYI.
'These lines reset the printer and setup the symbol set (printing a ã sign, you use the #)
Print #1, Chr$(&H1B); "="; Chr$(1); ' start printer
Print #1, Chr$(&H1B); "@" ' reset
Print #1, Chr$(&H1B); "R"; Chr$(3); ' Set UK symbols on
'How to print NVRAM images stored using the TMF Logo app
Print #1, Chr$(&H1C) + Chr$(&H70) + Chr$(code_option) + Chr$(48); ' first two set nvram print, 3rd = image number, forth = size to print
'Paper move to cut position and cut
Print #1, Chr(&H1D) + Chr(&H56) + Chr(&H42) + Chr(&HFF) ' move paper up and cut
'Drawer one kick (some printers have more the than drawer they can kick)
Print #1, Chr$(&H1B); Chr$(&H70); Chr$(&H0); Chr$(&H19); Chr$(&HFA); ' Drawer one kick
'Close COM connection
Close #1
I have a load more commands such as changing the font, turning bold, underline, etc on and off, but if ya want them, just reply and I'll ad em.
Anyway, hope it helps someone as it took me ages to figure out.
Andy.
|