Hi all
I have some code I need to test and would like a little help.
It does not entirely function as I originally intended and I need to make sure I understand the flow of the data as I had much help with it.
The code is hereView attachment SimpleTimer-2.asm.txt
The psuedo code originally was
Is swB held while device powered on
if so do adc conversion and store result in EEPROM
if not read EEPROM for lvc setting and monitor voltage. Cutoff circuit below this value. Also read EEPROM for timer setting and led flashes and flash led to indicate timer setting.
if swA pressed increment timer by 5 minutes and flash led a number of times to represent the time interval set. Copy both timer setting and led flashes to EEPROM and save for future use next time device powered on.
if swA incremented past 6 go back to 1
if swB pressed then start 1 minute timer to allow moving device into water then start timer interval for relay afterwards
if swB held again turn device off
and as it has evolved it has become
Read EEPROM for flashes, time on and time off and put display results on led
If swA pressed increment flashes and use same value to increment timer and store in EEPROM then flash led corresponding number of times and debounce button
If swB pressed then setup 6 minute timer? and copy to EEPROM and then flash led again?
There seem to be a few issues as I see it
Can someone confirm, all the EEPROM locations read at the beginning seem to be the same address. How does the code differentiate between reading flashes, offtimer and on timer?
What is the purpose of the ontimer and how long is it set for?
I have built the circuit and tested it and it seems to increment the timer and flashes each time I power on and off.
If it does the adc conversion at the start of the code as it presently does then it will keep setting the current battery voltage as the low voltage cutoff point and never run the timer wont it?
I need to sort this out and also get help setting up the first low voltage cutoff setting. I have a dc power pack that outputs 8.9V so I was going to use that as the first setting point for the low voltage cutoff.
Any help with this would be appreciated.
I have some code I need to test and would like a little help.
It does not entirely function as I originally intended and I need to make sure I understand the flow of the data as I had much help with it.
The code is hereView attachment SimpleTimer-2.asm.txt
The psuedo code originally was
Is swB held while device powered on
if so do adc conversion and store result in EEPROM
if not read EEPROM for lvc setting and monitor voltage. Cutoff circuit below this value. Also read EEPROM for timer setting and led flashes and flash led to indicate timer setting.
if swA pressed increment timer by 5 minutes and flash led a number of times to represent the time interval set. Copy both timer setting and led flashes to EEPROM and save for future use next time device powered on.
if swA incremented past 6 go back to 1
if swB pressed then start 1 minute timer to allow moving device into water then start timer interval for relay afterwards
if swB held again turn device off
and as it has evolved it has become
Read EEPROM for flashes, time on and time off and put display results on led
If swA pressed increment flashes and use same value to increment timer and store in EEPROM then flash led corresponding number of times and debounce button
If swB pressed then setup 6 minute timer? and copy to EEPROM and then flash led again?
There seem to be a few issues as I see it
Can someone confirm, all the EEPROM locations read at the beginning seem to be the same address. How does the code differentiate between reading flashes, offtimer and on timer?
What is the purpose of the ontimer and how long is it set for?
I have built the circuit and tested it and it seems to increment the timer and flashes each time I power on and off.
If it does the adc conversion at the start of the code as it presently does then it will keep setting the current battery voltage as the low voltage cutoff point and never run the timer wont it?
I need to sort this out and also get help setting up the first low voltage cutoff setting. I have a dc power pack that outputs 8.9V so I was going to use that as the first setting point for the low voltage cutoff.
Any help with this would be appreciated.