Cash with protocol Xon-Xoff

Post Reply
User avatar
Silvio.Falconi
Posts: 7143
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Cash with protocol Xon-Xoff

Post by Silvio.Falconi »

How I can link with a cash have protocol Xon(ox11)-Xoff(ox13) ?


BAUD RATE = 9600
PARITA' = NO
STOP BIT = 1
BIT/CAR = 8
HANDSHAKE := CONTROLLO DI FLUSSO XON-XOFF


there is some sample for create it ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
vensanto
Posts: 58
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA
Contact:

Re: Cash with protocol Xon-Xoff

Post by vensanto »

I have used this procedure

setting the com port in nCMD1 ( XON=ON ) and send the MODE command

nCMD1:="MODE "+nCOMPRT+":"+Alltrim(Str(eECRBAUD))+","+eECRPARI+","+Alltrim(Str(eECRBIT))+","+Alltrim(Str(eECRBSTOP))
nCMD1+=",TO=OFF,XON=ON,IDSR=OFF,ODSR=OFF,OCTS=OFF,DTR=OFF,RTS=OFF"
RUN (nCMD1)

after i send with the TYPE command the file with the command cash register

nCMD2:="TYPE SCOBIG.TXT > "+nCOMPRT
RUN (nCMD2)

and this work very well

regards
Santo Venezia
User avatar
Silvio.Falconi
Posts: 7143
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: Cash with protocol Xon-Xoff

Post by Silvio.Falconi »

I think I must use serial comunication ( tSocket) but I not Know how it must make
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
Posts: 7143
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: Cash with protocol Xon-Xoff

Post by Silvio.Falconi »

Dear Santo...
with txt command you not Know how much paper you have , if the printer is open or close , if the data are saved on printer .....
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Robert Frank
Posts: 95
Joined: Fri Nov 23, 2007 4:43 am
Location: Gdynia-Poland
Contact:

Re: Cash with protocol Xon-Xoff

Post by Robert Frank »

try to use

1. FISKALNA_OPEN() - open COM port
2. FISK_COM_SEND(cTEKST) - send string to COM port (fiskal printer)
3. FISKALNA_CLOSE() - close COM port

Code: Select all | Expand

Function FISKALNA_OPEN()Local pNAMELocal nError,cDCBLocal xRESZTA:=.T.Local cTEKST:=""Local xPORT:=1cKASAFISKALNA:=AllTrim(GetENV("KASAFISKALNA"))cKASACOM:=AllTrim(GetENV("KASACOM"))If Empty(cKASAFISKALNA)   cKASAFISKALNA:="BRAK"EndIfDo CaseCase cKASAFISKALNA="BRAK"   MsgStop("Stanowisko nie posiada obslugi kasy fiskalnej")   cCOM_IP_USB:="BRAK"   Return .T.Case cKASAFISKALNA="USB"   cCOM_IP_USB:="USB"Case cKASAFISKALNA="COM"   cCOM_IP_USB:="COM"   xPORT:=Val(cKASACOM)   If xPORT=0      MsgWait("Domyslnie kasa fiskalna na porcie 1","",2)      xPORT:=1   EndIf   Do Case   Case xPORT=1    pNAME:="COM1"   Case xPORT=2    pNAME:="COM2"   Case xPORT=3    pNAME:="COM3"   Case xPORT=4    pNAME:="COM4"   Case xPORT=5    pNAME:="COM5"   Case xPORT=6    pNAME:="COM6"   Case xPORT=7    pNAME:="COM7"   Case xPORT=8    pNAME:="COM8"   Case xPORT=9    pNAME:="COM9"   EndCase   cTEKST:="Otwarcie portu : "+pNAME+" ---> "+cSPEED   LogFile( "LOGS\kasafiskalna.txt", { Len( cTEKST ), cTEKST } )   //MsgWait(cTEKST,"",1)   hPORT:= OpenComm( pNAME, 2048, 2048 )   If ! BuildCommDcb( pNAME+cSPEED, @cDcb )      nError = GetCommError( hPORT )      MsgInfo( "BuildCommDcb Error: " + Str( nError ) )      xRESZTA:=.F.   EndIf   If ! SetCommState( hPORT, cDcb )         nError = GetCommError( hPORT )         MsgInfo( "SetCommState Error: " + Str( nError ) )      xRESZTA:=.F.   EndIf   If xRESZTA      oWND:oMSGBAR:cMSGDEF:=PNAME+" : OTWARTY "+pNAME+cSPEED      oWND:oMSGBAR:Refresh(.T.)      oWND:bCommNotify := {|nComm,nStatus| ODBIERZ(hPORT,nSTATUS) }      EnableCommNotification(hPORT,oWNd:hWNd,1,-1)   Else      oWND:oMSGBAR:cMSGDEF:=PNAME+" : NIEUDANE OTWARCIE "+pNAME+cSPEED      oWND:oMSGBAR:Refresh(.T.)   EndIfEndCaseReturn xRESZTAFunction FISKALNA_CLOSE()Local xRESZTA:=.T.Local nERRORLocal cTEKST:=""cTEKST:="Zamkniecie portu "+cKASAFISKALNALogFile( "LOGS\kasafiskalna.txt", { Len( cTEKST ), cTEKST } )MsgWait(cTEKST,"",1)Do CaseCase cKASAFISKALNA="COM"   If FlushComm( hPORT, 0 ) != 0         nError = GetCommError( hPORT )         MsgInfo( "FlushComm Error: " + Str( nError ) )      xRESZTA:=.F.   EndIf   If ! CloseComm( hPORT )         nError = GetCommError( hPORT )         MsgInfo( "CloseComm Error: " + Str( nError ) )   xRESZTA:=.F.   EndIf   If xRESZTA   //   oWND:oMSGBAR:cMSGDEF:=" COM : ZAMKNIETY"   //   oWND:oMSGBAR:Refresh(.T.)   Else   //   oWND:oMSGBAR:cMSGDEF:=" COM : NIE UDANE ZAMKNIECIE"   //   oWND:oMSGBAR:Refresh(.T.)   EndIfEndCaseReturn (NIL)Function FISK_COM_SEND(cTEKST)Local nBYTESLocal nERRORDo CaseCase cKASAFISKALNA="COM"   If ( nBytes := WriteComm( hPORT, cTEKST) ) <= 0      nError = GetCommError( hPORT )      MsgInfo( "WriteComm Error: " + Str( nError ) )   Else      // przeciez wyslal   EndIfCase cKASAFISKALNA="USB"   USB_SEND_PARAGON(cTEKST)Otherwise   MsgWait("NIE TAK COS JEST !!!","",2)EndCaseLogFile( "LOGS\kasafiskalna.txt", { Len( cTEKST ), cTEKST } )Return .T. 
Robert Frank
Post Reply