Prezados,
Estou tentando usar as funçíµes da HBCOMM.LIB no xailer...
Porém ao compilar a linha que tem a chamada as funçíµes SETDTR() e SETRTS()
dá um erro de sintaxe, MAS A SINTAXE ESTí CORRETA...
Linhas onde ocorre o erro:
SETDTR(AppData:nPortaCom,lDTR)
SETRTS(AppData:nPortaCom,lRTS)
Erro ocorrido:
funcoes.prg(41) Error E0030 Syntax error: "syntax error at '('"
funcoes.prg(42) Error E0030 Syntax error: "syntax error at '('"
OBS: Se eu desabilitar as linhas, consigo compilar...
Att
Reginaldo
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
HBCOMM com XAILER
HBCOMM com XAILER
Reginaldo:
HBCOMM.LIB não tem estas funçíµes.
Function Information:
Nx_port, Nbaud, Ndata, Nparity, Nstop, nBufferSize
Init_Port( cPort, nBaudrate, nDatabits, nParity, nStopbits,
nBuffersize ) -->
nHandle
Port opener and initializer.
Where:
cPort Port designator. Can either be old form 'COMn' or the more
general form '.COMn'. The general form is required for
ports higher than COM9.
nBaudrate Just like you're used to (e.g., 2400, 4800, 9600, etc. )
nDatabits Usually 8, but can be 7 or 4.
nParity coded: 0,1,2,3 -> none, odd, mark, even
nStopbits coded: 0,1,2 -> 1, 1.5, 2
nBuffersize I'm using 8000 at 38,400 baud.
nHandle returned instance identifier. A numeric >= 256. If nHandle
is negative, the open failed.
OutBufClr( nHandle ) --> lSuccess
Clear the output buffer. lSuccess will always be TRUE unless a bad
nHandle is used.
IsWorking( nHandle ) --> lSuccess
Check to see if port is operative. Failures can occur if a bad nHandle
is used or if remote party drops the line.
InChr( nHandle, nChar, @cBuff ) --> nBytesRead
Fetch data from the input buffer. Note the by reference argument
passing
for the buffer. nChar can be determined by calling InBufSize().
nBytesRead is the actual number of bytes loaded into cBuff (usually
equal to nChar unless there is a problem or nChar is overstated.)
InBufSize( nHandle ) --> nNumberofBytesInInputBuffer
Get the count of bytes waiting in the input buffer. Usually followed
by
a call to Inchr to fetch the bytes for processing.
OutChr( nHandle, cBytesToWrite, nCount ) --> lSuccess
Write the first nCount bytes from the string cBytesToWrite. Usually,
nCount == Len( cBytesToWrite ).
OutBufSize( nHandle ) --> nBytesInOutputBuffer
Get the byte count of characters awaiting transmission.
UnInt_Port( nHandle ) --> lSuccess
Uninitialize (Close) the port and free the handle.
SETHANDSHAKE(nhandle,nShake) ->lSet
Set the handshake to com port
values of nshake can be
EHandshakeUnknown = -1, // Unknown
EHandshakeOff = 0, // No handshaking
EHandshakeHardware = 1, // Hardware handshaking (RTS/CTS)
EHandshakeSoftware = 2, // Software handshaking (XON/XOFF)
EHANDSHAKEHARDWAREDTR = 3, // Hardware handshaking DTR On/RTS
off
EHANDSHAKEHARDWARERTS = 4 // Hardware handshaking DTR Off/RTS
on
ISCTS(handle) ->lCts
verify if cts event occured
USAGE:
Here's how I do this stuff...
STATIC nHandle
....Mainline...
IF OpenOk()
DOProcessing()
ELSE
MsgStop( 'Cannot open port!' )
QUIT
ENDIF
Function OpenOk()
// Open the port
IF ( nHandle := Init_Port( 'COM1', 9600, 8, 0, 0, 8000 ) ) > 0
OutBufClr( nHandle ) // Saw this somewhere...probably ok if unnecessary
Return IsWorking()
ENDIF
Return FALSE
Function DOProcessing()
....
// Get a chunk from the COM port
nChr := InBuffSize( nHandle )
cBuff := Space( nHandle )
IF nChr != InChr( nHandle, nChr, @cBuff)
MsgStop( 'Some kind of read failure on COM Port.' )
Return FALSE
ENDIF
// process data in cBuff
// write some stuff to port
IF ! OutChr( nHandle, cSomeStuff, Len( cSomeStuff ) )
MsgStop( 'Write error on COM Port.' )
Return FALSE
ENDIF
// ...etc
// and finally, when night is nigh...
// Close the port
UnInt_Port( nHandle )
Return NIL
HBCOMM.LIB não tem estas funçíµes.
Function Information:
Nx_port, Nbaud, Ndata, Nparity, Nstop, nBufferSize
Init_Port( cPort, nBaudrate, nDatabits, nParity, nStopbits,
nBuffersize ) -->
nHandle
Port opener and initializer.
Where:
cPort Port designator. Can either be old form 'COMn' or the more
general form '.COMn'. The general form is required for
ports higher than COM9.
nBaudrate Just like you're used to (e.g., 2400, 4800, 9600, etc. )
nDatabits Usually 8, but can be 7 or 4.
nParity coded: 0,1,2,3 -> none, odd, mark, even
nStopbits coded: 0,1,2 -> 1, 1.5, 2
nBuffersize I'm using 8000 at 38,400 baud.
nHandle returned instance identifier. A numeric >= 256. If nHandle
is negative, the open failed.
OutBufClr( nHandle ) --> lSuccess
Clear the output buffer. lSuccess will always be TRUE unless a bad
nHandle is used.
IsWorking( nHandle ) --> lSuccess
Check to see if port is operative. Failures can occur if a bad nHandle
is used or if remote party drops the line.
InChr( nHandle, nChar, @cBuff ) --> nBytesRead
Fetch data from the input buffer. Note the by reference argument
passing
for the buffer. nChar can be determined by calling InBufSize().
nBytesRead is the actual number of bytes loaded into cBuff (usually
equal to nChar unless there is a problem or nChar is overstated.)
InBufSize( nHandle ) --> nNumberofBytesInInputBuffer
Get the count of bytes waiting in the input buffer. Usually followed
by
a call to Inchr to fetch the bytes for processing.
OutChr( nHandle, cBytesToWrite, nCount ) --> lSuccess
Write the first nCount bytes from the string cBytesToWrite. Usually,
nCount == Len( cBytesToWrite ).
OutBufSize( nHandle ) --> nBytesInOutputBuffer
Get the byte count of characters awaiting transmission.
UnInt_Port( nHandle ) --> lSuccess
Uninitialize (Close) the port and free the handle.
SETHANDSHAKE(nhandle,nShake) ->lSet
Set the handshake to com port
values of nshake can be
EHandshakeUnknown = -1, // Unknown
EHandshakeOff = 0, // No handshaking
EHandshakeHardware = 1, // Hardware handshaking (RTS/CTS)
EHandshakeSoftware = 2, // Software handshaking (XON/XOFF)
EHANDSHAKEHARDWAREDTR = 3, // Hardware handshaking DTR On/RTS
off
EHANDSHAKEHARDWARERTS = 4 // Hardware handshaking DTR Off/RTS
on
ISCTS(handle) ->lCts
verify if cts event occured
USAGE:
Here's how I do this stuff...
STATIC nHandle
....Mainline...
IF OpenOk()
DOProcessing()
ELSE
MsgStop( 'Cannot open port!' )
QUIT
ENDIF
Function OpenOk()
// Open the port
IF ( nHandle := Init_Port( 'COM1', 9600, 8, 0, 0, 8000 ) ) > 0
OutBufClr( nHandle ) // Saw this somewhere...probably ok if unnecessary
Return IsWorking()
ENDIF
Return FALSE
Function DOProcessing()
....
// Get a chunk from the COM port
nChr := InBuffSize( nHandle )
cBuff := Space( nHandle )
IF nChr != InChr( nHandle, nChr, @cBuff)
MsgStop( 'Some kind of read failure on COM Port.' )
Return FALSE
ENDIF
// process data in cBuff
// write some stuff to port
IF ! OutChr( nHandle, cSomeStuff, Len( cSomeStuff ) )
MsgStop( 'Write error on COM Port.' )
Return FALSE
ENDIF
// ...etc
// and finally, when night is nigh...
// Close the port
UnInt_Port( nHandle )
Return NIL
HBCOMM com XAILER
Mário,
A versão que tenho aqui sempre usei com xHarbour + gtwvw + hwgui e nunca
tive esse problema...
Como faço para listar as funçíµes que estão na lib?
Será que essas funçíµes são de uma outra lib do xharbour?
Obrigado pela atenção,
Reginaldo
"Mário Angelini" <mario[at]emeasoft[dot]com[dot]br> escreveu na notícia da
mensagem:4dc99e6d$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Reginaldo:
> HBCOMM.LIB não tem estas funçíµes.
>
> Function Information:
> Nx_port, Nbaud, Ndata, Nparity, Nstop, nBufferSize
> Init_Port( cPort, nBaudrate, nDatabits, nParity, nStopbits,
> nBuffersize ) -->
> nHandle
>
> Port opener and initializer.
>
> Where:
>
> cPort Port designator. Can either be old form 'COMn' or the
> more
> general form '.COMn'. The general form is required for
> ports higher than COM9.
>
> nBaudrate Just like you're used to (e.g., 2400, 4800, 9600,
> etc. )
>
> nDatabits Usually 8, but can be 7 or 4.
>
> nParity coded: 0,1,2,3 -> none, odd, mark, even
>
> nStopbits coded: 0,1,2 -> 1, 1.5, 2
>
> nBuffersize I'm using 8000 at 38,400 baud.
>
> nHandle returned instance identifier. A numeric >= 256. If
> nHandle
> is negative, the open failed.
>
> OutBufClr( nHandle ) --> lSuccess
>
> Clear the output buffer. lSuccess will always be TRUE unless
> a bad
> nHandle is used.
>
> IsWorking( nHandle ) --> lSuccess
>
> Check to see if port is operative. Failures can occur if a
> bad nHandle
> is used or if remote party drops the line.
>
> InChr( nHandle, nChar, @cBuff ) --> nBytesRead
>
> Fetch data from the input buffer. Note the by reference
> argument
> passing
> for the buffer. nChar can be determined by calling
> InBufSize().
> nBytesRead is the actual number of bytes loaded into cBuff
> (usually
> equal to nChar unless there is a problem or nChar is
> overstated.)
>
> InBufSize( nHandle ) --> nNumberofBytesInInputBuffer
>
> Get the count of bytes waiting in the input buffer. Usually
> followed
> by
> a call to Inchr to fetch the bytes for processing.
>
> OutChr( nHandle, cBytesToWrite, nCount ) --> lSuccess
>
> Write the first nCount bytes from the string cBytesToWrite.
> Usually,
> nCount == Len( cBytesToWrite ).
>
> OutBufSize( nHandle ) --> nBytesInOutputBuffer
>
> Get the byte count of characters awaiting transmission.
>
> UnInt_Port( nHandle ) --> lSuccess
>
> Uninitialize (Close) the port and free the handle.
>
> SETHANDSHAKE(nhandle,nShake) ->lSet
> Set the handshake to com port
> values of nshake can be
> EHandshakeUnknown = -1, // Unknown
> EHandshakeOff = 0, // No handshaking
> EHandshakeHardware = 1, // Hardware handshaking (RTS/CTS)
> EHandshakeSoftware = 2, // Software handshaking (XON/XOFF)
> EHANDSHAKEHARDWAREDTR = 3, // Hardware handshaking DTR
> On/RTS
> off
> EHANDSHAKEHARDWARERTS = 4 // Hardware handshaking DTR
> Off/RTS
> on
>
>
> ISCTS(handle) ->lCts
> verify if cts event occured
> USAGE:
>
> Here's how I do this stuff...
>
> STATIC nHandle
>
> ...Mainline...
>
>
> IF OpenOk()
>
> DOProcessing()
>
> ELSE
>
> MsgStop( 'Cannot open port!' )
>
> QUIT
>
> ENDIF
>
> Function OpenOk()
>
> // Open the port
>
> IF ( nHandle := Init_Port( 'COM1', 9600, 8, 0, 0, 8000 ) ) >
> 0
>
> OutBufClr( nHandle ) // Saw this somewhere...probably ok if
> unnecessary
>
> Return IsWorking()
>
> ENDIF
>
> Return FALSE
>
> Function DOProcessing()
>
> ...
>
> // Get a chunk from the COM port
>
> nChr := InBuffSize( nHandle )
> cBuff := Space( nHandle )
>
> IF nChr != InChr( nHandle, nChr, @cBuff)
>
> MsgStop( 'Some kind of read failure on COM Port.' )
>
> Return FALSE
>
> ENDIF
>
> // process data in cBuff
>
> // write some stuff to port
>
> IF ! OutChr( nHandle, cSomeStuff, Len( cSomeStuff ) )
>
> MsgStop( 'Write error on COM Port.' )
>
> Return FALSE
>
> ENDIF
>
> // ...etc
>
> // and finally, when night is nigh...
>
> // Close the port
>
> UnInt_Port( nHandle )
>
> Return NIL
>
> --
> Saludos!
> Mário Angelini
> http://www.eMeAsOfT.com
> http://emeasoft.blogspot.com/
> http://twitter.com/emeasoft
>
> http://bit.ly/ci22sm
> http://www.brasilturismo.com/brasil/
A versão que tenho aqui sempre usei com xHarbour + gtwvw + hwgui e nunca
tive esse problema...
Como faço para listar as funçíµes que estão na lib?
Será que essas funçíµes são de uma outra lib do xharbour?
Obrigado pela atenção,
Reginaldo
"Mário Angelini" <mario[at]emeasoft[dot]com[dot]br> escreveu na notícia da
mensagem:4dc99e6d$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Reginaldo:
> HBCOMM.LIB não tem estas funçíµes.
>
> Function Information:
> Nx_port, Nbaud, Ndata, Nparity, Nstop, nBufferSize
> Init_Port( cPort, nBaudrate, nDatabits, nParity, nStopbits,
> nBuffersize ) -->
> nHandle
>
> Port opener and initializer.
>
> Where:
>
> cPort Port designator. Can either be old form 'COMn' or the
> more
> general form '.COMn'. The general form is required for
> ports higher than COM9.
>
> nBaudrate Just like you're used to (e.g., 2400, 4800, 9600,
> etc. )
>
> nDatabits Usually 8, but can be 7 or 4.
>
> nParity coded: 0,1,2,3 -> none, odd, mark, even
>
> nStopbits coded: 0,1,2 -> 1, 1.5, 2
>
> nBuffersize I'm using 8000 at 38,400 baud.
>
> nHandle returned instance identifier. A numeric >= 256. If
> nHandle
> is negative, the open failed.
>
> OutBufClr( nHandle ) --> lSuccess
>
> Clear the output buffer. lSuccess will always be TRUE unless
> a bad
> nHandle is used.
>
> IsWorking( nHandle ) --> lSuccess
>
> Check to see if port is operative. Failures can occur if a
> bad nHandle
> is used or if remote party drops the line.
>
> InChr( nHandle, nChar, @cBuff ) --> nBytesRead
>
> Fetch data from the input buffer. Note the by reference
> argument
> passing
> for the buffer. nChar can be determined by calling
> InBufSize().
> nBytesRead is the actual number of bytes loaded into cBuff
> (usually
> equal to nChar unless there is a problem or nChar is
> overstated.)
>
> InBufSize( nHandle ) --> nNumberofBytesInInputBuffer
>
> Get the count of bytes waiting in the input buffer. Usually
> followed
> by
> a call to Inchr to fetch the bytes for processing.
>
> OutChr( nHandle, cBytesToWrite, nCount ) --> lSuccess
>
> Write the first nCount bytes from the string cBytesToWrite.
> Usually,
> nCount == Len( cBytesToWrite ).
>
> OutBufSize( nHandle ) --> nBytesInOutputBuffer
>
> Get the byte count of characters awaiting transmission.
>
> UnInt_Port( nHandle ) --> lSuccess
>
> Uninitialize (Close) the port and free the handle.
>
> SETHANDSHAKE(nhandle,nShake) ->lSet
> Set the handshake to com port
> values of nshake can be
> EHandshakeUnknown = -1, // Unknown
> EHandshakeOff = 0, // No handshaking
> EHandshakeHardware = 1, // Hardware handshaking (RTS/CTS)
> EHandshakeSoftware = 2, // Software handshaking (XON/XOFF)
> EHANDSHAKEHARDWAREDTR = 3, // Hardware handshaking DTR
> On/RTS
> off
> EHANDSHAKEHARDWARERTS = 4 // Hardware handshaking DTR
> Off/RTS
> on
>
>
> ISCTS(handle) ->lCts
> verify if cts event occured
> USAGE:
>
> Here's how I do this stuff...
>
> STATIC nHandle
>
> ...Mainline...
>
>
> IF OpenOk()
>
> DOProcessing()
>
> ELSE
>
> MsgStop( 'Cannot open port!' )
>
> QUIT
>
> ENDIF
>
> Function OpenOk()
>
> // Open the port
>
> IF ( nHandle := Init_Port( 'COM1', 9600, 8, 0, 0, 8000 ) ) >
> 0
>
> OutBufClr( nHandle ) // Saw this somewhere...probably ok if
> unnecessary
>
> Return IsWorking()
>
> ENDIF
>
> Return FALSE
>
> Function DOProcessing()
>
> ...
>
> // Get a chunk from the COM port
>
> nChr := InBuffSize( nHandle )
> cBuff := Space( nHandle )
>
> IF nChr != InChr( nHandle, nChr, @cBuff)
>
> MsgStop( 'Some kind of read failure on COM Port.' )
>
> Return FALSE
>
> ENDIF
>
> // process data in cBuff
>
> // write some stuff to port
>
> IF ! OutChr( nHandle, cSomeStuff, Len( cSomeStuff ) )
>
> MsgStop( 'Write error on COM Port.' )
>
> Return FALSE
>
> ENDIF
>
> // ...etc
>
> // and finally, when night is nigh...
>
> // Close the port
>
> UnInt_Port( nHandle )
>
> Return NIL
>
> --
> Saludos!
> Mário Angelini
> http://www.eMeAsOfT.com
> http://emeasoft.blogspot.com/
> http://twitter.com/emeasoft
>
> http://bit.ly/ci22sm
> http://www.brasilturismo.com/brasil/
HBCOMM com XAILER
Reginaldo:
Uso Explorer Lib para ler as funçíµes de uma LIB.
Examinei HBCOMM.LIB conforme imagem anexa e tem
as funçíµes sim.
Efetuei testes com elas mas elas não aceitam parí¢metros.
Experimente:
MsgInfo( SETDTR )
MsgInfo( SETDTR() ) // aqui dá erro
Attached files
Uso Explorer Lib para ler as funçíµes de uma LIB.
Examinei HBCOMM.LIB conforme imagem anexa e tem
as funçíµes sim.
Efetuei testes com elas mas elas não aceitam parí¢metros.
Experimente:
MsgInfo( SETDTR )
MsgInfo( SETDTR() ) // aqui dá erro
Attached files