Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
20
Erster Beitrag:
vor 5 Jahren, 2 Monaten
Letzter Beitrag:
vor 5 Jahren, 2 Monaten
Beteiligte Autoren:
DarrenF, Mike Allison, Al, DerekT, Piet van Zanten

WD12 and an old Epson TM-T88II

Startbeitrag von DarrenF am 31.07.2009 20:13

Hi guys,

A couple of questions:

1) Has anyone got a serial TM-T88II receipt printer working with WD and Vista?

I tried the XP driver to start with, but with advice from someone on another (more printer specific site), was advised to use the Win2000 drivers for this older model of printer and the Win2000 drivers seemed to install okay (...the XP driver install just failed saying along the lines of the O/S was wrong!).

I've knocked together a demo window and used the fopen and fwrite commands to try and get this older printer to print using the following code:


// EXAMPLE - Printing a product label (with barcode) on a Zebra LP 2844
// Device name
glocalsDevice is string = "COM1"
// String to send to printer
sMyString is string
// Port no. returned from fOpen
glocaliPort is int

// Open the file
glocaliPort = fOpen(glocalsDevice, foCreateIfNotExist)

IF ErrorOccurred THEN
Error("Unable to contact the printer! ", ErrorInfo())
ELSE

sMyString = "XYZ Cycles Ltd" + Charact(10)
fWrite(glocaliPort, sMyString)

// Close the file
fClose(glocaliPort)
END


2) When I test this code it's generating an error - more specifically, ErrorInfo() is saying Access Denied! :confused: Does anyone have an idea what may be happening?

Any insight would be great - thanks...
Antworten:
Hi Darren,

Not an expert on this but it seems logical to me that if you got a driver succesfully installed, you should be able to print using all the normal printing functions. Only if you don't have a driver then you'll have to address the serial port directly.

Regards,
Piet

von Piet van Zanten - am 01.08.2009 12:23
Hi Piet,

Thanks for taking the time to reply...

Apparently, according to WD help, there's a direct printing example; WD Direct Printing - do you know where this is located? I remember seeing it in the past, but can't put my hands on it...

When I say I've installed the drivers, they come up as TM-T88iii drivers even though Epson had them listed under the T88ii section - seems the install package cover loads of different printers.

To be honest, I'd prefer going down the direct printing route to keep keep my solution more generic.

Thanks again...


von DarrenF - am 01.08.2009 12:52
Hi Darren,

We use the TMT88 range for all of our EPOS receipt printing. We use the com port direct printing and send the escape codes to the printer to print logo's, open the cash draw, partial cut etc.

Below is a sample of code that we use. We have each bit as a local or gobal procedure depending on what we want it to do. The actual initialising of the comport and writing of data to the comport are global procedures.

You will see that we use the escape codes and the EPSON printing procedures.

I hope that this helps.

PROCEDURE WriteCOMPort()
PortNbr is int // Port number
BaudRate is int // Baud rate
Parity is int // Parity
StopBit is int // Stop Bit
SizeWritten is int // Size of the string that was written
InputBufferSize is int = 100 // Size of the buffer for reading
OutputBufferSize is int = 5000 // Size of the buffer for writing
// Waiting time of the sRead/sWrite functions between two characters (in ms)
PortWaitingTime is int = 10 // was 100

titleline is an array of 10 string
//k is int

IF FlagRcp=False THEN
RETURN
END

SizeWritten=ssize

PortNbr=INIRead ("TILLPARAM","COMPORT","X",(fExeDir()+"\epos_v5.ini"))
BaudRate=INIRead ("TILLPARAM","COMBAUD","X",(fExeDir()+"\epos_v5.ini"))
Parity=INIRead("TILLPARAM","COMPARITY","X",(fExeDir()+"\epos_v5.ini"))
StopBit=INIRead("TILLPARAM","COMBITSTOP","X",(fExeDir()+"\epos_v5.ini"))


