@William. the TO92 device missing from the DS1307 RTC module is a 3 wire DS18B20+PAR Temparture sensure. It's a clever little device which staps across a 5v source and ground and has a 64bit serial code stored on the chip which is made available on the centre lead.
As I understand it, the the LIR2032 is rechargable. A plain CR2032 is not. Mine came with the rechargable battery marked LIR2032 (3.6V). The actual voltage measures 4.48 both in and out of the circuit.
FAKE CHIP ALERT !
The Maxim Datasheet says that setting "CH" Bit 7 of address 0 (the seconds register) will disable the oscillator and stop the clock. However, on my Amazon (Made in China) device this does not work. The oscillator runs regardless if the CH bit is cleared to 0 or set to 1.
However. when I replace the Module with a genuine Maxim DS1307, setting CH to 1 stops the clock as specified in the data sheet. This highly suggests that the the DS1307 on the board is a fake/counterfeit which is no real surprise. The ability to stop and start the oscillator/clock could be useful when collecting and saving total run time.
I wont be ordering any more of these. For not much more money I can use genuine components that work as specified.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@William.
Hello again Bill, eventually managed to get your I2C Eeprom Discovery program to work with my 16F18326 and Tbl on Ra0 and RA1. (I think the modern expression is COOL ! )
Wow.. This is one hell of a steep learning curve.... Practically Vertical but it's great fun.
I have published the modified code for 16F18326 if anyone else needs it to test their eeprom with the same micro.
I'm getting myself in a right 'Tizz-Wazz' here. Normally if I was using the onchip eeprom I would right the following:
EPWrite 0, shours (0 being the location and shours being a numeric variable of 0 to 255)
and
EPRead 0, shours (variable as above)
but for the life of me I cannot make my feeble undestanding of the following work :
The DS1307 has user NVRAM available from addresses 0x08 to 0x3F. This memory is accessed via DS1307_Write and DS1307_Read. This memory is not EEProm memory and is only non-volatile as long as the battery level meets DS1307 specifications. This data willl be lost if the battery goes dead or otherwise fails.
The ATMEL I2C EEProm chip on the Tiny RTC board is accessed via "eeprom_wr_byte" and "eeprom_rd_byte". or "eeprom_wr_array" and "eeprom_rd_array" There is nothing in the HELP on these so you must look at the I2C demos for exmaple code or look at library i2cEEPROM.h to see the available commands.
The PIC EEProm is accessed via EPWrite and EPRead commands.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is accessed as SRAM on I2C with all of the speed benafits and random access nature of reading and writing RAM but if it detects a power down it automaticaly backs itself up to EEPROM in the same package.
All of the Benafits of NVRAM but no need for a backup battery.
I have some on hand so will have a look at making a library for them, once I have build a board to test them on. I may be able to whip up a MikroBUS Board quickly and test it on the MPLab Xpress board.
Cheers
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well here it is, almost done just needs a few tickles and tweaks on the display side but it’s all there.
The Display is an SSD1306, the devices are 16F18326, with a DS1307 and a 24LC256 EEProm (Not the Fleabay module, there is something peculiar with them!)
The TinyBootloader firmware is available on RA0 & RA1 which has made the code development so much easier.
My most grateful thanks go to Evan and William for their help, guidance, support and encouragement in helping me to get the project of the ground and away onto something I could follow and understand.
Some of the features I’m pleased with are the ability to run three separate time accumulators with individual reset facilities.
There are a few things which I need to address or that I’m not too happy with, but as a project it has been a great challenge, huge fun and a vertical learning curve.
Yes, I have created a Library and a couple of test programs.
The test programs let you run one to write a pattern to the EERAM and then read it back.
You then remove power and run the second program which should retrieve the original pattern you wrote.
They are being verified and tested for library conformance , and should be committed to the Library soon.
So If you want to order some EERAM in the interim GCBASIC will support them.
Cheers
Chris
edit: Supported Functions in first release :-
EERAM_Status() ; Read the Status Register.
EERAM_AutoStore(ON) ; Enable Automatic Storage on power loss
EERAM_AutoStore(OFF) ; Disable Automatic Storage on power loss
EERAM_Backup() ; Backup / Store Now
EERAM_Recall() ; Restore Now
EERAM_HWStore() ; Force Backup with HS Pin
EERAM_Write(Adr, Data) ; Write a Byte of Data to address
EERAM_Read(Address) ; Read a Byte of Data from address
Looks ideal, but is it possible to run a routine where can see what the current values and locations of an EERAM or EEProm are ?
The reason I ask is that although my current project is only using 53% of the program memory, my next project may exceed that to where I may need to shove some of the program routines and variables into EERAM/EEProm and being able to review where and what is in there would I feel be a definite advantage.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looks ideal, but is it possible to run a routine where can see what the current values and locations of an EERAM or EEProm are ?
Yes that is what the EERAM_Read(Address) Function is for.
The reason I ask is that although my current project is only using 53% of the program memory, my next project may exceed that to where I may need to shove some of the program routines and
variables into EERAM/EEProm and being able to review where and what is in there would I feel be
a definite advantage.
You are asking for two different things here.
Placing your variables in EERAM will be easy, just remember that they are in external storage and even at 1Mbs accessing SRAM (EERAM) via i2c is slower than accessing on chip ram.
PIC’s use Harvard Architecture with separate address spaces for Programs and Data. So whilst you could, theoretically, read the Flash memory and back it up on EERAM, you would not be able to execute it from the EERAM. It would have to be read back into the PIC and written into Flash, like a bootloader, in order to execute the code.
So the bottom line is yes, it could be done, but it would be a very complex piece of code and require re architecting your entire system. The question remains if you would want too. It would be cheaper and easier to recompile on a different PIC that has more program Flash and RAM than your current PIC.
Last edit: Chris Roper 2017-05-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, I let my mouth (on the keyboard) run ahead of my 'Numbskulls' so to speak and it dawned on me after I sat down and thought about it, that sort of programming is way, WAY above my pensiongrade'
I have ordered a couple of 47L16 EERAM devices from the goodly 'Farnell' Strangely RS don't stock them. They look pin for pin compatible with the 24LC256 EEProm but asks for a CvCap on Pin 1 for Auto Retention -- Weee... It's playtime again boys. I love all these new devices
So, where can I beg/borrow/acquire a copy of your code to review the contents of my EEProm/EERAM please?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It will be in the next release, but if you receive your new chips before
then just drop me a note via email and I will send you a copy by return.
I would send it now but it is at the stage where I keep making minor tweaks
and I am still doing stability testing, so the code I have now may well be
different to what finally gets included.
I had planned to use one of those ACS712 Current sensing modules to trigger the Minute Timers in the project but the little hair on the back of my neck is going crackers.
It claims it can handle up to 30A and although the compressor is drawing 8A running and 10A peak inrush current I'm extremely dubious of putting a load through the PCB print even if it’s 4oz copper I have visions of sparks flashes and an enormous bang!
Has anyone had any experiences with these, or am I just being too cautious (Again!)
There are some pics attached so as you see my concerns.
UPDATE: The unpopulated component pad is for an optional DS18B20 Temp Sensor. The DS pad is the 1 wire I/0 connection.
@William. the TO92 device missing from the DS1307 RTC module is a 3 wire DS18B20+PAR Temparture sensure. It's a clever little device which staps across a 5v source and ground and has a 64bit serial code stored on the chip which is made available on the centre lead.
Here is a link to it.
http://uk.rs-online.com/web/p/products/7860809/
The lithium battery (LR2032) is not re-chargable and you are write in saying it will go with a bang if you take the blocking diode out of the circuit.
Going to try your code out in the morning as I cannot get any joy in reading or writng to the eeprom.
As I understand it, the the LIR2032 is rechargable. A plain CR2032 is not. Mine came with the rechargable battery marked LIR2032 (3.6V). The actual voltage measures 4.48 both in and out of the circuit.
FAKE CHIP ALERT !
The Maxim Datasheet says that setting "CH" Bit 7 of address 0 (the seconds register) will disable the oscillator and stop the clock. However, on my Amazon (Made in China) device this does not work. The oscillator runs regardless if the CH bit is cleared to 0 or set to 1.
However. when I replace the Module with a genuine Maxim DS1307, setting CH to 1 stops the clock as specified in the data sheet. This highly suggests that the the DS1307 on the board is a fake/counterfeit which is no real surprise. The ability to stop and start the oscillator/clock could be useful when collecting and saving total run time.
I wont be ordering any more of these. For not much more money I can use genuine components that work as specified.
@William.
Hello again Bill, eventually managed to get your I2C Eeprom Discovery program to work with my 16F18326 and Tbl on Ra0 and RA1. (I think the modern expression is COOL ! )
Wow.. This is one hell of a steep learning curve.... Practically Vertical but it's great fun.
I have published the modified code for 16F18326 if anyone else needs it to test their eeprom with the same micro.
Once again, huge thank you.
Last edit: Keith 2017-05-07
I'm getting myself in a right 'Tizz-Wazz' here. Normally if I was using the onchip eeprom I would right the following:
EPWrite 0, shours (0 being the location and shours being a numeric variable of 0 to 255)
and
EPRead 0, shours (variable as above)
but for the life of me I cannot make my feeble undestanding of the following work :
eeprom_wr_byte( eepDev, 0x0, shours ) and eeprom_rd_byte ( eepDev, 0x0, shours )
it simply returns the value 255 which is probably ehat was left behind from William's eeprom test routine.
If is the ds1307. Use the ds1307 commands.
There two methods at the bottom of the library, the .hotel file.
I cannot remember syntax but it is very very easy to use.
To summarize ...
The DS1307 has user NVRAM available from addresses 0x08 to 0x3F. This memory is accessed via DS1307_Write and DS1307_Read. This memory is not EEProm memory and is only non-volatile as long as the battery level meets DS1307 specifications. This data willl be lost if the battery goes dead or otherwise fails.
The ATMEL I2C EEProm chip on the Tiny RTC board is accessed via "eeprom_wr_byte" and "eeprom_rd_byte". or "eeprom_wr_array" and "eeprom_rd_array" There is nothing in the HELP on these so you must look at the I2C demos for exmaple code or look at library i2cEEPROM.h to see the available commands.
The PIC EEProm is accessed via EPWrite and EPRead commands.
Another alternative is microchip 74xxx eeram.
It is accessed as SRAM on I2C with all of the speed benafits and random access nature of reading and writing RAM but if it detects a power down it automaticaly backs itself up to EEPROM in the same package.
All of the Benafits of NVRAM but no need for a backup battery.
I have some on hand so will have a look at making a library for them, once I have build a board to test them on. I may be able to whip up a MikroBUS Board quickly and test it on the MPLab Xpress board.
Cheers
Chris
The EERAM is working:
I will do a little more testing to try and catch the edge cases and then tidy up the library befor posting.
I will start a seperate thread when it is ready for release, but added this here just for closure.
Cheers
Chris
Well here it is, almost done just needs a few tickles and tweaks on the display side but it’s all there.
The Display is an SSD1306, the devices are 16F18326, with a DS1307 and a 24LC256 EEProm (Not the Fleabay module, there is something peculiar with them!)
The TinyBootloader firmware is available on RA0 & RA1 which has made the code development so much easier.
My most grateful thanks go to Evan and William for their help, guidance, support and encouragement in helping me to get the project of the ground and away onto something I could follow and understand.
Some of the features I’m pleased with are the ability to run three separate time accumulators with individual reset facilities.
There are a few things which I need to address or that I’m not too happy with, but as a project it has been a great challenge, huge fun and a vertical learning curve.
@ Chris, how did you manage to display the contents of the EERAM ?
Do you have some code which throws out the contents in the same was as the I2C discovery code ?
Kind Regards
Keith
Yes, I have created a Library and a couple of test programs.
The test programs let you run one to write a pattern to the EERAM and then read it back.


