PDA

View Full Version : Stamp Stops Running after Five days?



Guido
02-19-2005, 08:34 AM
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.

Robert Schwartz
02-19-2005, 08:43 AM
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?

Guido
02-19-2005, 09:01 AM
It is not fried, if I reboot the program it will run for another 5 days and stop

Robert Schwartz
02-20-2005, 12:12 AM
After hitting reset it still doesn't work? Is the battery putting out enough power?

Orion
02-20-2005, 12:36 AM
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

dandreae
02-20-2005, 12:47 AM
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 (mailto:dandreae@parallax.com)
www.parallax.com (http://www.parallax.com)



Post Edited (Dave Andreae (Parallax)) : 2/19/2005 4:52:36 PM GMT

Guido
02-20-2005, 01:00 AM
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

dandreae
02-20-2005, 01:08 AM
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 (mailto:dandreae@parallax.com)
www.parallax.com (http://www.parallax.com)



Post Edited (Dave Andreae (Parallax)) : 2/19/2005 5:13:58 PM GMT

Guido
02-20-2005, 01:12 AM
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.

Orion
02-20-2005, 01:21 AM
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, [%1\1,BrstReg\5,%10\2]
SHIFTIN DTA, Clk, LSBPRE, [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

Guido
02-20-2005, 01:22 AM
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 McCorison
02-20-2005, 01:24 AM
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

Guido
02-20-2005, 01:32 AM
I did not put a reset button on this. So I have to download the program to get it to work.....

Orion
02-20-2005, 01:49 AM
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

Guido
02-20-2005, 01:51 AM
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

Guido
02-20-2005, 02:12 AM
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 McCorison
02-20-2005, 02:31 AM
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 (http://www.parallax.com/dl/docs/prod/appkit/ds1302rtc.pdf). The code to do it is fairly straightforward:



WriteRTCRAM:
HIGH RTCReset
SHIFTOUT Dta, Clk, LSBFIRST, [%0\1,RTCCmd\5,%11\2,Temp]
LOW RTCReset
RETURN

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



See the App Note for variable / pin definitions.

Jim

dandreae
02-20-2005, 04:24 AM
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 (mailto:dandreae@parallax.com)
www.parallax.com (http://www.parallax.com)

·

Bruce Bates
02-20-2005, 04:51 AM
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 Savage
02-20-2005, 07:28 AM
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}>==--

Guido
02-20-2005, 09:40 PM
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

·

Orion
02-21-2005, 12:09 AM
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.
·

Gadgetman
02-21-2005, 01:04 AM
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 McCorison
02-21-2005, 01:29 AM
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 McCorison
02-21-2005, 01:33 AM
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

Guido
02-22-2005, 07:18 AM
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.

Orion
02-23-2005, 06:38 AM
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 (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

Guido
02-23-2005, 07:21 AM
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