How about something like this?
Code:alarm = %1001 ' The ninth hour... RTCHour_BIN = ((RTCHour >> 4) * 10) + (RTCHour & $0f) ' Converts BCD to Binary
How about something like this?
Code:alarm = %1001 ' The ninth hour... RTCHour_BIN = ((RTCHour >> 4) * 10) + (RTCHour & $0f) ' Converts BCD to Binary
Dave
Always wear safety glasses while programming.
Hi Malc-c,
I think I have a grip on what you want to do.
Have you given any thought to using a DS1337 RTC? It has 2 alarms. You can set the alarm times any time you need to change the times. I use it for a clock project and work the entire program including sending time/date information out to a serial display all in HEX. I operate the clock in the 24 hour mode. I even have a test routine that changes the alarm times from the programmed alarm times to 1 minute + current time and put that time in the alarm A register and 2 minutes + current time in the alarm B register then lets me test the actual operation of my project in just a few minutes then restores the normal alarm times. I have had 75 of these clocks out in the field since April of 2007.
Let me know if this is of any interest to you.
BobK
Hi Bob,
The reason I'm using the 1307 is that it's fitted to the module used with the EasyPIC 5 board, however I could always breadboard a 1337, so your offer of assistance would be very welcome.
I'll drop you a pm as from what you are saying, the two alarms are ideal for my project
Thanks
Hi, Malc
The other RTC Module from MKE ( W/a PCF8583 ) has an Alarm function ...
no comment needed ???
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Alain, another module to add to my collection....
Don't tell the wife I'm spending more money on this project![]()
Alain,
Quick question, I take it this new module will still work with the same code for the DS1307, ie
Incidentally, can someone break down that line. I understand it's the code to read the I2C channel, data pin, clock pin, and then the current value for each of the time / date fragments, but in what format is the raw code. It mentions BCD ?Code:I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl]
Also, do you have to read [RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCY ear,RTCCtrl] in one hit, or could you choose to read back just the hours and mins ?
DATASHEET!!!!
Just as you wouldn't have a clue what CMCON was for a PIC that you never met before, in the same way you need to know what Registers you've got inside your DS1307, in what sequence you arrive at them, and what their contents are.
Download the DATASHEET for the DS1307.
You will follow the SAME proceedure for ANY complex chip (or device) that you come across. Copying and relying on other peoples code is insufficient. It's worse than trying to decypher Egyptian without the Rosetta stone.
And in answer to your question, you can choose to read back whatever you want in whatever sequence you want (though not nescessarilly in one I2C instruction)... the DATASHEET will explain how and reveal other Registers, features and goodies which you may be unaware of, and which the code you are copying from does not take advantage of.
Well after a lot of searching I've just ordered that module...
Seems that none of the usual electronics outlets stock the DS1337 (RS, Rapid etc). Hopefully the module will be here mid week so I can start playing again
Better start reading the datasheet - even if it's only to keep Mel happy![]()
Bookmarks