Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
10
Erster Beitrag:
vor 4 Monaten, 1 Woche
Letzter Beitrag:
vor 4 Monaten
Beteiligte Autoren:
willy hermans, cardcoder, DarrenF

Citizen CT-s651 serial barcode command

Startbeitrag von willy hermans am 14.09.2017 13:29

Hello,

I want to print a barcode via serial commands to a Citizen CT-s651. Tis is a serial ticket (pos) printer. (Old DOS methode)

The manual is not clear for me.
Has someone an example to print a barcode this way.

Many thanks.

Willy Hermans

Antworten:

Hi Willy,

Do a google search for CommandReference015E_120607_4.pdf This is the correct manual for your printer.

Look at page 140.

The first thing to do is to get it to print the barcode. Which format are you using - EAN-13 etc.

After that you can add the extra bits - barcode number above / below barcode , change size etc.

It is the same format as if you were cutting paper -
"1D" Hex , XXX , XXX , XXX

You can PM me if you really get into trouble.

Kindest Regards,

Mike Allison

von cardcoder - am 14.09.2017 14:38
Hello,

I use EAN 13

I found this code
HH [d1…dn]

I have an inifile with this content
Barcode=charact(29) + charact(72) + Charact(107) + charact(67) + "123456789012"
I read the content into the variabele cBarcode

cCode = StringBuild(cBasicCode,cBarcode) // This works fine for
cBarcode = ExecuteCode(cCode) // the othet commands


If I understand it well, the position of the hri and the size of the barcode is optional.

The result is text "C123456789012" and not a barcode

Thanks,

Willy Hermans

von willy hermans - am 15.09.2017 11:59
Hi Willy,

If you are using it in default mode ean-13, you have to put the check digit on the end. You are only putting in 12 digits - so it is not a correct barcode.

You are getting the error because it CAN'T print it!

The correct barcode is 1234567890128.

Regards,

Mike Allison

von cardcoder - am 15.09.2017 12:25
Hello,

I''ve tried it but it makes no difference.

It still does not work.

von willy hermans - am 18.09.2017 07:51
Hi Willy,

What isn't working?
How are you opening the port?
Can you show us all your code?

von DarrenF - am 18.09.2017 11:24
Hello,

This is the last trial


PROCEDURE prttest()

IF sOpen(Port_E, 2000,2000) THEN
// sParameter(gsCom_Poort,19200,0,8,0,true)
ELSE
Error("Probleem met openen seriële poort ","Staat de printer aan" + Port_E)
RETURN
END



Schrijf(Port_E, ESC + "H1Dh"+Charact(50))
Schrijf(Port_E, ESC + "H1DH"+Charact(2))
Schrijf(Port_E, ESC +"H1Df"+Charact(0))

Schrijf(Port_E, ESC +"H1Dk")
Schrijf(Port_E, 4)
Schrijf(Port_E, “12”+Charact(0))
Schrijf(Port_E, ESC +"HA")

FOR i = 1 TO 10
Schrijf(Port_E,cLineFeet)
END

// Cut the paper
Writestring = Charact(10) + Charact(27) + Charact(105)
Schrijf(Port_E, cCutter)
sClose(Port_E)



PROCEDURE Schrijf(pPoort,pLijn)

IF cSerielePrinter = "HTML" THEN
cHtmlBody += pLijn
ELSE
sWrite(pPoort, pLijn)
END




This is based on this sample basic program from the printer manual

LPRINTCHR$(&H1D);"h";CHR$(30);
LPRINTCHR$(&H1D);"w";CHR$(2);
GOSUBBC
LPRINTCHR$(&H1D);"h";CHR$(50);
LPRINTCHR$(&H1D);"w";CHR$(3);
GOSUBBC
LPRINTCHR$(&H1D);"h";CHR$(80);
LPRINTCHR$(&H1D);"w";CHR$(4);
GOSUBBC
END
BC:
LPRINTCHR$(&H1D);"k";
LPRINTCHR$(4);
LPRINT"12";CHR$(0);
RETURN


What is going wrong.
Wel there is no barcode printed but the printer prints a text string.

Thanks already
Willy Hermans

von willy hermans - am 18.09.2017 13:03
Willy,

This is how I print a barcode on the bottom of a receipt. Gianni Spano and I wrote this module in 2010 (long with a bit of help from Fabrice Harari).

The first module is the procedure to get the barcode details.
The second module is the printing on the comport that the printer is attached to.

I hope that you can follow it Ok.

Kindest Regards,

Mike Allison


PROCEDURE PrintReceiptBarcode()

wtillno is string
wRecpNb is string
IF TillNo

von cardcoder - am 18.09.2017 15:29
Hello,

Indeed this helped al lot.
Its working now and this is the code.

I think this works for most Citizen Ticketprinters. And for the ean13 barcode.

PROCEDURE PrintBarcode(pBarcode)
cLine is string
cLine=Charact(29)+Charact(72)+Charact(02)+CRLF
sWrite(2,cLine)
cLine=Charact(29)+Charact(104)+Charact(72)+CRLF
sWrite(2,cLine)
cLine=Charact(29)+Charact(107)+Charact(02)+pBarcode+CRLF
sWrite(2,cLine)

It looks simple and it corresponds to the manual, but every bit and byte must be exact.
This code assumes that the port is opened and you have to close it afterwards but it works fast.


The manual does not mention any CrLf ...

With this code I can print every ean13 serial.

The last digt is a checksum. So you can make a 12 digit code and use this code add the check

PROCEDURE AddCheckDigit(cIn)

nDummy1 is int = 0
nDummy2 is int
cCheck is string
cTerug is string = ""


IF Length(cIn) = 12 THEN
FOR i = 2 TO 12 STEP 2
nDummy1 += Asc(Middle(cIn,i,1))-48
nDummy2 += Asc(Middle(cIn,i-1,1))-48
END
nDummy1 = (nDummy1*3) +nDummy2

IF IntegerPart(nDummy1/10) = nDummy1 THEN
cCheck = "0" // Dit wordt de checkdigit
ELSE
cCheck = ((IntegerPart(nDummy1/10)*10)+10) - nDummy1
END

IF cCheck = "10" THEN
cCheck = "0"
END
END


RESULT cCheck


This function is not optimized but it works.

Thanks voor the example.

Willy Hermans

von willy hermans - am 20.09.2017 10:37
Hi Willy,

Glad we were able to help.

Kindest Regards,

Mike Allison

von cardcoder - am 20.09.2017 13:24
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.