You then remove power and run the second program which should retrieve the original pattern you wrote.
They are being verified and tested for library conformance , and should be committed to the Library soon.
So If you want to order some EERAM in the interim GCBASIC will support them.
Cheers
Chris
edit: Supported Functions in first release :-
Last edit: Chris Roper 2017-05-18
Looks ideal, but is it possible to run a routine where can see what the current values and locations of an EERAM or EEProm are ?
The reason I ask is that although my current project is only using 53% of the program memory, my next project may exceed that to where I may need to shove some of the program routines and variables into EERAM/EEProm and being able to review where and what is in there would I feel be a definite advantage.
Yes that is what the EERAM_Read(Address) Function is for.
You are asking for two different things here.
Placing your variables in EERAM will be easy, just remember that they are in external storage and even at 1Mbs accessing SRAM (EERAM) via i2c is slower than accessing on chip ram.
PIC’s use Harvard Architecture with separate address spaces for Programs and Data. So whilst you could, theoretically, read the Flash memory and back it up on EERAM, you would not be able to execute it from the EERAM. It would have to be read back into the PIC and written into Flash, like a bootloader, in order to execute the code.
So the bottom line is yes, it could be done, but it would be a very complex piece of code and require re architecting your entire system. The question remains if you would want too. It would be cheaper and easier to recompile on a different PIC that has more program Flash and RAM than your current PIC.
Last edit: Chris Roper 2017-05-18
Yes, I let my mouth (on the keyboard) run ahead of my 'Numbskulls' so to speak and it dawned on me after I sat down and thought about it, that sort of programming is way, WAY above my pensiongrade'
I have ordered a couple of 47L16 EERAM devices from the goodly 'Farnell' Strangely RS don't stock them. They look pin for pin compatible with the 24LC256 EEProm but asks for a CvCap on Pin 1 for Auto Retention -- Weee... It's playtime again boys. I love all these new devices
So, where can I beg/borrow/acquire a copy of your code to review the contents of my EEProm/EERAM please?
It will be in the next release, but if you receive your new chips before
then just drop me a note via email and I will send you a copy by return.
I would send it now but it is at the stage where I keep making minor tweaks
and I am still doing stability testing, so the code I have now may well be
different to what finally gets included.
Cheers
Chris
I had planned to use one of those ACS712 Current sensing modules to trigger the Minute Timers in the project but the little hair on the back of my neck is going crackers.
It claims it can handle up to 30A and although the compressor is drawing 8A running and 10A peak inrush current I'm extremely dubious of putting a load through the PCB print even if it’s 4oz copper I have visions of sparks flashes and an enormous bang!
Has anyone had any experiences with these, or am I just being too cautious (Again!)
There are some pics attached so as you see my concerns.