![]() |
Forum Index : Microcontroller and PC projects : Open # Error
Author | Message | ||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
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: AustraliaPosts: 6283 |
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 ZealandPosts: 711 |
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: AustraliaPosts: 3292 |
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 ZealandPosts: 711 |
Thanks Geoff |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
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 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |