Shop OBEX P1 Docs P2 Docs Learn Events
help programming eeprom with spin tool? — Parallax Forums

help programming eeprom with spin tool?

purplemonkeypurplemonkey Posts: 89
edited 2012-08-01 10:19 in Propeller 1
just wanted to check i'm doing this right. loading up spin file in prop tool and then going to compile current - load eeprom then load ram (what is the difference)?? then should it just work when switched on? i don't have to unplug prop plug or anything. can't seem to find any good tutorials on just getting the code onto the chip.

Comments

  • Heater.Heater. Posts: 21,230
    edited 2012-07-31 08:20
    Compile will just compile your code and show you any errors.

    Load RAM will compile the code and download it to the Prop RAM. It will then run immediately. If you power cycle the Prop or reset it the code will be gone from RAM and the Prop will run the code from EEPROM (if any).

    Load EEPROM will down load the code and "burn" it into your EEPROM chip. The code will run immediately. When you power cycle or reset the next time the Prop will run the code from your EEPRO again.

    No unplugging/replugging is required.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-07-31 08:23
    In the Prop tool the function key F10 will only load the RAM and leave the EEPROM untouched. F11 will load the RAM and program the EEPROM. You can leave the Prop plug in, but there is a problem with serial output with the Prop plug in and USB disconnected. That will continually reset the Prop.
  • purplemonkeypurplemonkey Posts: 89
    edited 2012-07-31 08:32
    how do you delete a program from eeprom? do you just load a new program in?
  • Heater.Heater. Posts: 21,230
    edited 2012-07-31 08:41
    Yep.

    Or if you want to be sure your old program is gone and you don't have another to replace it just create a Spin file with nothing but a single PUB method in it and program that to EEPROM.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-31 08:42
    You effectively delete the program from EEPROM by loading a new program into it. You can download a program that just consists of a single PUB method with a single ABORT statement in it. When the program runs, the only cog running will stop and the Propeller will be idle.
  • purplemonkeypurplemonkey Posts: 89
    edited 2012-07-31 08:44
    thanks guys!
  • Heater.Heater. Posts: 21,230
    edited 2012-07-31 09:01
    Interesting Mike. Is a single empty PUB any less idle than a single PUB with an abort.?
    I mean, where does control go in each case and why would it be different?
  • purplemonkeypurplemonkey Posts: 89
    edited 2012-07-31 09:28
    So when you program your spin and it relies on other spin objects where should they go? Then do you have designate the main program as top level? I noticed there was a fm transmitter file with a wav file in one of the posts how would you load the WAv file into EEPROM ?
  • Heater.Heater. Posts: 21,230
    edited 2012-07-31 09:39
    Easiest is to put your other objects in files with the same name as the object but with a .spin extension. Put those filesnin the same directory as your top level file.

    Binary files like wavs can be included in objects DAT sections using the "file" statement.
    The manual is your friend.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-07-31 10:06
    Heater. wrote: »
    Interesting Mike. Is a single empty PUB any less idle than a single PUB with an abort.?
    I mean, where does control go in each case and why would it be different?
    The abort and a return will have the same affect in this case. They will both return to the address $FFF9 in the ROM, which does a cogstop(cogid).
  • Heater.Heater. Posts: 21,230
    edited 2012-07-31 10:15
    I suspected as much as we are already at the top level, there is nowhere else to go.
  • purplemonkeypurplemonkey Posts: 89
    edited 2012-08-01 03:05
    So the spin file I have references the WAv file as an object. So physically I should change extension on WAV to .spin and make sure it's in the same folder and then open the modified wav file in prop tool define the main code as top level then program EEPROM?
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-08-01 03:44
    Well I muddle my way through these things, but what I like to do is create a new directory. I call my main program "Main.spin". I start writing some code. I decide I need an object, eg I want a keyboard, or a mouse, or a display driver. I have no specific idea how these things work but I know in a general sense they are in the obex. So I download them and put them in the same directory and reference them in the Object section of the code. Generally these objects start as a "start" and then you feed them data like the pins you might want to use for the keyboard or mouse etc. Then you glue all the objects together with some simple spin code - eg you look at the keyboard code, determine how to grab a character, then look at the display code, and look at how to output that character. So the code you write is often only a few lines and very simple.

    To debug quickly, download it to RAM with F10. You might do this many times while debugging.

    Once it works, download more slowly to eeprom with F11.
  • NurbitNurbit Posts: 53
    edited 2012-08-01 04:19
    So the spin file I have references the WAv file as an object. So physically I should change extension on WAV to .spin and make sure it's in the same folder and then open the modified wav file in prop tool define the main code as top level then program EEPROM?

    I don't have the source code you have but I think you may be confusing objects such as wav files etc with code objects.
    I would leave the wav file as it is because the main code object probably references it somewhere, i.e, reads the file and then plays it through the code.

    I've probably made myself as clear as mud but feel free to keep asking questions. I'm new to the prop and can vouch for all the guys on here being really friendly and helpful.
    Stupid questions are the best kind to ask :)

    (edit) - Also download and listen to "First Spin" www.firstspin.tv It's great to listen to while you're tinkering, driving, whatever and a lot of the questions I had at the beginning were also asked by atdiy

    It's good stuff
  • NurbitNurbit Posts: 53
    edited 2012-08-01 04:52
    You should leave the wav file as it is.

    In future, any spin objects that get called into code are put under the OBJ heading
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-08-01 05:29
    Thanks, this is the thread with source code and wav file

    Can you explain a bit more about what you want to do -that is a link to posts about radio comms. There are other obex objects that can play .wav files. Many things are possible here - what is the task you want to do?
  • Heater.Heater. Posts: 21,230
    edited 2012-08-01 05:30
    purplemonkey,
    So the spin file I have references the WAv file as an object.

    No. Did you read what I said above?

    You can include any data from a file into the DAT section of an object with the "file" statement. That buts the bytes of the file content into the DAT section just as as if you had used a lot of byte declarations.

    Now I am only assuming that is what is happening in the obect you are talking about. It could be that it is reading the wav file from an SD card at run time.

    The manual is your friend.
  • purplemonkeypurplemonkey Posts: 89
    edited 2012-08-01 10:19
    Sorry I get it now
Sign In or Register to comment.