robbycon
Newbie level 3
I am writing a program on this PIC18 that takes measurements, writes to flash, then waits around for 15 minutes (or some other user-defined time period) until it does it again. It is supposed to do this for 2 weeks, so I need to conserve battery.
What's in my mind is to put the PIC in sleep mode, then trigger an interrupt off an internal timer.
After some reading, I see that the sleep() function shuts off all timers, but I can keep Timer1 running if I can put the PIC in SEC_RUN mode. The OSCCON<1:0> bits (which are also known as SCS1:SCS0) need to be set to 01, and maybe some other bits need to be set as well.
What I don't know is what the actual code looks like to implement this. I don't know if this is some inserted assembly code (I don't know how to do that). Can somebody help me? Thank you.
What's in my mind is to put the PIC in sleep mode, then trigger an interrupt off an internal timer.
After some reading, I see that the sleep() function shuts off all timers, but I can keep Timer1 running if I can put the PIC in SEC_RUN mode. The OSCCON<1:0> bits (which are also known as SCS1:SCS0) need to be set to 01, and maybe some other bits need to be set as well.
What I don't know is what the actual code looks like to implement this. I don't know if this is some inserted assembly code (I don't know how to do that). Can somebody help me? Thank you.