Shop OBEX P1 Docs P2 Docs Learn Events
Stamp Stops Running after Five days? — Parallax Forums

Stamp Stops Running after Five days?

GuidoGuido Posts: 195
edited 2005-02-22 23:21 in BASIC Stamp
I have a project that I have been working on and it seems when I try and Debug after five days or so.....It is just dead.....nothing.....I have power supply Voltage....any Ideas.

Comments

  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-19 00:43
    WHat were your inputs/outputs? You may have fried the PIC by sending to much current into it? Were all of the inputs 5v? What power supply are you using?
  • GuidoGuido Posts: 195
    edited 2005-02-19 01:01
    It is not fried, if I reboot the program it will run for another 5 days and stop
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-19 16:12
    After hitting reset it still doesn't work? Is the battery putting out enough power?
  • OrionOrion Posts: 236
    edited 2005-02-19 16:36
    Sounds like a programming problem.

    What is the purpose of AckPin variable? You set it up but never assign anything to it.

    You may want to add timeouts to your serin statements. You may not be receiving data when you think you should, and your program is waiting for input forever.

    just my 2 cents
  • dandreaedandreae Posts: 1,375
    edited 2005-02-19 16:47
    I think you maybe over writing the program?· This would would explain why you are not able to reset it and that you have to reload the program after 5 days.· You may need to add a EEPROM, here is a link for a 8K EEPROM:· http://www.parallax.com/detail.asp?product_id=602-00008·or you can use a BS2e which has 16K memory compared to 2k on the BS2.· It would be a drop in replacement.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com



    Post Edited (Dave Andreae (Parallax)) : 2/19/2005 4:52:36 PM GMT
  • GuidoGuido Posts: 195
    edited 2005-02-19 17:00
    Still learning all this!!
    First of all I have a solid 5v, and battery backup for his program. I believe the ackpin, must be used if you are using the latest version 2.5.
    I have a hunch Dave might be correct, but one question I do have. If I am saving high and low temperatures and time, wouldn't they replace the old area of the program? I do realalize the program is almost full, but trying to shorten it i yet do not have the experinence
  • dandreaedandreae Posts: 1,375
    edited 2005-02-19 17:08
    I believe that if you check your memory map each day, you can see it will increase·in size.· This is a good indication that you are over writing the EEPROM if it does increase.

    Dave


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com



    Post Edited (Dave Andreae (Parallax)) : 2/19/2005 5:13:58 PM GMT
  • GuidoGuido Posts: 195
    edited 2005-02-19 17:12
    Dave,
    Thank you very much. I am going to give it a try.I have this bread-baorded and just plug in when I am doing the test.
  • OrionOrion Posts: 236
    edited 2005-02-19 17:21
    Yep, now that I look at it you are over writing your program. You’re saving 7 bytes @ 60 and 70 and if you check the memory map your program is in these areas.

    SAVE:
    HIGH RTCCS
    SHIFTOUT DTA, Clk, LSBFIRST, [noparse][[/noparse]%1\1,BrstReg\5,%10\2]
    SHIFTIN DTA, Clk, LSBPRE, [noparse][[/noparse]Seconds,Minutes,Hours,Date,Month,Day,Year]
    WRITE ADDR,HOURS,MINUTES,SECONDS,DATE,MONTH,DAY,YEAR <===== PROBLEM
    LOW RTCCS
    RETURN

    try commenting out the write command above and let it run.

    As far as checking the memory map after its running for a while, it’s going to show the same thing. It only shows what the memory will look like @ compile time.

    Post Edited (Orion) : 2/19/2005 5:34:43 PM GMT
  • GuidoGuido Posts: 195
    edited 2005-02-19 17:22
    Dave,
    How do you do that! What I am trying to say, is I can open the memory map when the program is on the editor, but once it is downloaded to the stamp, how do you get access to it?
    Thank You Again
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-19 17:24
    Two thoughts on reading over this.

    1) Guido says that he has to "reboot" his program. Robert asked the unanswered question "After hitting reset it still doesn't work?". Dave ran with that. So one question to be answered is:

    Guido, by "reboot" do you mean that you have to hit the reset button, then all is fine. Or do you have to reload the program from your PC to the Stamp?

    2) Dave, I thought that the IDE did not show actual memory use in the Stamp, only the IDE's projection of memory to be used. Thus if the program is constantly using more memory when running, the IDE wouldn't know anything about it, and thus wouldn't show it.

    Jim
  • GuidoGuido Posts: 195
    edited 2005-02-19 17:32
    I did not put a reset button on this. So I have to download the program to get it to work.....
  • OrionOrion Posts: 236
    edited 2005-02-19 17:49
    You could try,

    1. Use locations 40 and 50 instead, if I'm reading the mem map right there should be enough room

    2. There is extra ram on the ds1302 you can use.

    2 may be a better choice because the eeprom of the bs has a limited # write cycles.

    Post Edited (Orion) : 2/19/2005 5:54:02 PM GMT
  • GuidoGuido Posts: 195
    edited 2005-02-19 17:51
    I was looking at that after you mentioned it. It is close, so I will take your advise and move the write address. Thanls for the help everyone I will let you know what happens.
    Ps: To stupid to figure out how to write to the ds1302!!!!
    Thanks Again
  • GuidoGuido Posts: 195
    edited 2005-02-19 18:12
    Orion,
    Thanks for your help. I just Changed the address to 40-50 and it did not work. Even though the memory map show it free. I gradually went up the scale, and I have it at 48-58 and working....we will see.
    Thank You Again!
    Guido
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-19 18:31
    Guido,

    You can find an example of reading and writing to the RAM area of the DS1302 in the App Note www.parallax.com/dl/docs/prod/appkit/ds1302rtc.pdf. The code to do it is fairly straightforward:

    WriteRTCRAM:
    HIGH RTCReset
    SHIFTOUT Dta, Clk, LSBFIRST, [noparse][[/noparse]%0\1,RTCCmd\5,%11\2,Temp]
    LOW RTCReset
    RETURN
    
    ReadRTCRAM:
    HIGH RTCReset
    SHIFTOUT DTA, Clk, LSBFIRST, [noparse][[/noparse]%1\1,RTCCmd\5,%11\2]
    SHIFTIN DTA, Clk, LSBPRE, [noparse][[/noparse]Temp]
    LOW RTCReset
    RETURN
    



    See the App Note for variable / pin definitions.

    Jim
  • dandreaedandreae Posts: 1,375
    edited 2005-02-19 20:24
    I had brain glitch, you can't check the memory after it has been running, my mistake.

    Dave




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com

    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-02-19 20:51
    Guido -

    Instead of fooling around with random locations which may or may not work, why not just put the two locations at 0 and 10, as high as it will go. If it fails there, your program is just too big, and you'll hve to do some "bloat surgery".

    Regards,

    Bruce Bates
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-02-19 23:28
    Dave Andreae (Parallax) said...
    I had brain glitch, you can't check the memory after it has been running, my mistake.
    Dave
    Ah, but you did give me one more idea which may help determine if he's overwriting the program...
    You would have to add a small piece of code.· Have it display the memory address it's writing to each time.· When it stops responding, the last address can be compared with the memory map to see if you are running into the program area.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --==<{Chris}>==--
  • GuidoGuido Posts: 195
    edited 2005-02-20 13:40
    First of all, I would like to thank everyone for their help...Being new to this I have alot to learn, but enjoying every minute I have a chance to play around...Yes indeed this program is "Bloted"!. Playing around with the programs just seems to get me going into every different direction. I plan on learning more so I can use·a couple of·slave stamps with a master (Debug)·and have all my different programs for automation and control of a remote location in the mountains.

    I am glad this program is bloted right now, because I have a problem that maybe I can learn something from.

    First of all when I write to a location, basically for the new high and low temperature time and date, wouldn't I write to the same location....I guess what I am saying how could I possibly be over writing a program when the memory map shows it open.

    Also if I use a Master Stamp to collect and Display for all·information from the Slave Stamps would I be limited to 16 word sized variables? The reason I am asking this this I may have 20 to twenty five word sized variables that I want to display. Just wondering if there might be a trick to deal with this problem.

    Again All Thanks For the Help!!!
    Guido

    ·
  • OrionOrion Posts: 236
    edited 2005-02-20 16:09
    Guido said...

    Also if I use a Master Stamp to collect and Display for all·information from the Slave Stamps would I be limited to 16 word sized variables? The reason I am asking this this I may have 20 to twenty five word sized variables that I want to display. Just wondering if there might be a trick to deal with this problem.
    Feed all your data into an external eeprom and display them like this
    ·
    1. Read eeprom for current var to display
    2. Send it to display
    3. Loop back to 1.

    This way you can reuse the same word var over and over to display them all.· If you dig around the forums you can find tons of code using a bunch of different eeproms.
    ·
  • GadgetmanGadgetman Posts: 2,436
    edited 2005-02-20 17:04
    Or use an BS2p/BS2pe which can store the data it receives in the SERIN statement directly into its 128Bytes scratchpad RAM...

    Storing temporary data in EEPROM is something best avoided.
    (Limited number of writes. Normally 1.000.000 writes should be enough, but if a program accidentally goes into a short loop...)
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-20 17:29
    Guido said...
    First of all when I write to a location, basically for the new high and low temperature time and date, wouldn't I write to the same location....I guess what I am saying how could I possibly be over writing a program when the memory map shows it open.

    Guido,

    Take a look at the memory map of the version of the program you posted. It shows your program code as running all the way up to memory location 68. (Stamp code starts at the end of memory and loads to the beginning.) Thus if you store something at location 70 you have just overwritten part of your program.

    Jim
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-20 17:33
    Bruce Bates said...
    Instead of fooling around with random locations which may or may not work, why not just put the two locations at 0 and 10, as high as it will go.

    He's already got DATA statements which load starting at zero, so writing to 0 and 10 would overlay his DATA statements. The important thing is to use the memory map to see where things are loaded and what areas of memory are open. This is especially critical, as Guido has found out, when you're pushing the max of available memory.

    Jim
  • GuidoGuido Posts: 195
    edited 2005-02-21 23:18
    Orion,
    Could you possibly point me in the right direction, I guess I just can not seem to find what you are telling me I can do...I have searched the forums, but have not seen anything.
    Thanks Again

    Guido said...

    Also if I use a Master Stamp to collect and Display for all·information from the Slave Stamps would I be limited to 16 word sized variables? The reason I am asking this this I may have 20 to twenty five word sized variables that I want to display. Just wondering if there might be a trick to deal with this problem.
    Feed all your data into an external eeprom and display them like this
    ·
    1. Read eeprom for current var to display
    2. Send it to display
    3. Loop back to 1.

    This way you can reuse the same word var over and over to display them all.· If you dig around the forums you can find tons of code using a bunch of different eeproms.
  • OrionOrion Posts: 236
    edited 2005-02-22 22:38
    Well take a look at how some of your subs work.· Example:
    ·
    ·
    'Define Days-Of-Week, Months and AM/PM text.
    'All text is stored in EEPROM with a binary 0 as the end-of-text character

    Sun· DATA "· Sun",0
    Mon· DATA "· Mon",0
    Tue· DATA " Tues",0
    Wed· DATA "Wednes",0
    Thu· DATA "Thurs",0
    Fri· DATA "· Fri",0
    Sat· DATA "Satur",0

    AM·· DATA " AM",0
    PM·· DATA " PM",0

    ·
    ·
    Here's a ton of bytes if you where going to try to store them all as variables.· Instead there stored in the eeprom on your bs2 in this case.· Now look at how the code displays it.· It’s only using 2 byte vars to display many more by retrieving a byte and printing it then looping until it reaches the end.
    ·
    ·
    PrintIt:
    'Prints zero (0) terminated text from EEPROM
    READ Idx,Value··· 'Get next character
    IF Value = 0 THEN Finished· 'Make sure it's not a binary 0
    DEBUG Value····· 'Display it on screen
    Idx = Idx + 1
    GOTO PrintIt
    Finished:
    RETURN

    ·
    Now if you get yourself an external eeprom or bs w/ scratchpad, you fill it up and use the same technique to reuse vars.· Granted this usually requires a little more code depending on what kind of data your working with.· Step one in your case is going to be trimming some fat off that program so you have some space to work with.· Step two figure how much room is enough and get a eeprom/flash/mmc/bs2e/bs2p/etc to hold it.· You may also want to look at http://www.parallax.com/dl/docs/cols/nv/vol1/col/nv33.pdf.· Jon uses a single word var to work with time, basically the number of mins from 12:00a(0-1439).· Same thing could be done with date.· Make 1/1/05 = 0 and the date is the offset from this number (ie. 12/31/05 = 365). Convert it back for display if needed.· I’m not 100% sure on what you’re doing with time/dates this may or may not help.· Personally I don’t like to have sec/min/hrs/month/date/yrs as single vars,·it takes up way too much.
    ·
    ·
    ·

    Post Edited (Orion) : 2/22/2005 10:44:36 PM GMT
  • GuidoGuido Posts: 195
    edited 2005-02-22 23:21
    Orion,
    Thank you, I sure have a lot to learn. What I would like to do if possible, is have a Master Stamp,· a couple of Slave stamps and an external eprom.
    Basically saving all data, time,day etc when an input such as temperature, power failures, alarms etc are detected. This information would be coming from the slave stamps and writing to the eprom. I would like to read the eprom from the Master stamp and display the results....I have alot of different inputs that I am trying to monitor.....Am I out of my league doing this? You can give it straight to a beginer Itialian!
    Thanks Again
    Guido
Sign In or Register to comment.