Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing to USB printer

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I have an EPOS system which has been in use for many years.
It uses a thermal printer and receipts are created programmatically and then copied to the printer port.
Code:
! COPY C:\TILL\RECEIPT2.TXT LPT1
This has served my client well but the printer is giving up the ghost and requires replacement. He has bought a new thermal printer but this only supports USB.

What would you suggest with regards changing to the new printer, is it possible to specify a USB port instead of LPT1 or do I now have to create a report and print that? My concern is that if I use the report method, the receipts would have to be a constant length.
If the site was local, I could experiment with it but as it is miles away from my location, this is an option.


Keith
 
Even if you were able to copy directly to a USB port, I suspect you would still need to experiment, as there's no guarantee that the new printer will behave exactly the same as the old one. The font metrics might be slightly different, as might the unprintable margins. If I was in your shoes, I would definitely ask to have the printer (or an identical model) on my desk while I was modifying the code.

Presumably, the new printer would also have different control codes, so you would have to change your code in any case.

That being the case, you might as well switch to doing a report. Alternativelty, I wonder if a USB-to-parallel adapter would work?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I have in the past used net use command. Assuming that the new printer should work with your application try:

1- Install and share the printer.
2- Use at the command prompt or bat file

Net use LPT1 \\workstation_name\printer_share_name /persistent:yes

See if it works

Edgar
Integrated Bar Code Systems, Inc.
 
Thanks for the prompt replies.
One of my client's customers, a network chap has fitted an adaptor, as Mike suggested and the receipt printer is sort of working.
I have been sent an image of it and it is only the formatting which is slightly out but nothing too bad and the till drawer operation needs sorting. The old one used chr(27) as till open control, I suspect the new one has a different requirement. I have asked my client for the control codes and he is sending them to me, tomorrow.
All in all, the changeover is a lot easier than we all expected - technology that actually works, brilliant.

Keith
 
It has been a bit of a hassle but I have finally worked out the relevant code sequences for till open, paper feed and paper cut.

The one thing I am unable to do is print a simple '£' sign, instead a strange symbol is printed.
The previous version of this had a similar problem but it was solved by printing chr(163).

I have just sent a routine to print a full charset out but thought I would ask here for a bit of advice.



Keith
 
If CHR(163) doesn't work, you might try CHR(156).

