PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Defines or modifies the parameters for configuring the specified serial port, parallel port or infrared port. This setting is optional.
The default values are as follows:
  • Transfer rate: 9600 Bauds
  • Parity: None
  • 8 data bits
  • 1 stop bit
Caution: The setting for two linked computers must be identical.
Remarks:
  • The port must be opened (sOpen) before the call to sParameter. sOpen automatically initializes the serial port.
Example
NumPort = sOpen("COM1", 2000, 2000) // Ouverture de COM1
IF NumPort <> 0 THEN
// Paramétrage Com1: Taux 9600, Parité paire,
// 8 bits de données, 1 bit de stop
IF sParameter(NumPort, 9600, 1, 8, 0) THEN // Paramétrage de COM1
// Suite traitement...
ELSE
Error("Erreur de configuration de COM1", ErrorInfo(errFullDetails))
END
sClose(NumPort) // Fermeture de COM1
ELSE
Error("Erreur d'ouverture de COM1", ErrorInfo(errFullDetails))
END
Syntax
<Result> = sParameter(<Port number> , <Rate> , <Parity> , <Nb Data Bits> , <Nb Stop Bits> [, <DTR/DSR> [, <RTS/CTS> [, <XON/XOFF>]]])
<Result>: Boolean
  • True if the parameters have been initialized properly,
  • False otherwise. HErrorInfo returns more details.
Remark: sParameter has no effect if the port was not opened beforehand (by sOpen).
<Port number>: Integer
Identifier of the port used:
  • Port number:
    • Number of the serial port: 1, 2, 3, ... 32 for COM1, COM2, COM3, ... COM32.
    • Number of the parallel port: -1, -2, -3 or -4 for LPT1, LPT2, LPT3 or LPT4.
    • Number of the infrared port: 1, 2, 3, ... 32 for IR1, IR2, IR3, ... IR32.
  • Port identifier returned by sOpen (if this function was called with a port name).
<Rate>: Integer
Rate of data transfer (expressed in Bauds or Bits per second).
<Parity>: Integer
Parity of the transfer:
0No parity
1Even parity
2Odd parity
<Nb Data Bits>: Integer
Number of bits per character: 4, 5, 6, 7 or 8.
<Nb Stop Bits>: Integer
Number of stop bits:
01 stop bit
11.5 stop bits
22 stop bits
<DTR/DSR>: Optional integer
  • 0 (or False, default value) if the DTR/DSR protocol must be ignored and if it should be in "active" mode.
  • 1 (or True) if the DTR/DSR protocol must be in "Handshake" mode,
  • 2 if the DTR/DSR protocol must be ignored and if it should be in "inactive" mode.
    For more details, see the documentation for managing communication ports.
<RTS/CTS>: Optional integer
  • 0 (or False, default value) if the RTS/CTS protocol must be ignored and if it should be in "active" mode.
  • 1 (or True) if the RTS/CTS protocol must be in "Handshake" mode,
  • 2 if the RTS/CTS protocol must be ignored and if it should be in "inactive" mode.
    For more details, see the documentation for managing communication ports.
<XON/XOFF>: Optional boolean
  • True if the XON/XOFF protocol must be taken into account,
  • False (default value) if this protocol must be ignored.
Remarks
Business / UI classification: Business Logic
Component: wd280com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
exemplo
sClose(EDT_Porta_COM)
// Open COM (using the port number)
// sOpen(Porta,SizeInBuffer,SizeOutBuffer,Timeout,ManagerEvents)
LineCom is boolean = sOpen(EDT_Porta_COM, EDT_Buffer_de_Entrada, EDT_Buffer_de_Saida)

IF LineCom = True THEN
// Configure COM1: Rate 9600, even parity,
// 8 data bits, 1 stop bit
//sParameter()
LineCom = sParameter(EDT_Porta_COM, EDT_Bit_por_segundos, EDT_Paridade, EDT_Bit_de_Dados, EDT_Bit_de_Parada)
// Rest of process...
EDT_Historico += sRead(EDT_Porta_COM,EDT_Buffer_de_Entrada) + CR + CR

EDT_Historico += sWrite(EDT_Porta_COM,EDT_Comando_AT) + CR + CR

EDT_Historico += sRead(EDT_Porta_COM,EDT_Buffer_de_Entrada) + CR + CR
// Close COM1
sClose(EDT_Porta_COM)
ELSE
Error("Error while opening COM"+EDT_Porta_COM)
END




Boller
20 May 2022