Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:55 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Open # Error

Author Message
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 10:22pm 06 Sep 2015
Copy link to clipboard 
Print this post

Hi

I am not sure if this is a bug or have I missed something
Could somebody please try the code below and see if they get an error
after the 1st pass. As you can see the #1 is never closed but it seems the
close #2 closes all open ports / files

"[19] Do : Loop Until Input$(255, #1) = ""
Error: File number is not open"

I have attached the file that is read from the SD card


Open "Com1:38400, 20480" As #1

Start:
Clearbuffer

Open "icons1.dat" For Input As #2
For I = 1 To 38
Line Input #2, Test$
Print Test$
Next I

Close #2

Goto Start


' Clear the serial input buffer
Sub ClearBuffer
Do : Loop Until Input$(255, #1) = ""
End Sub


2015-09-07_082000_icons1.zip
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 10:40pm 06 Sep 2015
Copy link to clipboard 
Print this post

It was too difficult for me to get access to the SD card so I opened a file that was on it.
Didn't have any text files so I just did a pause after opening.

This was run OK on a uM+ with beta23

Open "Com1:38400, 20480" As #1

Start:
Clearbuffer

Open "img_20~1.jpg" For Input As #2
pause 2000

Close #2

Goto Start


' Clear the serial input buffer
Sub ClearBuffer
Do : Loop Until Input$(255, #1) = ""
print "OK"
End Sub


Jim
VK7JH
MMedit
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 07:31pm 07 Sep 2015
Copy link to clipboard 
Print this post

Hi

Ok more weird stuff

If I run the code below it stops with a = 1
no changes type run again and it works fine
So some thing odd going on here

> run
1
[20] Do : Loop Until Input$(255, #1) = ""
Error: File number is not open
> run
1
2
3
4
5
6
>


Open "Com1:38400, 20480" As #1

Start:
Clearbuffer

Open "icons1.dat" For Input As #2
Pause 500
Close #2

A=A+1

Print A

GoTo Start


' Clear the serial input buffer
Sub ClearBuffer
Do : Loop Until Input$(255, #1) = ""
End Sub



Any Help appreciated

Jman
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 07:44pm 07 Sep 2015
Copy link to clipboard 
Print this post

John, I plan to test this when I rebuild my test setup. It may take a few days.

Geoff
Geoff Graham - http://geoffg.net
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 07:53pm 07 Sep 2015
Copy link to clipboard 
Print this post

Thanks Geoff

 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 10:45pm 19 Sep 2015
Copy link to clipboard 
Print this post

Finally I found it.

It was very subtle, this just shows the benefit of beta testers playing with early versions as I would never have found it normally. It depended on the sequence that the COM ports and files were opened. Thanks also for an excellent demo of the fault, that helped enormously.

The fix will also be in the next publicly released beta.

Geoff
Geoff Graham - http://geoffg.net
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025