Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Cleanup

  • Loading branch information...
commit 597c8a0bcdba0637d152a640f53f2a3faaa726a1 1 parent 1dd7b66
Severin Schols authored October 31, 2011
153  main.c.old
... ...
@@ -1,153 +0,0 @@
1  
-#include <inttypes.h>
2  
-#include <avr/io.h>
3  
-#include <util/delay.h> 
4  
-#define DELAY_MS 0
5  
-
6  
-//Row on/off defines to toggle Bit Pins
7  
-// Port D:  Pin0    Pin1  Pin2  Pin3  Pin4
8  
-//          Row_EN  N/A   Row0  Row1  Row2
9  
-#define ROWS_ON   PORTD &= ~(1<<PD3);
10  
-#define ROWS_OFF  PORTD  |= (1<<PD3);
11  
-#define ROW0_ON   PORTD  |= (1<<PD7);
12  
-#define ROW0_OFF  PORTD &= ~(1<<PD7);
13  
-#define ROW1_ON   PORTD  |= (1<<PD6);
14  
-#define ROW1_OFF  PORTD &= ~(1<<PD6);
15  
-#define ROW2_ON   PORTD  |= (1<<PD5);
16  
-#define ROW2_OFF  PORTD &= ~(1<<PD5);
17  
-
18  
-// definitions for the Row selection
19  
-#define ROW1 ROW0_OFF ROW1_OFF ROW2_OFF
20  
-#define ROW2 ROW0_OFF ROW1_OFF ROW2_ON
21  
-#define ROW3 ROW0_OFF ROW1_ON ROW2_OFF
22  
-#define ROW4 ROW0_OFF ROW1_ON ROW2_ON
23  
-#define ROW5 ROW0_ON ROW1_OFF ROW2_OFF
24  
-#define ROW6 ROW0_ON ROW1_OFF ROW2_ON
25  
-#define ROW7 ROW0_ON ROW1_ON ROW2_OFF
26  
-#define ROW8 ROW0_ON ROW1_ON ROW2_ON
27  
-
28  
-// definitions for the shift register controls
29  
-#define MR_HI   PORTA |= (1<<PA0);
30  
-#define MR_LO   PORTA &= ~(1<<PA0);
31  
-#define DATA_HI PORTA |= (1<<PA2);
32  
-#define DATA_LO PORTA &= ~(1<<PA2);
33  
-#define OE_HI   PORTA |= (1<<PA4);
34  
-#define OE_LO   PORTA &= ~(1<<PA4);
35  
-
36  
-#define SHCP_HI  PORTA |=  (1<<PA3);
37  
-#define SHCP_LO  PORTA &= ~(1<<PA3);
38  
-
39  
-#define STCP_HI  PORTA |=  (1<<PA1);
40  
-#define STCP_LO  PORTA &= ~(1<<PA1);
41  
-
42  
-int main (void){
43  
-  DDRA = 0xFF;  /* Set our output register to output */
44  
-  DDRD = 0xFF;
45  
-
46  
-  DATA_HI
47  
-  MR_HI  
48  
-  OE_LO
49  
-  ROWS_ON
50  
-  SHCP_LO
51  
-	STCP_LO
52  
-	int rowcount=1;
53  
-	int paintcount=0;
54  
-  int i;
55  
-  int pixels[128] = 
56  
-           {1,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
57  
-            1,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
58  
-            1,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
59  
-            1,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0};
60  
-  int pixels2[128] = 
61  
-           {0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
62  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
63  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
64  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1};
65  
-  int pixels3[128] = 
66  
-           {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
67  
-            1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
68  
-            1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
69  
-            1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
70  
-  
71  
-  int *pixel1, *pixel2, *pixel_temp;
72  
-  pixel1 = &pixels[0]; //pixels
73  
-  pixel2 = &pixels2[0]; //pixels2
74  
-	
75  
-	while(42) {
76  
-		switch(rowcount){
77  
-		case 1:
78  
-			ROW1
79  
-			rowcount=2;
80  
-			break;
81  
-		case 2:
82  
-			ROW2
83  
-			rowcount=3;
84  
-			break;
85  
-		case 3:
86  
-			ROW3
87  
-			rowcount=4;
88  
-			break;
89  
-		case 4:
90  
-			ROW4
91  
-			rowcount=5;
92  
-			break;
93  
-		case 5:
94  
-			ROW5
95  
-			rowcount=6;
96  
-			break;
97  
-		case 6:
98  
-			ROW6
99  
-			rowcount=7;
100  
-			break;
101  
-		case 7:
102  
-			ROW7
103  
-			rowcount=8;
104  
-			break;
105  
-		case 8:
106  
-			ROW8
107  
-			rowcount=1;
108  
-			break;
109  
-		}   
110  
-    
111  
-   for(i=0;i<128;i++){
112  
-      SHCP_LO
113  
-      _delay_ms(DELAY_MS);
114  
-      switch(rowcount-1){
115  
-        case 0:
116  
-        case 1:
117  
-        case 2:
118  
-        case 3:
119  
-        if(*(pixel1+i) == 0){
120  
-          DATA_LO
121  
-        } else {
122  
-          DATA_HI
123  
-        }
124  
-        break;
125  
-        case 4:
126  
-        case 5:
127  
-        case 6:
128  
-        case 7:   
129  
-        if(*(pixel2+i) == 0){
130  
-          DATA_LO
131  
-        } else {
132  
-          DATA_HI
133  
-        }
134  
-        break;
135  
-      }
136  
-      SHCP_HI
137  
-      _delay_ms(DELAY_MS);
138  
-    }
139  
-    STCP_HI
140  
-    _delay_ms(DELAY_MS);
141  
-    STCP_LO
142  
-    _delay_ms(DELAY_MS);
143  
-    paintcount++;
144  
-    if(paintcount > 1000) {
145  
-      paintcount = 0;
146  
-      pixel_temp = pixel2;
147  
-      pixel2 = pixel1;
148  
-      pixel1 = pixel_temp;
149  
-    }
150  
-  }
151  
-return 0;
152  
-}
153  
-
183  main.c.volker
... ...
@@ -1,183 +0,0 @@
1  
-#include <inttypes.h>
2  
-#include <avr/io.h>
3  
-#include <util/delay.h> 
4  
-#define DELAY_MS 0
5  
-
6  
-//Row on/off defines to toggle Bit Pins
7  
-// Port D:  Pin0    Pin1  Pin2  Pin3  Pin4
8  
-//          Row_EN  N/A   Row0  Row1  Row2
9  
-#define ROWS_ON   PORTD &= ~(1<<PD3);
10  
-#define ROWS_OFF  PORTD  |= (1<<PD3);
11  
-#define ROW0_ON   PORTD  |= (1<<PD7);
12  
-#define ROW0_OFF  PORTD &= ~(1<<PD7);
13  
-#define ROW1_ON   PORTD  |= (1<<PD6);
14  
-#define ROW1_OFF  PORTD &= ~(1<<PD6);
15  
-#define ROW2_ON   PORTD  |= (1<<PD5);
16  
-#define ROW2_OFF  PORTD &= ~(1<<PD5);
17  
-
18  
-// definitions for the Row selection
19  
-#define ROW1 ROW0_OFF ROW1_OFF ROW2_OFF
20  
-#define ROW2 ROW0_OFF ROW1_OFF ROW2_ON
21  
-#define ROW3 ROW0_OFF ROW1_ON ROW2_OFF
22  
-#define ROW4 ROW0_OFF ROW1_ON ROW2_ON
23  
-#define ROW5 ROW0_ON ROW1_OFF ROW2_OFF
24  
-#define ROW6 ROW0_ON ROW1_OFF ROW2_ON
25  
-#define ROW7 ROW0_ON ROW1_ON ROW2_OFF
26  
-#define ROW8 ROW0_ON ROW1_ON ROW2_ON
27  
-
28  
-// definitions for the shift register controls
29  
-#define MR_HI   PORTA |= (1<<PA0);
30  
-#define MR_LO   PORTA &= ~(1<<PA0);
31  
-#define DATA_HI PORTA |= (1<<PA2);
32  
-#define DATA_LO PORTA &= ~(1<<PA2);
33  
-#define OE_HI   PORTA |= (1<<PA4);
34  
-#define OE_LO   PORTA &= ~(1<<PA4);
35  
-
36  
-#define SHCP_HI  PORTA |=  (1<<PA3);
37  
-#define SHCP_LO  PORTA &= ~(1<<PA3);
38  
-
39  
-#define STCP_HI  PORTA |=  (1<<PA1);
40  
-#define STCP_LO  PORTA &= ~(1<<PA1);
41  
-
42  
-void showframe (char frame[1024]);
43  
-
44  
-int main (void){
45  
-  DDRA = 0xFF;  /* Set our output register to output */
46  
-  DDRD = 0xFF;
47  
-
48  
-  DATA_HI
49  
-  MR_LO
50  
-  MR_HI  
51  
-  OE_LO
52  
-  ROWS_ON
53  
-  SHCP_LO
54  
-	STCP_LO
55  
-	int rowcount=1;
56  
-	int paintcount=0;
57  
-  int i;
58  
-            
59  
-  char frame1[1024] =
60  
-           {1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
61  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
62  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
63  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
64  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
65  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
66  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
67  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
68  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
69  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
70  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
71  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
72  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
73  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
74  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
75  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
76  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
77  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
78  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
79  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
80  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
81  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
82  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
83  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
84  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
85  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
86  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
87  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
88  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
89  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
90  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
91  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1};
92  
-            
93  
-  char frame2[1024] =
94  
-           {0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
95  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
96  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
97  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
98  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
99  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
100  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
101  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
102  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
103  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
104  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
105  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
106  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
107  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
108  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
109  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
110  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
111  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
112  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
113  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
114  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
115  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
116  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
117  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
118  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
119  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
120  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
121  
-            0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
122  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
123  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
124  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
125  
-            1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0};  
126  
-  
127  
-  char *pixel1, *pixel2, *pixel_temp, *frameToShow, *pframe1, *pframe2, *pframe_temp;
128  
-  
129  
-  pframe1 = &frame1[0];
130  
-  pframe2 = &frame2[0];
131  
-  frameToShow = pframe1;
132  
-	
133  
-	while(42) {
134  
-    showframe(frame1);
135  
-  }
136  
-  return 0;
137  
-}
138  
-
139  
-void showframe (char frame[1024]){
140  
-  int i,j;
141  
-  
142  
-  for(i=0; i<8; i++){
143  
-    switch(i){
144  
-		case 0:
145  
-			ROW1
146  
-			break;
147  
-		case 1:
148  
-			ROW2
149  
-			break;
150  
-		case 2:
151  
-			ROW3
152  
-			break;
153  
-		case 3:
154  
-			ROW4
155  
-			break;
156  
-		case 4:
157  
-			ROW5
158  
-			break;
159  
-		case 5:
160  
-			ROW6
161  
-			break;
162  
-		case 6:
163  
-			ROW7
164  
-			break;
165  
-		case 7:
166  
-			ROW8
167  
-			break;
168  
-		}
169  
-    for(j=127; j>=0; j--){
170  
-      SHCP_LO
171  
-      if(frame[(128*i)+(j%32)+((j/32)*256)] == 0){
172  
-        DATA_LO
173  
-      } else {
174  
-        DATA_HI
175  
-      }
176  
-      SHCP_HI
177  
-    }
178  
-    STCP_HI
179  
-    _delay_ms(DELAY_MS);
180  
-    STCP_LO
181  
-  }
182  
-}
183  
-

0 notes on commit 597c8a0

Please sign in to comment.
Something went wrong with that request. Please try again.