Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:00 24 Nov 2024 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 : Printing the current firmware version

Author Message
BobDevries

Senior Member

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

Here's a short MMBASIC subroutine to print the current firmware version.

Call it using GOSUB 10000 and then PRINT version$


10000 ver$=STR$(MM.VER)
10010 verpos=INSTR(ver$,".")
10020 ver1$=LEFT$(ver$,verpos-1)
10030 ver2$=MID$(ver$,verpos+1,2)
10040 ver3$=RIGHT$(ver$,LEN(ver$)-verpos)
10050 ver4$=STR$(VAL(LEFT$(ver3$,2)))
10060 ver5=VAL(RIGHT$(ver3$,2)):IF ver5<>0 THEN ver5$=CHR$(ver5+64)
10070 version$=ver1$+"."+ver4$+ver5$
10080 RETURN


I'm sure others have already done this, but hey, I thought I'd share mine. I'm sure it could be done more elegantly, but this is my version$ :)

regards,
Bob Devries
Dalby, QLD, Australia
 
Print this page


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

© JAQ Software 2024