Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lakeshore 218 Temperature Monitor
#8
I find your code a bit difficult to read (please use more subs/functions) Smile

QB64 has some unreliable behaviour with serial, but some (proven) serial functions I wrote and use are here:
Code: (Select All)
Errhandler: ' 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
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
Reply


Messages In This Thread
Lakeshore 218 Temperature Monitor - by CJAlva - 09-15-2022, 03:46 PM
RE: Lakeshore 218 Temperature Monitor - by Pete - 09-15-2022, 04:46 PM
RE: Lakeshore 218 Temperature Monitor - by CJAlva - 09-15-2022, 05:55 PM
RE: Lakeshore 218 Temperature Monitor - by bplus - 09-15-2022, 05:43 PM
RE: Lakeshore 218 Temperature Monitor - by CJAlva - 09-15-2022, 06:32 PM
RE: Lakeshore 218 Temperature Monitor - by mdijkens - 09-15-2022, 06:02 PM
RE: Lakeshore 218 Temperature Monitor - by Pete - 09-15-2022, 07:40 PM
RE: Lakeshore 218 Temperature Monitor - by Pete - 09-15-2022, 08:27 PM



Users browsing this thread: 2 Guest(s)