Cash with protocol Xon-Xoff

Cash with protocol Xon-Xoff

Postby Silvio.Falconi » Mon Mar 04, 2013 8:50 pm

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 November 2023 - January 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Cash with protocol Xon-Xoff

Postby vensanto » Tue Mar 05, 2013 1:43 pm

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
vensanto
 
Posts: 58
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA

Re: Cash with protocol Xon-Xoff

Postby Silvio.Falconi » Wed Mar 06, 2013 8:26 am

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 November 2023 - January 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Cash with protocol Xon-Xoff

Postby Silvio.Falconi » Wed Mar 06, 2013 6:49 pm

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 November 2023 - January 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Cash with protocol Xon-Xoff

Postby Robert Frank » Wed Mar 06, 2013 7:21 pm

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 view

Function FISKALNA_OPEN()
Local pNAME
Local nError,cDCB
Local xRESZTA:=.T.
Local cTEKST:=""
Local xPORT:=1

cKASAFISKALNA:=AllTrim(GetENV("KASAFISKALNA"))
cKASACOM:=AllTrim(GetENV("KASACOM"))
If Empty(cKASAFISKALNA)
   cKASAFISKALNA:="BRAK"
EndIf

Do Case
Case 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.)
   EndIf
EndCase
Return xRESZTA

Function FISKALNA_CLOSE()
Local xRESZTA:=.T.
Local nERROR
Local cTEKST:=""

cTEKST:="Zamkniecie portu "+cKASAFISKALNA
LogFile( "LOGS\kasafiskalna.txt", { Len( cTEKST ), cTEKST } )

MsgWait(cTEKST,"",1)

Do Case
Case 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.)
   EndIf
EndCase
Return (NIL)

Function FISK_COM_SEND(cTEKST)
Local nBYTES
Local nERROR

Do Case
Case cKASAFISKALNA="COM"
   If ( nBytes := WriteComm( hPORT, cTEKST) ) <= 0
      nError = GetCommError( hPORT )
      MsgInfo( "WriteComm Error: " + Str( nError ) )
   Else
      // przeciez wyslal
   EndIf
Case cKASAFISKALNA="USB"
   USB_SEND_PARAGON(cTEKST)
Otherwise
   MsgWait("NIE TAK COS JEST !!!","",2)
EndCase
LogFile( "LOGS\kasafiskalna.txt", { Len( cTEKST ), cTEKST } )
Return .T.
 
Robert Frank
User avatar
Robert Frank
 
Posts: 95
Joined: Fri Nov 23, 2007 4:43 am
Location: Gdynia-Poland


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 77 guests