|
|
View previous topic :: View next topic |
Author |
Message |
gautham Guest
|
Keeping track of interrupts |
Posted: Tue Jun 05, 2007 10:02 am |
|
|
hi,
I am starting to work on PIC uc and am a novice. I have an issue while coding.I gotta write a program which wakes up at particular intervals adc convert and record the data on the eeprom. I am able to achive it by using ADC interupts and sleep_ulpwu() function. But the issue is that i am not able to track the interrupts to update the rom address so that in gets written in next next address and not on the same address. How do i keep track how many interrupts have occured.
thanks |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Tue Jun 05, 2007 10:20 am |
|
|
May I ask some questions:
- Do you miss the interrupts?
- How often do you sample?
- How much data do you need to write to EEPROM? _________________ Read the label, before opening a can of worms. |
|
|
Ttelmah Guest
|
|
Posted: Tue Jun 05, 2007 10:21 am |
|
|
You don't want to use ADC interrupts for this. ADC_interrupts, signfy when an ADC conversion has _completed_, and you have nothing to signal the start of such a conversion. Don't get so complex. Just use the sleep_ulpwu function, and when you awaken, perform a normal ADC conversion, write this to the EEPROM, increment a counter, and loop back to the sleep. The counter will tell you where to write the value. The memories inside the PIC, are static during the sleep, and hold their values.
Beware also though, of how quickly the EEPROM 'life' can be used by this type of operation. Though improved by changing the location each time, after only a few cycles (depending on the size of the EEPROM, and how many bytes you write each time), you will be back to writing the same locaion, and unless you sleep for a relatively very long time, it can be suprising how quickly the life gets used.....
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|