Browse Source

First Cube Test

Thomas Buck 12 years ago
parent
commit
a7b01721d2
2 changed files with 16 additions and 13 deletions
  1. 0
    4
      CubeFirmware/cube.c
  2. 16
    9
      CubeFirmware/main.c

+ 0
- 4
CubeFirmware/cube.c View File

@@ -57,10 +57,6 @@ uint8_t isFinished(void) {
57 57
 
58 58
 void init(void) {
59 59
 	uint8_t ctr = 0;
60
-	DDRD = 0xFF; // Mosfets as Output
61
-	DDRB = 0xFF;
62
-	DDRC = 0xFF; // Latch Enable
63
-	DDRA = 0xFF; // Latch Data
64 60
 
65 61
 	TCCR1A |= (1 << WGM12); // CTC Mode
66 62
 	TCCR1B |= (1 << CS10); // No prescaler

+ 16
- 9
CubeFirmware/main.c View File

@@ -32,22 +32,29 @@
32 32
 #endif
33 33
 
34 34
 int main(void) {
35
-	uint8_t i;
35
+	uint8_t i, j = 1;
36
+
37
+	DDRD = 0xFF; // Mosfets as Output
38
+	DDRB = 0xFF;
39
+	DDRC = 0xFF; // Latch Enable
40
+	DDRA = 0xFF; // Latch Data
36 41
 
37 42
 	// init(); // Initialize Cube Low-Level Code
38 43
 	uart_init(UART_BAUD_SELECT(19200, 16000000L)); // Initialize Serial
39 44
 
40 45
 
41
-	setFet(0xFF);
46
+	setFet(0x01);
42 47
 	// Blink led :)
43 48
 	while (1) {
44
-		 PORTB |= (1 << PB0);
45
-		_delay_ms(1000);
46
-		PORTB &= ~(1 << PB0);
47
-		_delay_ms(1000);
48
-		
49
-		//setFet(0);
50
-		//_delay_ms(10000);
49
+		for (i = 0; i < 8; i++) {
50
+			setLatch(i, j);
51
+			_delay_ms(100);
52
+		}
53
+		if (j < 128) {
54
+			j *= 2;
55
+		} else {
56
+			j = 1;
57
+		}
51 58
 	}
52 59
 
53 60
 	close();

Loading…
Cancel
Save