This commit is contained in:
Bluepr1nt
2016-03-01 16:16:49 +01:00
parent 722ed25352
commit 905575fd5e
5 changed files with 117 additions and 386 deletions
+53 -330
View File
@@ -3,29 +3,29 @@ MIC-Week4.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 00000270 2**0
0 .data 00000000 00800100 00800100 00000176 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 0000021c 00000000 00000000 00000054 2**1
1 .text 00000122 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 00000030 00000000 00000000 00000270 2**0
2 .comment 00000030 00000000 00000000 00000176 2**0
CONTENTS, READONLY
3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000002a0 2**2
3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000001a8 2**2
CONTENTS, READONLY
4 .debug_aranges 00000060 00000000 00000000 000002dc 2**0
4 .debug_aranges 00000068 00000000 00000000 000001e4 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_info 00000b1c 00000000 00000000 0000033c 2**0
5 .debug_info 00000b91 00000000 00000000 0000024c 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 0000021b 00000000 00000000 00000e58 2**0
6 .debug_abbrev 00000253 00000000 00000000 00000ddd 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_line 00000602 00000000 00000000 00001073 2**0
7 .debug_line 00000654 00000000 00000000 00001030 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_frame 000000a4 00000000 00000000 00001678 2**2
8 .debug_frame 000000b4 00000000 00000000 00001684 2**2
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00000214 00000000 00000000 0000171c 2**0
9 .debug_str 00000222 00000000 00000000 00001738 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 000004ab 00000000 00000000 00001930 2**0
10 .debug_loc 000004be 00000000 00000000 0000195a 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000130 00000000 00000000 00001ddb 2**0
11 .debug_ranges 00000138 00000000 00000000 00001e18 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
@@ -123,8 +123,8 @@ Disassembly of section .text:
a2: a0 30 cpi r26, 0x00 ; 0
a4: b2 07 cpc r27, r18
a6: e1 f7 brne .-8 ; 0xa0 <.do_clear_bss_loop>
a8: a5 d0 rcall .+330 ; 0x1f4 <main>
aa: b6 c0 rjmp .+364 ; 0x218 <_exit>
a8: 28 d0 rcall .+80 ; 0xfa <main>
aa: 39 c0 rjmp .+114 ; 0x11e <_exit>
000000ac <__bad_interrupt>:
ac: a9 cf rjmp .-174 ; 0x0 <__vectors>
@@ -181,351 +181,74 @@ void adcInit( void )
f0: 86 b9 out 0x06, r24 ; 6
f2: 08 95 ret
000000f4 <alleKleuren>:
000000f4 <setWithButton>:
}
}
int alleKleuren(void)
int setWithButton(void)
{
DDRB = 0xFF; // set PORTB for compare output
f4: 8f ef ldi r24, 0xFF ; 255
f6: 87 bb out 0x17, r24 ; 23
timer1Init();
f8: eb df rcall .-42 ; 0xd0 <timer1Init>
wait(100);
fa: 84 e6 ldi r24, 0x64 ; 100
fc: 90 e0 ldi r25, 0x00 ; 0
fe: d7 df rcall .-82 ; 0xae <wait>
}
// Set pulse width for Blue on pin PB5, 0=off, 255=max
void setBlue( unsigned char blue )
{
OCR1C = blue;
100: 0f 2e mov r0, r31
102: f8 e7 ldi r31, 0x78 ; 120
104: cf 2e mov r12, r31
106: d1 2c mov r13, r1
108: f0 2d mov r31, r0
timer1Init();
wait(100);
while (1)
if( (0b00000001 & PINC) != 0)
f4: 98 99 sbic 0x13, 0 ; 19
{
int delta = 1;
10a: 88 24 eor r8, r8
10c: 83 94 inc r8
10e: 91 2c mov r9, r1
110: 77 24 eor r7, r7
112: 7a 94 dec r7
114: 61 2c mov r6, r1
ADCSRA |= BIT(6);
f6: 36 9a sbi 0x06, 6 ; 6
}
}
f8: 08 95 ret
// Set pulse width for RED on pin PB5, 0=off, 255=max
void setRed( unsigned char red )
{
OCR1A = red;
116: 1b bc out 0x2b, r1 ; 43
118: 1a bc out 0x2a, r1 ; 42
}
// Set pulse width for Blue on pin PB5, 0=off, 255=max
void setBlue( unsigned char blue )
{
OCR1C = blue;
11a: f6 01 movw r30, r12
11c: 11 82 std Z+1, r1 ; 0x01
11e: 10 82 st Z, r1
}
// Set pulse width for Green on pin PB5, 0=off, 255=max
void setGreen( unsigned char green )
{
OCR1B = green;
120: 19 bc out 0x29, r1 ; 41
122: 18 bc out 0x28, r1 ; 40
int delta2 = 1;
setRed (0);
setBlue(0);
setGreen(0);
for (int red = 0; red<=255; red+=delta)
124: 00 e0 ldi r16, 0x00 ; 0
126: 10 e0 ldi r17, 0x00 ; 0
timer1Init();
wait(100);
while (1)
{
int delta = 1;
128: c8 2d mov r28, r8
12a: d9 2d mov r29, r9
12c: c8 01 movw r24, r16
12e: 99 27 eor r25, r25
}
// Set pulse width for RED on pin PB5, 0=off, 255=max
void setRed( unsigned char red )
{
OCR1A = red;
130: 9b bd out 0x2b, r25 ; 43
132: 8a bd out 0x2a, r24 ; 42
setGreen(0);
for (int red = 0; red<=255; red+=delta)
{
setRed( red ); // 8-bits PWM on pin OCR1a
delta += 2; // progressive steps up
134: 22 96 adiw r28, 0x02 ; 2
wait(100); // delay of 100 ms (busy waiting)
136: 84 e6 ldi r24, 0x64 ; 100
138: 90 e0 ldi r25, 0x00 ; 0
13a: b9 df rcall .-142 ; 0xae <wait>
int delta2 = 1;
setRed (0);
setBlue(0);
setGreen(0);
for (int red = 0; red<=255; red+=delta)
13c: 0c 0f add r16, r28
13e: 1d 1f adc r17, r29
140: 0f 3f cpi r16, 0xFF ; 255
142: 11 05 cpc r17, r1
144: 99 f3 breq .-26 ; 0x12c <alleKleuren+0x38>
146: 94 f3 brlt .-28 ; 0x12c <alleKleuren+0x38>
148: e1 2c mov r14, r1
14a: f1 2c mov r15, r1
14c: 08 2d mov r16, r8
14e: 19 2d mov r17, r9
150: c7 01 movw r24, r14
152: 99 27 eor r25, r25
}
// Set pulse width for Green on pin PB5, 0=off, 255=max
void setGreen( unsigned char green )
{
OCR1B = green;
154: 99 bd out 0x29, r25 ; 41
156: 88 bd out 0x28, r24 ; 40
}
for (int green = 0; green<=255; green+=delta1)
{
setGreen( green ); // 8-bits PWM on pin OCR1a
delta1 += 2; // progressive steps up
158: 0e 5f subi r16, 0xFE ; 254
15a: 1f 4f sbci r17, 0xFF ; 255
wait(100); // delay of 100 ms (busy waiting)
15c: 84 e6 ldi r24, 0x64 ; 100
15e: 90 e0 ldi r25, 0x00 ; 0
160: a6 df rcall .-180 ; 0xae <wait>
setRed( red ); // 8-bits PWM on pin OCR1a
delta += 2; // progressive steps up
wait(100); // delay of 100 ms (busy waiting)
}
for (int green = 0; green<=255; green+=delta1)
162: e0 0e add r14, r16
164: f1 1e adc r15, r17
166: ef ef ldi r30, 0xFF ; 255
168: ee 16 cp r14, r30
16a: f1 04 cpc r15, r1
16c: 89 f3 breq .-30 ; 0x150 <alleKleuren+0x5c>
16e: 84 f3 brlt .-32 ; 0x150 <alleKleuren+0x5c>
170: a1 2c mov r10, r1
172: b1 2c mov r11, r1
174: e8 2c mov r14, r8
176: f9 2c mov r15, r9
178: c5 01 movw r24, r10
17a: 99 27 eor r25, r25
}
// Set pulse width for Blue on pin PB5, 0=off, 255=max
void setBlue( unsigned char blue )
{
OCR1C = blue;
17c: f6 01 movw r30, r12
17e: 91 83 std Z+1, r25 ; 0x01
180: 80 83 st Z, r24
}
for (int blue = 0; blue<=255; blue+=delta2)
{
setBlue( blue ); // 8-bits PWM on pin OCR1a
delta2 += 2; // progressive steps up
182: f2 e0 ldi r31, 0x02 ; 2
184: ef 0e add r14, r31
186: f1 1c adc r15, r1
wait(100); // delay of 100 ms (busy waiting)
188: 84 e6 ldi r24, 0x64 ; 100
18a: 90 e0 ldi r25, 0x00 ; 0
18c: 90 df rcall .-224 ; 0xae <wait>
setGreen( green ); // 8-bits PWM on pin OCR1a
delta1 += 2; // progressive steps up
wait(100); // delay of 100 ms (busy waiting)
}
for (int blue = 0; blue<=255; blue+=delta2)
18e: ae 0c add r10, r14
190: bf 1c adc r11, r15
192: 8f ef ldi r24, 0xFF ; 255
194: a8 16 cp r10, r24
196: b1 04 cpc r11, r1
198: 79 f3 breq .-34 ; 0x178 <alleKleuren+0x84>
19a: 74 f3 brlt .-36 ; 0x178 <alleKleuren+0x84>
19c: a7 2c mov r10, r7
19e: b6 2c mov r11, r6
1a0: c5 01 movw r24, r10
1a2: 99 27 eor r25, r25
}
// Set pulse width for RED on pin PB5, 0=off, 255=max
void setRed( unsigned char red )
{
OCR1A = red;
1a4: 9b bd out 0x2b, r25 ; 43
1a6: 8a bd out 0x2a, r24 ; 42
}
for (int red = 255; red>=0; red-=delta)
{
setRed( red ); // 8-bits PWM on pin OCR1a
delta -= 2; // progressive steps down
1a8: 22 97 sbiw r28, 0x02 ; 2
wait(100); // delay of 100 ms (busy waiting)
1aa: 84 e6 ldi r24, 0x64 ; 100
1ac: 90 e0 ldi r25, 0x00 ; 0
1ae: 7f df rcall .-258 ; 0xae <wait>
setBlue( blue ); // 8-bits PWM on pin OCR1a
delta2 += 2; // progressive steps up
wait(100); // delay of 100 ms (busy waiting)
}
for (int red = 255; red>=0; red-=delta)
1b0: ac 1a sub r10, r28
1b2: bd 0a sbc r11, r29
1b4: aa f7 brpl .-22 ; 0x1a0 <alleKleuren+0xac>
1b6: c7 2d mov r28, r7
1b8: d6 2d mov r29, r6
1ba: ce 01 movw r24, r28
1bc: 99 27 eor r25, r25
}
// Set pulse width for Green on pin PB5, 0=off, 255=max
void setGreen( unsigned char green )
{
OCR1B = green;
1be: 99 bd out 0x29, r25 ; 41
1c0: 88 bd out 0x28, r24 ; 40
}
for (int green = 255; green>=0; green-=delta1)
{
setGreen( green ); // 8-bits PWM on pin OCR1a
delta1 -= 2; // progressive steps up
1c2: 02 50 subi r16, 0x02 ; 2
1c4: 11 09 sbc r17, r1
wait(100); // delay of 100 ms (busy waiting)
1c6: 84 e6 ldi r24, 0x64 ; 100
1c8: 90 e0 ldi r25, 0x00 ; 0
1ca: 71 df rcall .-286 ; 0xae <wait>
setRed( red ); // 8-bits PWM on pin OCR1a
delta -= 2; // progressive steps down
wait(100); // delay of 100 ms (busy waiting)
}
for (int green = 255; green>=0; green-=delta1)
1cc: c0 1b sub r28, r16
1ce: d1 0b sbc r29, r17
1d0: a2 f7 brpl .-24 ; 0x1ba <alleKleuren+0xc6>
1d2: c7 2d mov r28, r7
1d4: d6 2d mov r29, r6
1d6: ce 01 movw r24, r28
1d8: 99 27 eor r25, r25
}
// Set pulse width for Blue on pin PB5, 0=off, 255=max
void setBlue( unsigned char blue )
{
OCR1C = blue;
1da: f6 01 movw r30, r12
1dc: 91 83 std Z+1, r25 ; 0x01
1de: 80 83 st Z, r24
}
for (int blue = 255; blue>=0; blue-=delta2)
{
setBlue( blue ); // 8-bits PWM on pin OCR1a
delta2 -= 2; // progressive steps up
1e0: f2 e0 ldi r31, 0x02 ; 2
1e2: ef 1a sub r14, r31
1e4: f1 08 sbc r15, r1
wait(100); // delay of 100 ms (busy waiting)
1e6: 84 e6 ldi r24, 0x64 ; 100
1e8: 90 e0 ldi r25, 0x00 ; 0
1ea: 61 df rcall .-318 ; 0xae <wait>
setGreen( green ); // 8-bits PWM on pin OCR1a
delta1 -= 2; // progressive steps up
wait(100); // delay of 100 ms (busy waiting)
}
for (int blue = 255; blue>=0; blue-=delta2)
1ec: ce 19 sub r28, r14
1ee: df 09 sbc r29, r15
1f0: 92 f7 brpl .-28 ; 0x1d6 <alleKleuren+0xe2>
1f2: 91 cf rjmp .-222 ; 0x116 <alleKleuren+0x22>
000001f4 <main>:
000000fa <main>:
// Main program: Counting on T1
int main( void )
{
DDRB = 0xFF;
1f4: 8f ef ldi r24, 0xFF ; 255
1f6: 87 bb out 0x17, r24 ; 23
fa: 8f ef ldi r24, 0xFF ; 255
fc: 87 bb out 0x17, r24 ; 23
DDRF = 0x00; // set PORTF for input (ADC)
1f8: 10 92 61 00 sts 0x0061, r1
fe: 10 92 61 00 sts 0x0061, r1
DDRA = 0xFF; // set PORTA for output
1fc: 8a bb out 0x1a, r24 ; 26
102: 8a bb out 0x1a, r24 ; 26
adcInit(); // initialize ADC
1fe: 75 df rcall .-278 ; 0xea <adcInit>
104: f2 df rcall .-28 ; 0xea <adcInit>
timer1Init();
200: 67 df rcall .-306 ; 0xd0 <timer1Init>
106: e4 df rcall .-56 ; 0xd0 <timer1Init>
while (1)
{
ADCSRA |= BIT(6); // Start ADC
202: 36 9a sbi 0x06, 6 ; 6
//ADCSRA |= BIT(6); // Start ADC
while ( ADCSRA & BIT(6) ) ; // Wait for completion
204: 36 99 sbic 0x06, 6 ; 6
206: fe cf rjmp .-4 ; 0x204 <main+0x10>
setRed(ADCH); // Show MSB (bit 9:2) of ADC
208: 85 b1 in r24, 0x05 ; 5
108: 36 99 sbic 0x06, 6 ; 6
10a: fe cf rjmp .-4 ; 0x108 <main+0xe>
setRed(ADCH);
10c: 85 b1 in r24, 0x05 ; 5
}
// Set pulse width for RED on pin PB5, 0=off, 255=max
void setRed( unsigned char red )
{
OCR1A = red;
20a: 90 e0 ldi r25, 0x00 ; 0
20c: 9b bd out 0x2b, r25 ; 43
20e: 8a bd out 0x2a, r24 ; 42
while (1)
{
ADCSRA |= BIT(6); // Start ADC
10e: 90 e0 ldi r25, 0x00 ; 0
110: 9b bd out 0x2b, r25 ; 43
112: 8a bd out 0x2a, r24 ; 42
//ADCSRA |= BIT(6); // Start ADC
while ( ADCSRA & BIT(6) ) ; // Wait for completion
setRed(ADCH); // Show MSB (bit 9:2) of ADC
setRed(ADCH);
//setBlue(ADCH);
//setGreen(ADCH);
wait(100); // every 50 ms (busy waiting)
210: 84 e6 ldi r24, 0x64 ; 100
212: 90 e0 ldi r25, 0x00 ; 0
214: 4c df rcall .-360 ; 0xae <wait>
114: 84 e6 ldi r24, 0x64 ; 100
116: 90 e0 ldi r25, 0x00 ; 0
118: ca df rcall .-108 ; 0xae <wait>
//alleKleuren();
//opgaveextra();
alleKleuren();
216: 6e df rcall .-292 ; 0xf4 <alleKleuren>
setWithButton();
11a: ec df rcall .-40 ; 0xf4 <setWithButton>
}
11c: f5 cf rjmp .-22 ; 0x108 <main+0xe>
00000218 <_exit>:
218: f8 94 cli
0000011e <_exit>:
11e: f8 94 cli
0000021a <__stop_program>:
21a: ff cf rjmp .-2 ; 0x21a <__stop_program>
00000120 <__stop_program>:
120: ff cf rjmp .-2 ; 0x120 <__stop_program>
+34 -32
View File
@@ -16,6 +16,8 @@ Discarded input sections
.text.setGreen
0x00000000 0x8 main.o
.text.setBlue 0x00000000 0xc main.o
.text.alleKleuren
0x00000000 0x132 main.o
.text.opgaveextra
0x00000000 0x1f2 main.o
.bss.hours 0x00000000 0x2 main.o
@@ -171,7 +173,7 @@ END GROUP
.rela.plt
*(.rela.plt)
.text 0x00000000 0x21c
.text 0x00000000 0x122
*(.vectors)
.vectors 0x00000000 0x8c C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.0.90/gcc/dev/atmega128/avr51/crtatmega128.o
0x00000000 __vector_default
@@ -270,16 +272,16 @@ END GROUP
0x000000d0 timer1Init
.text.adcInit 0x000000ea 0xa main.o
0x000000ea adcInit
.text.alleKleuren
0x000000f4 0x100 main.o
0x000000f4 alleKleuren
.text.main 0x000001f4 0x24 main.o
0x000001f4 main
0x00000218 . = ALIGN (0x2)
.text.setWithButton
0x000000f4 0x6 main.o
0x000000f4 setWithButton
.text.main 0x000000fa 0x24 main.o
0x000000fa main
0x0000011e . = ALIGN (0x2)
*(.fini9)
.fini9 0x00000218 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o)
0x00000218 _exit
0x00000218 exit
.fini9 0x0000011e 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o)
0x0000011e _exit
0x0000011e exit
*(.fini9)
*(.fini8)
*(.fini8)
@@ -298,11 +300,11 @@ END GROUP
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x00000218 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o)
.fini0 0x0000011e 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr51\libgcc.a(_exit.o)
*(.fini0)
0x0000021c _etext = .
0x00000122 _etext = .
.data 0x00800100 0x0 load address 0x0000021c
.data 0x00800100 0x0 load address 0x00000122
0x00800100 PROVIDE (__data_start, .)
*(.data)
*(.data*)
@@ -319,8 +321,8 @@ END GROUP
*(.bss*)
*(COMMON)
0x00800100 PROVIDE (__bss_end, .)
0x0000021c __data_load_start = LOADADDR (.data)
0x0000021c __data_load_end = (__data_load_start + SIZEOF (.data))
0x00000122 __data_load_start = LOADADDR (.data)
0x00000122 __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x00800100 0x0
0x00800100 PROVIDE (__noinit_start, .)
@@ -391,38 +393,38 @@ END GROUP
.debug_sfnames
*(.debug_sfnames)
.debug_aranges 0x00000000 0x60
.debug_aranges 0x00000000 0x68
*(.debug_aranges)
.debug_aranges
0x00000000 0x60 main.o
0x00000000 0x68 main.o
.debug_pubnames
*(.debug_pubnames)
.debug_info 0x00000000 0xb1c
.debug_info 0x00000000 0xb91
*(.debug_info .gnu.linkonce.wi.*)
.debug_info 0x00000000 0xb1c main.o
.debug_info 0x00000000 0xb91 main.o
.debug_abbrev 0x00000000 0x21b
.debug_abbrev 0x00000000 0x253
*(.debug_abbrev)
.debug_abbrev 0x00000000 0x21b main.o
.debug_abbrev 0x00000000 0x253 main.o
.debug_line 0x00000000 0x602
.debug_line 0x00000000 0x654
*(.debug_line .debug_line.* .debug_line_end)
.debug_line 0x00000000 0x602 main.o
.debug_line 0x00000000 0x654 main.o
.debug_frame 0x00000000 0xa4
.debug_frame 0x00000000 0xb4
*(.debug_frame)
.debug_frame 0x00000000 0xa4 main.o
.debug_frame 0x00000000 0xb4 main.o
.debug_str 0x00000000 0x214
.debug_str 0x00000000 0x222
*(.debug_str)
.debug_str 0x00000000 0x214 main.o
0x248 (size before relaxing)
.debug_str 0x00000000 0x222 main.o
0x256 (size before relaxing)
.debug_loc 0x00000000 0x4ab
.debug_loc 0x00000000 0x4be
*(.debug_loc)
.debug_loc 0x00000000 0x4ab main.o
.debug_loc 0x00000000 0x4be main.o
.debug_macinfo
*(.debug_macinfo)
@@ -442,9 +444,9 @@ END GROUP
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges 0x00000000 0x130
.debug_ranges 0x00000000 0x138
*(.debug_ranges)
.debug_ranges 0x00000000 0x130 main.o
.debug_ranges 0x00000000 0x138 main.o
.debug_macro
*(.debug_macro)
+5 -20
View File
@@ -9,28 +9,13 @@ S113006025C0000023C0000021C000001FC0000004
S11300701DC000001BC0000019C0000017C0000014
S113008015C0000013C0000011C0000011241FBEE1
S1130090CFEFD0E1DEBFCDBF21E0A0E0B1E001C0F1
S11300A01D92A030B207E1F7A5D0B6C0A9CF1816AB
S11300A01D92A030B207E1F728D039C0A9CF1816A5
S11300B019066CF420E030E0EFECF7E03197F1F74B
S11300C000C000002F5F3F4F28173907A9F7089594
S11300D01BBC1ABC19BC18BC109279001092780091
S11300E089EA8FBD8BE08EBD089581EE87B986E8DD
S11300F086B908958FEF87BBEBDF84E690E0D7DF06
S11301000F2EF8E7CF2ED12CF02D88248394912C38
S113011077247A94612C1BBC1ABCF60111821082DC
S113012019BC18BC00E010E0C82DD92DC8019927CE
S11301309BBD8ABD229684E690E0B9DF0C0F1D1F9B
S11301400F3F110599F394F3E12CF12C082D192D8F
S1130150C701992799BD88BD0E5F1F4F84E690E0C3
S1130160A6DFE00EF11EEFEFEE16F10489F384F33F
S1130170A12CB12CE82CF92CC5019927F601918307
S11301808083F2E0EF0EF11C84E690E090DFAE0C89
S1130190BF1C8FEFA816B10479F374F3A72CB62C07
S11301A0C50199279BBD8ABD229784E690E07FDF35
S11301B0AC1ABD0AAAF7C72DD62DCE01992799BD31
S11301C088BD0250110984E690E071DFC01BD10B99
S11301D0A2F7C72DD62DCE019927F60191838083EE
S11301E0F2E0EF1AF10884E690E061DFCE19DF094E
S11301F092F791CF8FEF87BB109261008ABB75DFB6
S113020067DF369A3699FECF85B190E09BBD8ABDF3
S10F021084E690E04CDF6EDFF894FFCF32
S11300F086B908959899369A08958FEF87BB109220
S113010061008ABBF2DFE4DF3699FECF85B190E06F
S11301109BBD8ABD84E690E0CADFECDFF5CFF8949E
S1050120FFCF0B
S9030000FC
+25 -4
View File
@@ -87,12 +87,23 @@ int main( void )
while (1)
{
ADCSRA |= BIT(6); // Start ADC
//ADCSRA |= BIT(6); // Start ADC
while ( ADCSRA & BIT(6) ) ; // Wait for completion
setRed(ADCH); // Show MSB (bit 9:2) of ADC
setRed(ADCH);
//setBlue(ADCH);
//setGreen(ADCH);
wait(100); // every 50 ms (busy waiting)
//alleKleuren();
//opgaveextra();
alleKleuren();
setWithButton();
}
}
int setWithButton(void)
{
if( (0b00000001 & PINC) != 0)
{
ADCSRA |= BIT(6);
}
}
@@ -101,12 +112,14 @@ int alleKleuren(void)
DDRB = 0xFF; // set PORTB for compare output
timer1Init();
wait(100);
;
while (1)
{
int delta = 1;
int delta1 = 1;
int delta2 = 1;
int delta = 1;
setRed (0);
setBlue(0);
setGreen(0);
@@ -145,6 +158,13 @@ int alleKleuren(void)
delta1 -= 2; // progressive steps up
wait(100); // delay of 100 ms (busy waiting)
}
for (int red = 0; red<=255; red+=delta)
{
setRed( red ); // 8-bits PWM on pin OCR1a
delta += 2; // progressive steps up
wait(100); // delay of 100 ms (busy waiting)
}
for (int blue = 255; blue>=0; blue-=delta2)
{
@@ -152,6 +172,7 @@ int alleKleuren(void)
delta2 -= 2; // progressive steps up
wait(100); // delay of 100 ms (busy waiting)
}
}
}