Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 3rd, 2013, 05:59 AM
BugzStriffe BugzStriffe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 6 BugzStriffe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
Send a message via Yahoo to BugzStriffe
Unhappy 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???

Reply With Quote
  #2  
Old January 3rd, 2013, 08:53 PM
Luthfi Luthfi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 141 Luthfi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #3  
Old January 3rd, 2013, 09:47 PM
BugzStriffe BugzStriffe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 6 BugzStriffe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
Send a message via Yahoo to BugzStriffe
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?

Reply With Quote
  #4  
Old January 3rd, 2013, 11:07 PM
majlumbo majlumbo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 257 majlumbo User rank is Lance Corporal (50 - 100 Reputation Level)majlumbo User rank is Lance Corporal (50 - 100 Reputation Level)majlumbo User rank is Lance Corporal (50 - 100 Reputation Level) 
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)

Reply With Quote
  #5  
Old January 10th, 2013, 08:17 AM
BugzStriffe BugzStriffe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 6 BugzStriffe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
Send a message via Yahoo to BugzStriffe
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...

Reply With Quote
  #6  
Old January 13th, 2013, 11:38 AM
BugzStriffe BugzStriffe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 6 BugzStriffe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
Send a message via Yahoo to BugzStriffe
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.... .

Reply With Quote
  #7  
Old January 13th, 2013, 11:21 PM
Luthfi Luthfi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 141 Luthfi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #8  
Old January 14th, 2013, 01:46 AM
BugzStriffe BugzStriffe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 6 BugzStriffe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
Send a message via Yahoo to BugzStriffe
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 ?

Reply With Quote
  #9  
Old January 14th, 2013, 11:28 PM
Luthfi Luthfi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 141 Luthfi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #10  
Old January 17th, 2013, 08:20 AM
BugzStriffe BugzStriffe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 6 BugzStriffe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 57 sec
Reputation Power: 0
Send a message via Yahoo to BugzStriffe
It's work my friends... Thx for the answer...
My problem solved...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > How to open Cash Drawer that connect to a mini printer on Delphi 7?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap