Pages: [1]   Go Down
Author Topic: Storing code?  (Read 929 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can I write a code for the arduino to read and execute a code from an SD card?
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 443
Posts: 23837
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes.
Define what you mean by execute.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well the Arduino only has so much memory. I was wondering if I could save a large code on an SD card and just write a simple sketch telling the Arduino to run the code that is saved on the SD card.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 443
Posts: 23837
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No, you can't run from SD card as if it were internal Flash.
You could move non-changing data from your code to the SD and access it as needed, reduce your sketch size.
You could probably write code (bootloader) to upload your program and then start your new sketch.  Has been discussed here, don't know if its ever been done.

Probably easier to get a processor with more memory. There a few of us working on 1284P based kind of Uno, lot more memory to play with there.
http://arduino.cc/forum/index.php/topic,56567.0.html
http://arduino.cc/forum/index.php/topic,61126.105.html
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Central MN, USA
Online Online
Tesla Member
***
Karma: 65
Posts: 6932
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Lots of times you don't actually need that much memory unless you're doing a very large project, like 3,000 lines big or you're writing code very improperly. In case of very large project, use MEGAs with more space. In case of improper programming, redo your programming. I have several blog posts about optimizing your codes:

http://liudr.wordpress.com/category/coding/

You could share your code here so we can see which way to point you to.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So no one could write an Arduino interpreter in Arduino?  smiley
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12483
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So no one could write an Arduino interpreter in Arduino?

On contrary, it is done by these people: - http://bitlash.net/wiki/start -

As I have no experience with bitlash, I think you have to rewrite parts to read the commands from SDcard iso serial.

 
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
God Member
*****
Karma: 39
Posts: 986
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

FYI/FWIW, I have posted a version of Bitlash that runs script from an SD card.  More at this post: http://arduino.cc/forum/index.php/topic,63126.0.html and at http://bitlash.net

Best,

-br
http://bitlash.net
http://entropymouse.com
Logged

Pages: [1]   Go Up
Jump to: