QB64 Phoenix Edition
Coms port and RAM disk - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: Coms port and RAM disk (/showthread.php?tid=2484)



Coms port and RAM disk - Willi Grundmann - 03-05-2024

Hi to everyone,

I am new to QB64PE but have used a previous version of QB64 and Inform before. Over the decades I also have used QB45 for many projects.

I am retired now and am investigating the suitability of QB64PE and Inform-PE for a hobby project. I would like to find out the following.

Coms Port: Is it possible to communicate via a serial coms port? The old QB45 required a coms port on the mother boards. New computers do not have serial coms ports anymore. Would a USB based coms port adapter work with QB64PE? Code examples are very appreciated.

The version of Inform, which I used before only allowed to set up one window. For my hobby project, I would need several windows. Can the latest version of Inform do more than one window? If not then I would like to exchange data between the programs of several windows  either via files on the HDD or a RAM disk. Any reply and advice on this topic is greatly appreciated.

Best Regards

Willi


RE: Coms port and RAM disk - mdijkens - 03-05-2024

Yes, serial adapters over usb work fine in QB64pe.
Below the functions I created for this

Code: (Select All)
Errhandler: ' needed for ser.open% (ser$)
errorNum = Err: Resume Next

Function ser.open% (ser$)
  On Error GoTo Errhandler
  Open ser$ + ",N,8,1,BIN,CS0,DS0,RB8192" For Random As #88
  If errorNum = 0 Then serBytes$ = ser.read$
  On Error GoTo 0
  ser.open% = errorNum
End Function

Function ser.close$ ()
  ser.close$ = ser.read$
  Close #88
End Function

Sub ser.send (bytes$)
  Dim b As String * 1
  For i% = 1 To Len(bytes$)
    b = Mid$(bytes$, i%, 1)
    Put #88, , b
  Next i%
End Sub

Function ser.read$ ()
  Dim b As String * 1: resp$ = ""
  Do While Loc(88)
    Get #88, , b: resp$ = resp$ + b
  Loop
  ser.read$ = resp$
End Function



RE: Coms port and RAM disk - Pete - 03-05-2024

Also some TCP/IP stuff to check out in the wiki:

https://qb64phoenix.com/qb64wiki/index.php/OPENHOST

https://qb64phoenix.com/qb64wiki/index.php/Inter-Program_Data_Sharing_Demo

https://www.tapatalk.com/groups/qbasic/viewtopic.php?p=214167#p214167

Pete


RE: Coms port and RAM disk - RhoSigma - 03-05-2024

(03-05-2024, 03:01 AM)Willi Grundmann Wrote: The version of Inform, which I used before only allowed to set up one window. For my hobby project, I would need several windows. Can the latest version of Inform do more than one window? If not then I would like to exchange data between the programs of several windows  either via files on the HDD or a RAM disk. Any reply and advice on this topic is greatly appreciated.

If you're working on a Windows system, the GuiTools Framework could be used. It has easy to use multi-windows support as shown in the Multi Windows Demo.

Willi Grundmann sounds german, also kann ich auch in deutsch Hilfestellung geben, wenn erforderlich. Big Grin