1Jan

Purebasic Serial Port Example

1 Jan 2000admin
Purebasic Serial Port Example Average ratng: 8,7/10 9554 reviews

OpenConsole() Com = OpenSerialPort(#PB_Any, 'COM1', 1200, #PB_SerialPort_NoParity, 7, 2, #PB_SerialPort_NoHandshake, 64, 64) If Com Buffer$ = Space(14) WriteSerialPortString(Com, 'D', #PB_Ascii) ReadSerialPortData(Com, @Buffer$, 14) PrintN(Buffer$) CloseSerialPort(Com) EndIfBut it is without any checking and without a timeout! (like the QB-Program) And you have to compile it as console program (like the QB program) Bernd P.S.: for a timeout use AvailableSerialPortInput() to check if something is arrived. #Version = '1.00' Procedure Logging(Text$) Protected File File = OpenFile(#PB_Any, ReplaceString(ProgramFilename(), '.exe', '.csv')) If File FileSeek(File, Lof(File)) WriteStringN(File, #DQUOTE$ + FormatDate('%yyyy%mm%dd%yy%ii%ss', Date()) + #DQUOTE$ + ';' + #DQUOTE$ + Text$ + #DQUOTE$) EndIf EndProcedure Com = OpenSerialPort(#PB_Any, 'COM1', 1200, #PB_SerialPort_NoParity, 7, 2, #PB_SerialPort_NoHandshake, 64, 64) If Not Com MessageRequester('Error', 'Can not open COM port!'

Apr 11, 2018 - Library for use of COM objects in PureBasic, an example for using the ADODB object for accessing databases is included. The DX9 Subsystem. Objectdock stack docklet.