IF PortNbr < 1 THEN
ComPortOK=False
RETURN
ELSE
ComPortOK=True
END
//
IF NOT sOpen ( PortNbr , InputBufferSize , OutputBufferSize , PortWaitingTime ) THEN
// Process port opening error
Error ( "Error while opening COM" + PortNbr )
RETURN
END

//Port settings
IF NOT sParameter ( PortNbr , BaudRate , Parity , 8 , StopBit , False , False , True ) THEN
// Process setting error
Error ( "Error while setting COM" + PortNbr )
ELSE
IF SizeWritten = 0 AND rline "" THEN
// Nothing has been written even though the string to write is not empty
// Check the output buffer
IF sInExitQueue (PortNbr)=OutputBufferSize THEN
// The output buffer is full
IF NOT YesNo ( "Cannot write to port" +...
"COM" + PortNbr ,...
"Check that a device is connected " +...
"and ready." ,...
"Do you want to retry?" ) THEN
RETURN // Cancel write operation
END
END
END
ELSE
IF SizeWritten = ssize THEN
// Everything has been written
// Otherwise, only part has been written
// But since we were able to write some, we keep trying

sWrite (PortNbr,rline)
GOTO Closecom
END
END
END


Closecom:

// Close COM
sClose ( PortNbr )


PROCEDURE OpenDraw()
FlagRcp=True
rline=""
rline=ESC + Charact(64)
ssize=Length (rline)
WriteCOMPort()
rline=ESC + Charact (82)+Charact (03)
ssize= Length (rline)
WriteCOMPort()
rline=ESC + Charact(112) + Charact(00) + Charact(80) + Charact(200)
ssize=Length(rline)
WriteCOMPort()
FlagRcp=False



I hope that this helps.

Mike Allison

von Mike Allison - am 01.08.2009 15:08
Hello Darren

Mike's answer seems pretty complete but I had a look in the older windev examples and the Windev Direct print example is in version8. If you don't have version 8 and still need their example, it may be on the PCSoft ftp site or I can email you a copy.

Regards
Al

von Al - am 01.08.2009 15:20
Al, Darren

We have been using this procedure since day 1. It works first time, every - every time. Darren, all you need to do is copy the code straight into your program and it will work.

I can let you have some other snippets if required.

Mike Allison

von Mike Allison - am 01.08.2009 15:45
Al, fyi

It has turned up again as 'WD Direct printout' in the WD14 Examples\Training.
I cannot say if it has been updated but I suspect that it will be substantially the same.

Regards

DerekT

von DerekT - am 01.08.2009 17:49
Hello Derek

Thanks for the heads up. I found it and in programming terms it is the same as the old one but they have cleaned out the awful old graphic borders and backgrounds.

Regards
Al

von Al - am 01.08.2009 23:32
Hi Mike and Al,

Mike, Many thanks for the code snippets - I'll try them on Monday as I'm away from my Dev set-up. Do you have an snippet of printing a logo?

Al, Someone once responded on this forum with PCS's ftp link, but unfortunately the search doesn't work on this forum and I can't find any info - could you let me know the ftp link? Thanks... :spos:

Thanks again guys for taking the time... it's much appreciated... :spos:

von DarrenF - am 02.08.2009 13:59
Hello Darren

The ftp site is:
ftp://ftp.pcsoft.fr/

Regards
Al

von Al - am 02.08.2009 15:04
Hi Al,

Thanks for that - couldn't find it on the FTP site... probably just not used to it :confused:

There are plenty of packages, although I did find an Examples folder, but could see the direct printing one...

...could I ask for an emailed version please... [[5]]

Thanks in advance...

von DarrenF - am 02.08.2009 17:47
Hello Darren

On the way as a zip file attachment.

Regards
Al

von Al - am 02.08.2009 18:25
Hi Mike,

I think you knew this would happen - I have a couple of questions about the code you kindly posted ;)

1) How are you defining the ssize, rline, ComPortOK and FlagRCP variables? I ask, as there are no imports to the WriteComPort() procedure, so I'm assuming they are Globals and values set before calling WriteComPort()?

2) When you say "EPSON printing procedures", are these available by installing an Epson SDK?

