Author Topic: Unhandled Error #62  (Read 3083 times)

0 Members and 1 Guest are viewing this topic.

Offline RespTest

  • Newbie
  • Posts: 1
    • View Profile
Unhandled Error #62
« on: August 26, 2020, 09:52:34 am »
Hello Everyone,

I'm curious if someone might be able to help me with my issue.
I should preface with I have very little programming experience, especially in BASIC and that I did not write the program.

We're using a small BASIC program to read data from a Serial RS232 port and output it into a notepad file.
The program in question works fine in QB45, but does not in QB64.
We're dependant on QB64 now since upgrading one of our computers to windows 10.

In QB45 it runs fine, but in QB64 we've run into "Unhandled Error#62 Line:29 (in main module) Input past end of file Continue?."
Attempting to continue runs the error in a loop and selecting "no" closes it out.
I have noticed that if the serial port is outputting a constant stream of data and then the program is run it can collect the data, but it will not sit and wait for data to be streamed to it (this is what we need and this is how it works in QB45).

Thank you in advance for any and all suggestions and assistance.
If you need any other information regarding the problem please don't hesitate to ask.
In the effort of transparency this is in regards to a commercial endeavor so if this is unacceptable based on forum guidelines I apologize and I'll gladly delete the posting.
Thanks again.

Code: QB64: [Select]
  1. REM Serial Program
  2.  
  3.  
  4. OUT 1021, 96
  5. Y$ = ""
  6.  
  7. OPEN "COM3:9600,O,7,1,RS0,DS0,BIN,CD0,CS0" FOR INPUT AS #1
  8.  
  9. PRINT " Welcome To Primative Programming Solutions"
  10. PRINT " Where The Soft-Ware Past Comes Alive In ALL Its Splendor"
  11. PRINT "The data will be saved in a text file in the C:\TSIDATA\ folder. "
  12. PRINT "Type in the file name to which you wish the data saved "
  13. INPUT "and press <ENTER> (maximum of eight characters).    ", filename$
  14. PRINT "The data will be stored in:  C:\Users\Labuser\Desktop\TSI QuickBasic\TSIDATA\"; filename$; ".txt"
  15. OPEN "C:\Users\Labuser\Desktop\TSI QuickBasic\TSIDATA\" + filename$ + ".txt" FOR OUTPUT AS #4
  16. PRINT "To Stop Aquiring Data Press:  <SHIFT><Q> "
  17. PRINT "Data has begun to be acquired."
  18.  
  19.  
  20. WHILE Y$ <> "Q"
  21.  
  22.     INPUT #1, A$
  23.  
  24.     PRINT A$
  25.  
  26.     PRINT #4, A$
  27.  
  28.     Y$ = INKEY$
  29.  
  30.  
  31. PRINT " The program has stopped collecting data."
  32.  
  33.  

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Unhandled Error #62
« Reply #1 on: August 26, 2020, 10:32:22 am »
Let me preface this by stating that I know nothing whatsoever of device/port interfacing, but just looking over the code, I get the impression that accessing a port is being treated as a file input? I also see the use of OUT, and looked it up on the wiki. The reference to line 29 (#1 file) suggests that QB64 doesn't like it in some fashion. Maybe this can address some of your issues...or at least give some insights into the differences in behaviour between the old and the new.

http://www.qb64.org/wiki/Port_Access_Libraries

The cavalry should be along soon, I'm just an mule skinner moseyin' through. Good luck.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Unhandled Error #62
« Reply #2 on: August 26, 2020, 11:37:15 am »
I'd say you might want to look at this wiki page:
https://www.qb64.org/wiki/OPEN_COM
I know very little about opening a COM port. I had managed to make a dial up modem work partially in QB64 but that's been several months and I've lost the source. Something I noticed on that Wiki page is that they all used GET and PUT rather than INPUT.

Maybe try it like this?

Code: QB64: [Select]
  1. REM Serial Program
  2.  
  3.  
  4. OUT 1021, 96
  5. Y$ = ""
  6.  
  7. OPEN "COM3:9600,O,7,1,RS0,DS0,BIN,CD0,CS0" FOR RANDOM AS #1
  8.  
  9. PRINT " Welcome To Primative Programming Solutions"
  10. PRINT " Where The Soft-Ware Past Comes Alive In ALL Its Splendor"
  11. PRINT "The data will be saved in a text file in the C:\TSIDATA\ folder. "
  12. PRINT "Type in the file name to which you wish the data saved "
  13. INPUT "and press <ENTER> (maximum of eight characters).    ", filename$
  14. PRINT "The data will be stored in:  C:\Users\Labuser\Desktop\TSI QuickBasic\TSIDATA\"; filename$; ".txt"
  15. OPEN "C:\Users\Labuser\Desktop\TSI QuickBasic\TSIDATA\" + filename$ + ".txt" FOR OUTPUT AS #4
  16. PRINT "To Stop Aquiring Data Press:  <SHIFT><Q> "
  17. PRINT "Data has begun to be acquired."
  18.  
  19.  
  20. WHILE Y$ <> "Q"
  21.  
  22.     GET #1, A$
  23.  
  24.     PRINT A$
  25.  
  26.     PRINT #4, A$
  27.  
  28.     Y$ = INKEY$
  29.  
  30.  
  31. PRINT " The program has stopped collecting data."
  32.  
« Last Edit: August 26, 2020, 11:41:36 am by SpriggsySpriggs »
Shuwatch!