Subversion Repositories group.electronics

Rev

Rev 53 | Rev 56 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 53 Rev 55
Line 103... Line 103...
103
  for(;;) {
103
  for(;;) {
104
    wdt_reset();
104
    wdt_reset();
105
 
105
 
106
	if (oldsystime != systime) {
106
	if (oldsystime != systime) {
107
		oldsystime = systime;
107
		oldsystime = systime;
108
		char syschar[6];
108
		char syschar[5];
109
		itoa(systime, syschar, 10);
109
		utoa(systime, syschar, 10);
110
		syschar[5] = 0x00;
-
 
111
		lcd_setCursor(10, 1);
-
 
112
		lcd_print_right(syschar);
110
		lcd_overprint_right(syschar, 11, 5, 1);
113
 
-
 
114
 
111
 
115
		uint8_t potVal = map_8(analogRead(0), 0, 255, 0, 100);
112
		uint8_t potVal = map_8(analogRead(0), 0, 255, 0, 100);
116
		if (potVal != oldpotVal) {		
113
		if (potVal != oldpotVal) {		
117
			lcd_percent_graph(potVal, 0, 0);
114
			lcd_percent_graph(potVal, 0, 0);
118
			oldpotVal = potVal;
115
			oldpotVal = potVal;
-
 
116
 
119
			char pot[3];
117
			char pot[3];
120
			itoa(potVal, pot, 10);
118
			utoa(potVal, pot, 10);
121
			lcd_setCursor(14, 0);
119
			lcd_overprint_right(pot, 3, 11, 0);
-
 
120
 
122
			lcd_print_right(pot);
121
			// Set percentage
123
			lcd_setCursor(15, 0);
122
			lcd_setCursor(15, 0);
124
			lcd_char(0x25);
123
			lcd_char(0x25);
125
		}
124
		}
126
	}
125
	}
127
  }
126
  }
Line 152... Line 151...
152
}
151
}
153
 
152
 
154
ISR(TIMER0_OVF_vect) {
153
ISR(TIMER0_OVF_vect) {
155
	xbi(PORTD, PD4);
154
	xbi(PORTD, PD4);
156
	tmr0_ovf++;
155
	tmr0_ovf++;
157
	if (tmr0_ovf>=58) {
156
	if (tmr0_ovf>=6) {
158
		xbi(PORTD, PD0);
157
		xbi(PORTD, PD0);
159
		systime++;
158
		systime++;
160
		tmr0_ovf = 0;
159
		tmr0_ovf = 0;
161
	}
160
	}
162
	
-
 
163
}
161
}
164
 
162
 
165
ISR(PCINT1_vect)
163
ISR(PCINT1_vect)
166
{
164
{
167
        // Save the state and work out which pin caused
165
        // Save the state and work out which pin caused