Subversion Repositories group.electronics

Rev

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

Rev 51 Rev 52
Line 83... Line 83...
83
  // Setup timer0 - Enable overflow, 8 times prescaler
83
  // Setup timer0 - Enable overflow, 8 times prescaler
84
	TIMSK0 = (1<<TOIE0);			// Eable timer overflow for Timer0
84
	TIMSK0 = (1<<TOIE0);			// Eable timer overflow for Timer0
85
	TCNT0 = 0x00;				// Set Timer0 to 0
85
	TCNT0 = 0x00;				// Set Timer0 to 0
86
	TCCR0B = (1<< CS01) ;			// /8 prescaler
86
	TCCR0B = (1<< CS01) ;			// /8 prescaler
87
 
87
 
88
  sei();
88
	sei();
89
 
89
 
90
//	i2c_beginTransmission(0x27);
-
 
91
//	i2c_writeByte(0x01);
-
 
92
//	i2c_endTransmission(1);
-
 
93
 
90
 
94
	i2c_master();
91
	i2c_master();
95
	lcd_init();
92
	lcd_init();
96
	lcd_createChar(0x00, emblock);
93
	lcd_createChar(0x00, emblock);
97
 
94
 
98
  wdt_enable(WDTO_8S);
95
	wdt_enable(WDTO_8S);
99
 
96
 
100
	uint16_t oldsystime = systime; 
97
	uint16_t oldsystime = systime; 
101
	uint8_t oldpotVal = -1; 
98
	uint8_t oldpotVal = -1; 
102
 
99
 
103
	char strTime[] = {'T', 'i', 'm', 'e', ':', 0x00};
100
	char strTime[] = {'T', 'i', 'm', 'e', ':', 0x00};
Line 113... Line 110...
113
		itoa(systime, syschar, 10);
110
		itoa(systime, syschar, 10);
114
		syschar[5] = 0x00;
111
		syschar[5] = 0x00;
115
		lcd_overprint(syschar, 5, 6, 1);
112
		lcd_overprint(syschar, 5, 6, 1);
116
 
113
 
117
 
114
 
118
	uint8_t potVal = map_8(analogRead(0), 0, 255, 0, 100);
115
		uint8_t potVal = map_8(analogRead(0), 0, 255, 0, 100);
119
	if (potVal != oldpotVal) {		
116
		if (potVal != oldpotVal) {		
120
		lcd_pergraph(potVal, 0, 0);
117
			lcd_percent_graph(potVal, 0, 0);
121
		oldpotVal = potVal;
118
			oldpotVal = potVal;
122
		char pot[3];
119
			char pot[3];
123
		itoa(potVal, pot, 10);
120
			itoa(potVal, pot, 10);
124
		lcd_overprint(pot, 3, 12, 0);
121
			lcd_overprint(pot, 3, 12, 0);
125
		lcd_char(0x25);
122
			lcd_char(0x25);
126
	}
123
		}
127
	}
124
	}
128
  }
125
  }
129
}
126
}
130
 
127
 
131
uint8_t analogRead(uint8_t pin) {
128
uint8_t analogRead(uint8_t pin) {