Timekeeping chip and Datalogger
Tabiri
Posts: 23
I have both the datalogger and the timekeeping chip hooked up - separately - to the BOE. (I also have the crystal hooked to the timekeeping chip as well). What I would like to do is have the datalogger take certain measurements at specific times, according to the clock on the timekeeping chip. I don't have any ideas on how to connect them on the protoboard or on how to program that. Could I have some help with this?
Comments
The Stamp (and Stamp program) has to do all the work. It has to sample the time or sample the alarm pin, decide when it's time to log something, then communicate with the datalogger to log the data to the memory stick file.
So all the datalogger does is log data to the memory stick file?
http://www.vanguard-co.com/download/basic_stamp_accesories/ds1302Rtc.pdf
(it's on page 9)
and I was going to put in a line of coding that if the clock reached a certain time, go to a subroutine to display a debug statement (using and if-then statement). However, when it gets to right after the "then" in the coding it keeps expecting a label. Why is it doing that, and how do I fix it?
I put an attachment of the code I'm using on here.
more timekeeping.bs2
Usually you put a GOTO or GOSUB after the "then" in your IF THEN statement. In case of a GOSUB you do have to specify what subroutine you want the program to go to.
Like this:
IF (something) THEN GOSUB Test
Now the program will go to the subrotine named Test and return back when it reach the RETURN command at the end of that subroutine.
Don't forget to decide PBasic version on top of your program, usually like this:
' {$PBASIC 2.5}
Thanks for the help; I hadn't even noticed the PBasic version was missing.
I fixed that and encountered another problem, however.
more timekeeping.bs2
I marked out the problem with a big HERE.
I tried to make some debug statements appear onscreen if a certain second was reached, and then disappear after that second was gone. what seems to be happening though, is the debug statement stays on screen far after it was supposed to. Is there some command I'm missing in there?
I think your code is not the best one for what you plan to do. The code you are using is more a tricle-charge code and its a little bit confusing when learning the 1302.
I recommend you take a look at Chris Savage's discussion on this time keeping chip here
The thread is including some excellent examples on using the 1302 and is much easier to understand then the program you are working on.
He also made a template ready for you to develope the way you wish.
Beside of that, when comparing values out of the DS1302 you write
IF seconds = 4 THEN GOSUB no
Try this way instead:
IF (seconds = $04) THEN GOSUB........
I put the if-then statement in the way you said, but it didn't change it. The debug statement still stays up on the screen.
I did look at the demo code thread. I uploaded the template, but all it displays is 00/00/00 00:00:00:00
I am unsure if that means something is wrong, or if the template wasn't meant to display the time.
Try change this line: IF seconds > 5 THEN GOSUB loopi
to
IF seconds > 5 THEN GOSUB Blank
On the Template-issue its correct that DEBUG screen shows 00/00/00 00:00:00:00
at the beginning. (As long as the RTC-time is not set)
But the seconds should begin to increase once the program is started. If it doesnt, thats probably because the PIN-connections on the BS2 is uncorrect, refer to Chris' picture in his first post. PIN connections can be different compared to your project. Also remember the X-tal and the 5V.
Hope this helps.
Also, I looked at the picture and moved some jumper wires and resistors around, and now the template works perfectly too.
Thank you very much
Thanks.
Links would help. I have found "App Kits" or "Application Notes" really helpful in the past. Easier for me to cheat off of an example than go from pure theory and data sheets! I have made good use of the example projects in Parallax "Whats a Micro...", and "Signals..." in the same fashion. But I can't find any data logging App Kit or other that combines a 555, Stamp, and a data module - all which I have assembled. Thanks in advance for all the help.
timekeeping chip - http://www.vanguard-co.com/download/basic_stamp_accesories/ds1302Rtc.pdf
and - http://forums.parallax.com/showthread.php?77867-DS1302-Demo-Code-%28Updated%29&highlight=chris+savage+ds1302
I used Chris Savage's picture to hook it up.
I'm using a DS1302 timekeeping chip, so i'm not really sure if these would help with a 555.
SUN 01/01/00 00:00:80.
I think the problem is the crystal, but even after replacing it nothing has changed.