I'm also having a problem with the sParameter command - getting the "Error while setting..." message. This may be caused as I'm using a laptop via a docking station to access the COM port, so a test on a dev PC that isn't replicating a COM port so I can be sure what is stopping it...

Thanks in advance...

von DarrenF - am 03.08.2009 10:22
Hi Al,

Thanks - got your email :spos:

I've taken a look at the project - it's currently written for LPT ports only, but may prove useful...

Thanks again...

von DarrenF - am 03.08.2009 10:42
Hi Darren

1. ssize int, rline string, ComPortOK boolean, FlagRCP boolean

2. Have a look on the web
http://www.posprint.ru/pdf/escpos.pdf section 4 should help

3. Logos.
I would make the logo using Paint and save it as B/W (but not too big).
Copy it to the printer memory using TMFlogo.exe (you can have several logos loaded)
Send the command to print the logo you want to use.


PRINT_LOGO:
rline=Charact(28)+Charact(112)+Charact(01)+Charact(00)+CRLF
ssize=Length(rline)
WriteCOMPort()

I hope that this helps. Don't forget you need the other snippets I sent earlier e.g. initialize and WriteCOMPort()

We use the printers for printing receipts, transfer slips, packing notes, recipe slips, rental returns, we even use it for printing shelf edge labels.

Mike Allison

von Mike Allison - am 03.08.2009 12:52
Hi Mike,

Thanks for getting back - that all looks great.

Reading your PRINT_LOGO code answers a question I forgot to ask the first time around; about what ssize contained? - it's as I was guessing, the length of rline :spos:

Yes, I'm hoping to use them for as much as possible except for labels - I'm using Zebra LP2844's for that. Suppose I could use that for receipts as well if need be, but you probably guessed that from some of my recent posts on the "Zebra" subject ;)

Zebra's are great little printers and have ALL 3 interfaces as standard LPT, COM and USB - but not the same "bomb-proof" build quality of the Epson TM's - you wouldn't want to drop one on a tiled floor would you?!

Looks like you're a way down the line - wouldn't mind picking your bains about a few things? Like implementing multi-outlet etc...

Anyhoo - thanks for all your help so far - it's much appreciated :spos:

von DarrenF - am 03.08.2009 13:22
Hi Mike,

It WAS a problem with the docking station/port replicator - but it looks like I've cracked it! :) Not without problems though (are you sitting comfortably?). My other PC only has a microATX mobo, and there was no COM port (I can remember thinking - I'll never need a COM port!)

The only PC (at short notice) was my Media Centre PC in the living room (have you stopped laughin yet?), so a quick install of WD, then copy over the project; et voila - nothing!!!

So I read the documentation (when all else fails - read the doc, right?), and found the HEX mode for the printer (...if anyone needs to know; open the lid, hold down feed, turn on then close lid - how else would you turn on hex mode? :rolleyes: ). From this I knew there was data going to the printer even if it was gobbledy-gook. A quick tweak of the parity and stop bit and eureka - it's printing readable text :cool:

Then (and more luck than good management), I have a spare new mobo WITH a COM port, so last night was spent swapping the mobo's over. Tonights job is to get WD installed and test that it wasn't a flook! ;)

You may have guessed from this, WD isn't my day job - I'm an IT Application Consultant for a large IT consultancy by day and a WinDev'er by night! ;)

Thanks for all your help Mike and all those who contributed - it's much appreciated... :spos:

von DarrenF - am 05.08.2009 13:25
Darren,

You might want to give me a ring. Our details are on the website.

We may be able to do some mutually beneficial business.

Mike

von Mike Allison - am 05.08.2009 19:07
Hi Mike,

Can do... but do you have an 01... number I can use?

You can use my darren_farmer at hotmail dot com email address to reply if you like [[5]]

Cheers...


von DarrenF - am 10.08.2009 12:09
Darren,

You can get me on the office line 01789 772255.

Sorry for the delay but I have just got back from holidays.

Mike

von Mike Allison - am 25.08.2009 12:25
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.