Subversion Repositories group.electronics

Rev

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

Rev 42 Rev 43
Line 1... Line 1...
1
#include <avr/io.h>
1
#include <avr/io.h>
2
#include <avr/pgmspace.h>
2
#include <avr/pgmspace.h>
3
#include <avr/interrupt.h>
3
#include <avr/interrupt.h>
-
 
4
#include <avr/wdt.h>
4
 
5
 
5
#define F_CPU 12000000
6
#include "macros.h"
6
#include <util/delay.h>
7
#include <util/delay.h>
7
#include <avr/wdt.h>
-
 
8
 
8
 
9
#include <stdlib.h>
9
#include <stdlib.h>
10
#include <string.h>
10
#include <string.h>
11
 
11
 
12
#include "wire.h"
12
#include "wire.h"
Line 44... Line 44...
44
	PB5	- Input, Pullup		- Function select
44
	PB5	- Input, Pullup		- Function select
45
  */
45
  */
46
  DDRB		= 0B00001111;
46
  DDRB		= 0B00001111;
47
  PORTB 	= 0B00111111;
47
  PORTB 	= 0B00111111;
48
 
48
 
-
 
49
  DDRC		= 0B00000000;
-
 
50
  PORTC		= 0B00110000;
-
 
51
 
49
  /*
52
  /*
50
	PD0	- Input, Pullup, PCINT16	- Rotary 1a
53
	PD0	- Input, Pullup, PCINT16	- Rotary 1a
51
	PD1	- Input, Pullup, PCINT17	- Rotary 1b
54
	PD1	- Input, Pullup, PCINT17	- Rotary 1b
52
 
55
 
53
 
56
 
Line 65... Line 68...
65
  // Setup timer0 - Enable overflow, 8 times prescaler
68
  // Setup timer0 - Enable overflow, 8 times prescaler
66
	TIMSK0 = (1<<TOIE0);			// Eable timer overflow for Timer0
69
	TIMSK0 = (1<<TOIE0);			// Eable timer overflow for Timer0
67
	TCNT0 = 0x00;				// Set Timer0 to 0
70
	TCNT0 = 0x00;				// Set Timer0 to 0
68
	TCCR0B = (1<< CS01) ;			// /8 prescaler
71
	TCCR0B = (1<< CS01) ;			// /8 prescaler
69
 
72
 
70
	i2c_master();
73
  sei();
-
 
74
 
71
//	i2c_beginTransmission(0x27);
75
//	i2c_beginTransmission(0x27);
72
//	i2c_writeByte(0x01);
76
//	i2c_writeByte(0x01);
73
//	i2c_endTransmission(1);
77
//	i2c_endTransmission(1);
-
 
78
 
-
 
79
	i2c_master();
74
	lcd_init();
80
	lcd_init();
75
	lcd_char((uint8_t)'A');
-
 
76
 
81
 
-
 
82
	uint8_t chars = 9;
-
 
83
	char text[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I' };
77
 
84
 
-
 
85
	//uint8_t i = 0;
-
 
86
	//for (i=0; i<=chars; i++)
-
 
87
		//lcd_char((uint8_t) text[i]);
-
 
88
 
-
 
89
	lcd_char((uint8_t) 'a');
-
 
90
	lcd_char((uint8_t) 'b');
-
 
91
	lcd_char((uint8_t) 'c');
-
 
92
	lcd_char((uint8_t) 'd');
-
 
93
	lcd_char((uint8_t) 'e');
-
 
94
	lcd_char((uint8_t) 'f');
-
 
95
	lcd_char((uint8_t) 'g');
-
 
96
	lcd_char((uint8_t) 'h');
-
 
97
	lcd_char((uint8_t) 'i');
-
 
98
	lcd_char((uint8_t) 'j');
-
 
99
	lcd_char((uint8_t) 'k');
-
 
100
	lcd_char((uint8_t) 'l');
-
 
101
	lcd_char((uint8_t) 'm');
-
 
102
	lcd_char((uint8_t) 'n');
-
 
103
	lcd_char((uint8_t) 'o');
-
 
104
	lcd_char((uint8_t) 'p');
-
 
105
	lcd_char((uint8_t) 'q');
-
 
106
	lcd_char((uint8_t) 'r');
-
 
107
	lcd_char((uint8_t) 's');
-
 
108
	lcd_char((uint8_t) 't');
-
 
109
	lcd_char((uint8_t) 'u');
-
 
110
	lcd_char((uint8_t) 'v');
-
 
111
	lcd_char((uint8_t) 'w');
-
 
112
	lcd_char((uint8_t) 'x');
-
 
113
	lcd_char((uint8_t) 'y');
-
 
114
	lcd_char((uint8_t) 'z');
-
 
115
	lcd_char((uint8_t) '0');
-
 
116
	lcd_char((uint8_t) '1');
-
 
117
	lcd_char((uint8_t) '2');
-
 
118
	lcd_char((uint8_t) '3');
-
 
119
	lcd_char((uint8_t) '4');
-
 
120
 
-
 
121
 
-
 
122
 
78
  wdt_enable(WDTO_1S);
123
  wdt_enable(WDTO_8S);
79
  sei();
-
 
80
 
124
 
81
  for(;;) {
125
  for(;;) {
82
    wdt_reset();
126
    wdt_reset();
83
 
127
 
84
  }
128
  }