Consulta sobre OpenComm()

Post Reply
fernandomoralesdr
Posts: 134
Joined: Sun Apr 23, 2006 9:00 am

Consulta sobre OpenComm()

Post by fernandomoralesdr »

Hola a todos.

Estoy intentando conectar con un puerto serie para recibir datos. Me he encontrado esta función en un programa de ejemplo. El primer parámetro lo tengo claro, pero los otros dos no (1024 y 128), ¿puede alguien decirme qué significan y si son obligatorios y opcionales)

nComm := OpenComm( "COM5", 1024, 128 )

Gracias por adelantado,
Fernando
Las Palmas de Gran Canaria
Un saludo,
Fernando
Las Palmas de Gran Canaria
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Consulta sobre OpenComm()

Post by carlos vargas »

del archivo de ayuda func.chm
OpenComm()

Open the communication port to start using it

Syntax:
OpenComm( <cCommName> [,<nSizeIn>] [,<nSizeOut>] ) --> nIdComm

Parameters:
<cCommName> The name of the comm device to open in a format like "COM" + N or "LPT" + N
<nSizeIn> The size in bytes of the receiving queue. This parameter is ignored for "LPT" devices. By default FiveWin assigns 1024.
<nSizeOut> The size in bytes of the transmission queue. This parameter is ignored for "LPT" devices. By default FiveWin assigns 128.

Returns:

<nIdComm> A numeric identifier for that opened device. 0 if there was an error.

If the function fails, it may return one of the following error values:

Value Meaning
IE_BADID The device identifier is invalid or unsupported.
IE_BAUDRATE The device's baud rate is unsupported.
IE_BYTESIZE The specified byte size is invalid.
IE_DEFAULT The default parameters are in error.
IE_HARDWARE The hardware is not available (is locked by another device).
IE_MEMORY The function cannot allocate the queues.
IE_NOPEN The device is not open.
IE_OPEN The device is already open.

If this function is called with both queue sizes set to zero, the return value is IE_OPEN if the device is already open or IE_MEMORY if the device is not open.indows allows COM ports 1 through 9 and LPT ports 1 through 3. If the device driver does not support a communications port number, the OpenComm function will fail.

The communications device is initialized to a default configuration. The SetCommState function should be used to initialize the device to alternate values. The receiving and transmission queues are used by interrupt-driven device drivers. LPT ports are not interrupt driven--for these ports, the cbInQueue and cbOutQueue parameters are ignored and the queue size is set to zero.

Sample:
SAMPLES\\TestComm.prg

Source Code:
SOURCE\\WINAPI\\Comm.c

See also:
CloseComm() WriteComm() ReadComm() BuildCommDcb() SetCommState() FlushComm() GetCommError()
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
fernandomoralesdr
Posts: 134
Joined: Sun Apr 23, 2006 9:00 am

Re: Consulta sobre OpenComm()

Post by fernandomoralesdr »

Carlos, muchas gracias por tu pronta respuesta y haberme aclarado el tema.
Una pregunta: ¿dónde se encuentra ese archivo func.chm al que haces referencia? He estado buscando el los directorios de FWH y Harbour y no lo veo.
Un saludo,
Fernando
Las Palmas de Gran Canaria
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Consulta sobre OpenComm()

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Consulta sobre OpenComm()

Post by carlos vargas »

Image
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
fernandomoralesdr
Posts: 134
Joined: Sun Apr 23, 2006 9:00 am

Re: Consulta sobre OpenComm()

Post by fernandomoralesdr »

Carlos y Antonio, muchas gracias de nuevo.
Un saludo,
Fernando
Las Palmas de Gran Canaria
Post Reply