On older dot-matrix printers, we used to send a hash sign (#) to print a British pound symbol, but we had to make a setting on the printer (either a dip switch or an escape sequence) to make that work. I suppose it's unlikely that a modern ticket printer would work the same way.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
When it comes to using weird printers and NET USE... I reckon I deserve a PhD.

The NET USE command works for my various printers
I put it in the batch file that opens the App

Suggestion:

Put a net use lpt1: /delete in front of the application call ((just in case there is something blocking access))
And put in a net use lpt1: /delete command afterwards ((ie after exiting the App, and in the batch... to remove the connection)).


Example
Code:
net use lpt1: /delete

Net use LPT1 \\workstation_name\printer_share_name /persistent:yes

[application]

net use lpt1: /delete

My 2 cents
 
We got the printer to do the actual printing with very few problems.
A Mike mentioned, the previous printer a little Star dot matrix printer required the # symbol to print out a £ sign. I thought it was bizarre at the time but as it worked, I just let it get on with things.
The new one is a small Chinese thermal printer which was shipped with a chocolate tea pot instead of an instruction book proved a little harder to set up.
I have asked the company for the control code info but I don't hold out much hope as they have asked me what I mean by 'control codes'.

I managed to fathom the various chr sequences by reading other Epson manuals and using a bit of guess work.
I am still waiting to hear whether the £ sign is amongst the 255 printed characters.


Keith
 
I don't hold out much hope as they have asked me what I mean by 'control codes'.

Oh, no. You're definitely right not to expect a good answer.

shipped with a chocolate tea pot

I know what you mean. I've got a whole shelf of those.

the previous printer a little Star dot matrix printer required the # symbol to print out a £ sign. I thought it was bizarre at the time

I think it was because, in the very old days, you could only send 7-bit characters over the serial port, the 8th bit being a parity bit. So you could only send the 127 characters in the basic ASCII set. That didn't include the pound sign (or any other "foreign" characters, the first word of ASCII being "American", after all). If a printer manufacturer wanted to provide one of those characters, it had to lose one of the official ASCII characters. The hash sign was always chosen as the one that was changed to the pound sign.

I believe in the USA, the hash sign is sometimes called a pound sign, although presumably that refers to a pound weight (450 grams) rather than the currency unit. But the symbol is also called a number sign, which only adds to the confusion.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I believe in the USA, the hash sign is sometimes called a pound sign, although presumably that refers to a pound weight (450 grams) rather than the currency unit. But the symbol is also called a number sign, which only adds to the confusion.

Correct.
 
I would be willing to bet it uses one of two control code approaches; either the old Epsom Esc series or the basic HP PCL5/6.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
It uses the old Epson ESC series as that is what we finally settled for with the feed and cut routines but the £ sign is a basic text char and when I added it to the text output, the text was fine but the £ sign was gobbledegook.
I recently had this issue with a Perl script on a remote server, same ISP, same script, 2 different websites with 2 different outputs. One printed a £ sign properly and the other printed a question mark inside a diamond. They argued the toss that the 2 servers were identical, I argued that was not possible as if that were the case the outputs would be identical. They insisted I was wrong, I moved all my websites to a new ISP where things are constant.

Keith
 
I would be willing to bet it uses one of two control code approaches; either the old Epsom Esc series or the basic HP PCL5/6.

When you're talking about POS systems and receipt printers, I wouldn't take that bet.

You could've knocked me over with a feather the day I learned that ours use this as the "cut" signal:

Code:
Padc(Replicate("-",18),22)

(I may have the exact numbers misremembered, but it's a string of "-" of a specific length.)
 
Good grief Dan, how on earth did you guess that sequence or was the supplied manual fit for purpose?

The old one used chr(28) or chr(7) to open the drawer and the cut was even easier, via a serrated edge on the front.

The new one uses strings of chars for some reason, still not sure why.
Code:
*Cut chr(29)+chr(86)+chr(66)+chr(0)
* Feed and open chr(27)+chr(112)+chr(0)+chr(64)+chr(240)



Keith
 
Keith,

I just found one of my old Epson manuals. On the off-chance that your printer uses the Epson control codes, I suggest you try sending ESC R3 (that's an ESC character - CHR(27) - followed by a capital R followed by the digit 3).

That's the Epson escape sequence for selecting the UK character set. You should then be able to use the # sign to print a pound. All the other characters should be the same.

This might be a blind alley, but it would be worth a try.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Good grief Dan, how on earth did you guess that sequence or was the supplied manual fit for purpose?

No idea how they did it. I learned it by reading code written by my predecessors. (All of them left the company in anger so they're not exactly available resources.)
 
Mike Lewis
I will try that if the results of the current experiment reveals nothing.
My client has been busy despatching stuff to happy punters - anyone would think it is Christmas.
I have been monitoring delivery efficiency for him and Royal Mail gets full marks from me.
I couldn't possibly name or comment about the other carrier who lost several parcels but I am sure anyone with a computer and a working 'Y' key could find out who they are.

Dan
I used to work with some clever people and they never ceased to amaze me.

Keith
 
The explanation for the latest finding could be simple or not - I will leaver that decision to peoplr with more knowledge than us.

The final phase of a sale is the printing of the receipt.
A .txt file is created with the imaginative name of receipt.txt and is then printed using the following code.
Code:
! COPY C:\TILL\RECEIPT2.TXT LPT1
The result is a pretty receipt, spoilt only by the wrongly printed £ sign.
The £ sign is chr(163) but chr(250) is printed instead. (Not the words 'chr(250)' but the actual character.

Contrast this by opening the same receipt.txt file in notepad and then print it out, the £ sign is printed correctly.

I may need to eat more mince pies to take my mind of this problem.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top