| View previous topic :: View next topic |
| Author |
Message |
asmallri
Joined: 12 Aug 2004 Posts: 1679 Location: Perth, Australia
|
|
Posted: Fri Nov 19, 2004 5:30 pm |
|
|
In the #fuses statement you have the Watchdog timer enabled but you never reset it. So the WDT is resetting the CPU
When the and External EEPROM write occurs that crosses a page boundary a 5ms delay is required to enable the EEPROM to perform the write from its internal buffer to its internal flash memory. If you attempt to wite to it doing this time the EEPROM responds with a NAK - it is up to you to test for this or do the delay_ms(5) - better to test it.
Also I note your program appears to "erase" the external EEPROM by writing 0x00 to it. In the erased state the EEPROM contents will be 0xff. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
 |
Guest
|
|
Posted: Mon Nov 22, 2004 12:15 pm |
|
|
How to reset WDT as you adviced.
I put some code like this, it still just blink the led (connected to PIN_A2) once and stop there, not sign of continuity.
| Code: | init_ext_eeprom();
for(j=0;j<1023;j++)
{
write_ext_eeprom1(j,data1);
output_high(PIN_A2);
delay_ms(5);
}
|
|
|
 |
Guest
|
|
Posted: Mon Nov 22, 2004 12:17 pm |
|
|
| what you mean by in erased states, and how could I put them in an erased state and then put them in a write state. I original want to init the eeprom, (to init them as either 0 or 0xFF) . |
|
 |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Nov 22, 2004 4:20 pm |
|
|
| Quote: | | How to reset WDT as you adviced. |
Let me ask you a question: if you don't know how to reset a watchdog, are you sure you need one?
What is a watchdog?
Watchdogs are a very important security safeguard in critical applications that are not allowed to freeze because of a programming error. The watchdog timer is used to cause a hardware reset if the software appears to be stuck. Depending on how critical your application is you set this timer from a few miliseconds to seconds. At carefully chosen locations in your application you reset the watchdog timer. If the program enters an infinite loop, the watchdog is never reset again and causes a hardware reset.
Watchdogs have their value, but there are also good reasons for not using them, for example a watchdog consumes power and can be a pain in the *ss during development.
Returning to your original question on how to restart the watchdog: If you would have tried a search command on the CCS manual you would have found the command restart_wdt().
But I recommend to remove the WDT if not strictly required. |
|
 |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Nov 22, 2004 4:30 pm |
|
|
| Quote: | | what you mean by in erased states | Most eprom's, eeprom's and flash eprom's will read as 0xff when erased. This has to do with some physical properties of these devices.
Most eeprom's have an erase command to erase large blocks of memory, but the 24FC515 doesn't. This eeprom combines the erase and write command, so there is no need for a seperate erase command. There is no technical reason as to why you should initialize the device to a certain value, but it seems with this device that you are free to choose whatever value you like; I would choose as it's 0xff more compatible to other eeproms. |
|
 |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Jul 07, 2005 1:12 pm |
|
|
| That's what I2C is for. Yes, it supports multiple devices on the same bus. The devices need to be addressable if you have more than 1 of the same type. Not all eeproms are this way. You can find the information in the data sheet of the IC that you are using. |
|
 |
|