Hi all. I am trying to program an ATtiny13V to hold a pin low for 30 days then fire the pin high for 20 min before doing it again. I'm trying to formulate the best way to go about attacking this problem.
Any suggestions are appretiated but this is what I have so far.
The ATtiny13V has a 10MHz internal clock and the data sheet says the maximum prescaler is Fclk_io/1024. This will give me an effective clock period of 102 uSec.
The onboard counter is 8bits wide which means it will be full after (2^8 * 102uSec) = 26.2mSec.
My thought was I could then begin storing the number of times the counter finishes and store that in an empty byte. However this would only give me a counter multiple of 256 which would only be 6.71sec. And there are 2,592,000sec in 30days.
Long story less long, I would have to count continuously through 4 bytes before I met the 30day mark.
I would then need to figure out exactly what byte value marked the end of the 30th day then switch to the 20min length code.
I assume that what I'm proposing is possible. But is this the best way to go about doing this?
Is there any suggestions or ideas to make this easier?
And any direction to sample code would be a great help. Thanks in advance!