ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
  • Miscellaneous
  • Features specific to Android and Android widget
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
Reads a character string in the entry buffer of the specified serial port. The port must be opened beforehand (sOpen).
Remarks:
  • This function cannot be used with a parallel port.
  • AndroidAndroid Widget Only serial ports are supported.
Example
Syntax

Reading a number of bytes and retrieving a string Hide the details

<Result> = sRead(<Port number> , <Number of bytes to read>)
<Result>: Character string
  • Character string read in the entry buffer,
  • 0 if the read operation was not performed.
<Port number>: Integer
  • Number of the relevant serial port: 1, 2, 3, ... 32 for COM1, COM2, COM3, ... COM32.
  • Identifier of the serial port returned by sOpen (if this function was called with a serial port name).
    AndroidAndroid Widget Only this type of parameter is available.
<Number of bytes to read>: Integer
Number of bytes to read in the entry buffer of the serial port. The number of bytes to read is returned by sInEntryQueue.
Remarks

Miscellaneous

  • sOpen has no effect if the port was not opened by sRead.
  • sRead clears the input queue of bytes actually read.
  • A 32-bit application is locked during the duration of the transfer. To avoid this lock, the timeout between two read operations must be specified in sOpen. If the timeout is reached and the data could not be read, sRead returns 0.
  • WLanguage does not allow you to manage the control signals.
  • The time to wait for a character to be read or written is specified with sOpen.
    • If this time is set to 1s when reading 1024 bytes, the waiting time will be 1024s.
    • New in version 28
      If this time is set to "-1s" when reading 1024 bytes, the waiting time will be 1s.
    This prevents lock problems when reading from or writing to the print port.
AndroidAndroid Widget

Features specific to Android and Android widget

In Android and Android widget mode, the serial and parallel port functions can be used:
  • Only on serial (not parallel or infrared) ports.
  • Only with devices that support the CDC/ACM protocol (Arduino ATmega32U4) and the following USB to serial converter chips:
    • FTDI FT232R, FT232H, FT2232H, FT4232H, FT230X, FT231X, FT234XD
    • Silabs CP210x
    • Qinheng CH340, CH341A
    • Prolific PL2303
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