AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de Windows / Funciones de puertos serie y paralelo
  • Closing the port after a read or write operation
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Closes the specified serial port, parallel port or infrared port.
Remarks:
  • A port must be closed as soon as it is no longer used.
  • Linux Only serial ports are supported.
  • WEBDEV - Código Servidor This function affects the server.
Ejemplo
PortNum is int
PortNum = sOpen("COM1", 2000, 2000) // Open COM1
IF PortNum <> 0 THEN
	// COM1 settings: 9600 rate, even parity, 
	// 8 data bits, 1 stop bit
	sParameter(PortNum, 9600, 1, 8, 0)
	// Rest of process...
	sClose(PortNum) // Close COM1
ELSE
	Error("Error while opening COM1")
END
Sintaxis
sClose(<Port number>)
<Port number>: Integer
Identifier of the port used:
  • Port number:
    • Serial port number: 1, 2, 3, ... 32 for COM1, COM2, COM3, ... COM32.
    • Parallel port number: -1, -2, -3 or -4 for LPT1, LPT2, LPT3 or LPT4.
    • Infrared port number: 1, 2, 3, ... 32 for IR1, IR2, IR3, ... IR32.
  • Port identifier returned by sOpen (if this function was called with a port name).
    Linux Only this type of parameter is available.
Observaciones

Closing the port after a read or write operation

If sClose is run just after sWrite or sRead, some characters may not be written or read. Indeed, sClose can close the port before all the characters are written or read. To avoid this behavior, use Multitask.
Res = sOpen("COM2", 2000, 2000)
IF Res <> 0 THEN
	sParameter(Res, 9600, 0, 8, 0)
	sWrite(Res, Str)
	Multitask()
	sClose(Res)
END
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300com.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local