Thanks again for the reply...so hardware wise all I need to do is swap those resistors for the voltage sense circuit as you suggested and it'll work without any software modifications? As for the temperature circuit I'll leave the functionality out of this driver and simply use the inbuilt sensor of the Tiny25. I'll still have to implement it for the other circuit of course.
Now I do want to learn stuff here, so I've read through the code and I'm trying to determine how the overtemp function works. It appears to function in exactly the same way as the battery voltage sensing as well.
From what I can tell you have defined 2 variables called BATTMON and TEMPMON and assigned them each a set number - 125 and 87 respectively. Further on you also call bytes 'lowbattcounter' and 'overtempcounter' and set these to zero. Where do these variables come from? Are they fixed bytes in the Tiny25 eeprom (or whatever it is called)?
There is then a loop that is responsible for dropping the drive PWM based on either the battery level or the temperature sensed by the Tiny25. You then read the adc value. If this adc value is lower than the predefined threshold (125) and the low battery counter is greater than 8 (why 8 btw? Is this 8 measurements per second?) it turns the PWM down. If it's not lower it resets the lowbattcounter to zero. The temperature sensing appears to work identically except that it uses the tempread byte instead of the adc result.
Have I understood this correctly, even if my terminology is out?
Quick note - when you reset the lowbattcounter variable, you do so with lowbattcounter=0. When you reset the overtempcounter you did it with overtempcounter==0. Too many equal signs, or was the '==' intentional?
Thanks again. Might try and compile this before I hit the sack for the evening.
- Matt
EDIT:
I had to had 'const' to the start of the 'PROGMEM byte' line. Also you used a close parentheses instead of a close braces in the tempread line of the if loop we were talking about above. I also had to correct the == I was asking about above as the debug was telling me the line had no effect.
It compiles fine now. When I get time I will load it onto my Tiny25 driver and see if it runs :)
I wonder if it will work if I just remove the voltage sense resistors just to test the code works?
EDIT 2:
Fuses! I still have not tried loading the firmware, but what fuses should I use/how do I determine what fuses I should use? Actually - what do the fuses do lol!?