Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:02 12 May 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 : Can’t capture a BMP image.

Author Message
aargee
Senior Member

Joined: 21/08/2008
Location: Australia
Posts: 255
Posted: 12:16am 20 Sep 2011
Copy link to clipboard 
Print this post

Geoff,

I can't seem to capture a BMP image with the SAVEBMP command. It reports that the file is already open (sorry, can't remember the exact text), even when I use different file names for the first time.

I've checked the syntax several times and it seems OK.

I'm using version 2.6 with Com. Port 1 running at 19k2 into a VGA monitor.

Can someone try it out and post the piece of code if it works?

Thanks,

Rob.

For crying out loud, all I wanted to do was flash this blasted LED.
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 12:31am 20 Sep 2011
Copy link to clipboard 
Print this post

Aargee,

I used this code snippet:


10 OPEN "COM1:19200" AS #5
20 CLS
30 CIRCLE(50,50),10
40 SAVEBMP"COMTEST"
50 CLOSE #5


That works fine, no errors.

Regards,

Bob Devries
Dalby, QLD, Australia
 
aargee
Senior Member

Joined: 21/08/2008
Location: Australia
Posts: 255
Posted: 01:33am 20 Sep 2011
Copy link to clipboard 
Print this post

Aah, might have spotted the problem, I'm putting a space between SAVEBMP and "filename" (the manual shows a space as well?)

I'll give it a go when I get home tonight.

Thanks, Bob.

- Rob.


For crying out loud, all I wanted to do was flash this blasted LED.
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 02:25am 20 Sep 2011
Copy link to clipboard 
Print this post

Aargee,

I tried that with a space between SAVEBMP and the filename, but still no error.

Can you post some code to show what you're doing? Someone else may notice a flaw?

Regards,
Bob Devries
Dalby, QLD, Australia
 
aargee
Senior Member

Joined: 21/08/2008
Location: Australia
Posts: 255
Posted: 07:49am 20 Sep 2011
Copy link to clipboard 
Print this post

Hmm, I don't know if it is a bug, but I had the com port open as #1 and it errors.

If I use Com port as #5 all is well!?

The manual uses #1 as an example of Com port usage but it must interfere with the BMP storage routine.

Geoff - is it a bug?

- Rob.


For crying out loud, all I wanted to do was flash this blasted LED.
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 08:22am 20 Sep 2011
Copy link to clipboard 
Print this post

opening the com port as #1 or #2 generates the file open error, #3 and #5 work ok on mine.
Anthony,
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 08:48am 20 Sep 2011
Copy link to clipboard 
Print this post

I can confirm that problem. I changed my snippet to use #1, and kablooie!

Error line 40: File number is already open

In my view, any internal command (such as SAVEBMP) should not use a file number that's usable by user programmes.

My $0.02 + GST

Regards,

Bob Devries
Dalby, QLD, Australia
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3270
Posted: 01:15pm 20 Sep 2011
Copy link to clipboard 
Print this post

Ah, another bug found and squashed!
Thanks everyone, that was a subtle bug indeed.

The SAVEBMP does a scan of the file table to find a free file number... and got it wrong. I have fixed it and the fix will appear in the next version, until then the workaround is to avoid using the file numbers #1 or #2 if you are also using the SAVEBMP command.

This really illustrates how hard it is to test for bugs these days. The bug only occurred in rare circumstances and I never thought to test the command with a range of different file numbers open at the same time.

Geoff
Geoff Graham - http://geoffg.net
 
aargee
Senior Member

Joined: 21/08/2008
Location: Australia
Posts: 255
Posted: 08:49pm 20 Sep 2011
Copy link to clipboard 
Print this post

Thanks, Geoff, glad we could help !!


For crying out loud, all I wanted to do was flash this blasted LED.
 
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