The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> Delphi Programming
|
How to open Cash Drawer that connect to a mini printer on Delphi 7?
Discuss How to open Cash Drawer that connect to a mini printer on Delphi 7? in the Delphi Programming forum on Dev Shed. How to open Cash Drawer that connect to a mini printer on Delphi 7? Delphi Programming forum discussing Delphi related topics including Kylix, C++ Builder, and more. Delphi is a high-performance language, originally based on the PASCAL language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 3rd, 2013, 05:59 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
|
|
How to open Cash Drawer that connect to a mini printer on Delphi 7?
I try to make some point of sales program that can support mini printer and cash drawer. I Have try some code from the others.
But it's not work correctly.
var
f: TextFile;
begin
AssignFile(f,'COM1');
try
rewrite(f);
writeln(f,Char(27),Char(112),Char(0),Char(25),Char(250));
CloseFile(f);
except
ShowMessage('Error');
end;
end;
Anyone can help me to fix this?? Please???
|

January 3rd, 2013, 08:53 PM
|
|
Contributing User
|
|
Join Date: May 2012
Posts: 141
Time spent in forums: 1 Day 5 h 1 m 56 sec
Reputation Power: 2
|
|
From a quick glance I found nothing is wrong with the code (except the weird use of try except). So I think your problem might have caused by either one of these: - Your computer's COM1 settings were different with one(s) acceptable by the cash drawer. Making failed communication. So consult your cash drawer's documentation. That approach in using serial port leaving you with default settings. So you have to do the adjustment in Windows Control Panel (System - Device Manager - Ports ...)
- You might want to try Write instead of WriteLn.
|

January 3rd, 2013, 09:47 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
|
|
|
I use try except because the computer maybe hang if the program can't find the port that i use. so i catch them on some error message.
I have try use Write, but its nothing happen. cash drawer still wouldn't open. And the printer is connected to COM1.
Do you have another code to open cash drawer?
|

January 3rd, 2013, 11:07 PM
|
|
Contributing User
|
|
Join Date: Jun 2008
Posts: 257
 
Time spent in forums: 3 Days 9 m 16 sec
Reputation Power: 6
|
|
I've never done worked with a cash register, so excuse me if this doesn't work, but have you tried
Writeln(f, Chr(27)+Chr(112)+Chr(0)+Chr(25)+Chr(250));
(Assuming that sequence of characters open the cash register - This link shows a slightly different sequence for an Epson Register)
|

January 10th, 2013, 08:17 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
|
|
Thx for the code, the cause is setting on the printer.
There is properties that i must set to use a cash drawer function.
And the drawer can open now... 
|

January 13th, 2013, 11:38 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
|
|
Guys, how if the mini printer use USB port, i try with the same code above and change the port to USB1 like this :
AssignFile(f,'USB1');
But nothing happend, Cash Drawer still close... So Confuse....  .
|

January 13th, 2013, 11:21 PM
|
|
Contributing User
|
|
Join Date: May 2012
Posts: 141
Time spent in forums: 1 Day 5 h 1 m 56 sec
Reputation Power: 2
|
|
|
USB is not actually port. The name already suggested, it's bus for data traffic. You have to know what device at the end of the "port". If a device could be connected to a USB "port" and it claims that you can communicate with it through serial port, then it must have created a virtual serial port upon installation. You need to find this virtual serial port name.
What I usually done is by opening device manager then look for serial ports under "Ports" node, and then for each serial port I don't really know I would query it using software like HyperTerminal. Try send ATI3 command, usually device at the other end device will dump its basic identity information.
|

January 14th, 2013, 01:46 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
|
|
Can i have some example how to send ATI3 command? I never heard like that before...
Or i read on some article that says, I must install USB to COM virtualitation, did you know how it's work ? 
|

January 14th, 2013, 11:28 PM
|
|
Contributing User
|
|
Join Date: May 2012
Posts: 141
Time spent in forums: 1 Day 5 h 1 m 56 sec
Reputation Power: 2
|
|
Quote: | Originally Posted by BugzStriffe Can i have some example how to send ATI3 command? I never heard like that before... |
That's mean you need to learn a bit more on usual "standard" in serial port communication. I suggest to google for "AT commands".
If you have Windows XP installation, you can look for HyperTerminal in Start - Access - Communication. You can use it to manually communicate with your serial device. So it's great for testing. If you don't have XP, I believe you still can download HyperTerminal, google it.
Quote: Or i read on some article that says, I must install USB to COM virtualitation, did you know how it's work ? |
Like I have said previously, that is what your device should have done upon driver installation, IF your device connects through USB. If your device has serial port, you can buy a USB-to-COM cable to "convert" your USB port to serial.
|

January 17th, 2013, 08:20 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
|
|
It's work my friends... Thx for the answer...
My problem solved... 
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|