RS232
Posted: Mon Dec 03, 2007 7:28 pm
From few years I used FW 2.3 version of FW. I've used RS232 to print barcodes on serial printers.
Now when I change my environment to xHarbour and install FWH 7.12 I found that my code doesn't work correctly.
I've started do debug my program and I've found that SetCommState(cDcb)
hangs up my program. Has somebody an idea how to use serial ports with xHarbour?
Function COM_OPEN(xPORT)
Local pNAME:=IIF(xPORT=1,"COM1","COM2")
Local nError,cDCB
Local xRESZTA:=.T.
hPORT:= OpenComm( pNAME, 2048, 2048 )
If ! BuildCommDcb( pNAME+cSPEED, @cDcb )
nError = GetCommError( hPORT )
MsgInfo( "BuildCommDcb Error: " + Str( nError ) )
xRESZTA:=.F.
EndIf
If ! SetCommState( cDcb )
// there programs brakes //
nError = GetCommError( hPORT )
MsgInfo( "SetCommState Error: " + Str( nError ) )
xRESZTA:=.F.
EndIf
....
Return
Regards
Robert
Now when I change my environment to xHarbour and install FWH 7.12 I found that my code doesn't work correctly.
I've started do debug my program and I've found that SetCommState(cDcb)
hangs up my program. Has somebody an idea how to use serial ports with xHarbour?
Function COM_OPEN(xPORT)
Local pNAME:=IIF(xPORT=1,"COM1","COM2")
Local nError,cDCB
Local xRESZTA:=.T.
hPORT:= OpenComm( pNAME, 2048, 2048 )
If ! BuildCommDcb( pNAME+cSPEED, @cDcb )
nError = GetCommError( hPORT )
MsgInfo( "BuildCommDcb Error: " + Str( nError ) )
xRESZTA:=.F.
EndIf
If ! SetCommState( cDcb )
// there programs brakes //
nError = GetCommError( hPORT )
MsgInfo( "SetCommState Error: " + Str( nError ) )
xRESZTA:=.F.
EndIf
....
Return
Regards
Robert