kdbrown
Joined: 13 Aug 2009 Posts: 12 Location: Canada/Vancouver Island
|
Posted: Tue Jul 20, 2010 4:51 pm Post subject: Heavily modified code to allow several options. |
|
|
I keep forgetting to post this, but I took Jared's code and modified it to have several options:
| Code: | 1) Added the compile-time switch PHASE_CORRECT to select a different PWM mode for the two outputs. The main advantage of the different mode is that there is no output pulse at a value of zero. This means that power-off mechanical zero calibration is sufficient for the "left end" calibration. Since the divisor is a multiple of 510 vs 256, some extra work has to be done!;
2) Added MINUTES_DOWN so that reverse/upside down meters can be used. Note that this does not change the polarity of the signal, rather it changes the output-with-time direction;
3) Added HOURS_DOWN similarly;
4) Added TWENTY_FOUR_HOURS to select a 24 hour clock display.
5) Added up-edge switch debouncing. This makes it more tolerant of switch noise;
6) Put in a second=0 statement to clear the seconds when minutes are set;
7) Added in another option, CONTINUOUS_HOURS, to do the hours "continuously";
8) Added in yet another option, CONTINUOUS_MINUTES, to do the minutes "continuously". |
As far as I know, all 6 options can be turned on independantly, giving 2**6 new modes of operation.
If anybody wants too get their hands on the code, just ask me and I will send it to you, however be forewarned that I also modified the code to work with the AVR Studio and an attached programmer: it does not work as an Arduino anymore. (In fact I could not get my board--a non Sharebrained one, to work as an Arduino at all, whatever the problem was. Since I already had the Atmel tools at hand and have experience with them, I prefered to use what I had and knew.) If there is enough interest then I will post the code somewhere instead of emailing it upon request. |
|