Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:39 28 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 : TFT-MM Running from Drive A:

Author Message
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 05:19pm 25 Nov 2013
Copy link to clipboard 
Print this post

Good afternoon all..!

I wanted to start some discussion on the topic of creating a full application for the TFT Maximite. I have been trying out a few things to get started in the right direction, and wanted to bounce a few ideas off everyone to see if I am thinking correctly about how to get this done...

System Turn-on:

When power is applied, the user of this system may, or may not have inserted the SD card into the unit. I intend to have the units main application code and all related files stored and "live" on drive B:. However, if the SD card is not there, the AutoRun program stored on drive A: will be started. This will be a simple startup program that shows a "splash" BMP logo image, then will check things like the RTC and SD card. Checking for the RTC chip should be easy, but the SD card could be a little more tricky to do. Anyway, if the SD card is not there, we need to prompt the user to insert the SD card into the unit, detect when the user has done so, and then somehow "pop a system restart" to start the discovery process all over again...

Observation: If you have an autorun file on both drive A: and B:, the one on drive A: will be executed instead of the one on drive B:. (I think this is a good thing)

Testing a startup program on drive A:


' this program must run on the "A:" Drive, TFT Maximite ONLY
Cls
y_tmp=30
If MM.Device$ <> "TFT Maximite" Then Print "program for TFT Maximite only": End
Option usb off: Option error continue: Drive "a:" ' point to A:
LoadBMP "startup",30,15: Font 2: Color Green,Black ' load splash immage
Print@(230,y_tmp) "Time:": Print@(300,y_tmp) Time$: y_tmp=y_tmp+20
Print@(230,y_tmp) "Date:": Print@(300,y_tmp) Date$: y_tmp=y_tmp+20

check_it:
Drive "b:": app_file$=Dir$("*.*",file) ' read first file on SD card
Print@(230,y_tmp) "File:": Print@(300,y_tmp) app_file$: y_tmp=y_tmp+20

End


I started out with this snippet to see if reading a file from the directory of the "B:" drive would affect the value of the MM.Errno system variable. I wasn't sure, so I tried testing it. I figured that if the SD card were not inserted, it should set the MM.Errno value to 1...

So, I turned off the unit and removed the SD card, and powered back up... Humm... The TFT-MM tries to boot-up, but never does... It then tries to restart it self, over and over... I powered down and reinserted the SD card. Then normal operation returns. Not sure why that is..??

Has anyone running a TFT-MM ever tried to run a program on Drive "A:" without the SD card.??

I don't think my SD card interface is miss-behaving in any way. I can load, edit, save, files normally. If I ask to load a non existent file, it displays the proper error message ect...

Is there a simple way for a running program to check if a card is in the slot, is write protected ect.. I don't think the I/O pins are available to the MM programs. Maybe a MM.SDstat variable would do the trick.. I want to create several things with this unit, and I need to make them as "dummy-user" prof as possible...

Not sure if there are any coding tricks that could do this.

Any feedback would be most welcome..!!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 09:02pm 25 Nov 2013
Copy link to clipboard 
Print this post

I have used this in the past:

Option ERROR CONTINUE
Open "B:NOSUCHFI" For INPUT As #1
If MM.Errno = 2 Or MM.Errno = 1 Or MM.Errno = 15 Then
Print "No SD card"
Else
Print "Yes, there is an SD card"
Endif


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


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

© JAQ Software 2024