Difference between revisions of "U23 2008-2/Gruppe4"
(→2. Projektabend (27. Oktober)) |
(→Aufgabe) |
||
Line 97: | Line 97: | ||
'''Code:''' | '''Code:''' | ||
<source lang ="c"> | <source lang ="c"> | ||
+ | #include <avr/io.h> | ||
+ | #include <string.h> | ||
+ | #include <stdio.h> | ||
+ | #include <avr/pgmspace.h> | ||
+ | #include "uart.h" | ||
+ | |||
+ | static void zeitmessen(); | ||
+ | |||
+ | int main(void) | ||
+ | { | ||
+ | uint8_t status; | ||
+ | status = 0; | ||
+ | |||
+ | /* initialize serial uart */ | ||
+ | uart_init(); | ||
+ | |||
+ | /* configure irrx as input */ | ||
+ | DDRC &= ~_BV(PC3); | ||
+ | |||
+ | /* init led pin as output */ | ||
+ | DDRD |= _BV(PD3); | ||
+ | |||
+ | |||
+ | |||
+ | while(1) { | ||
+ | /* if ir rx is high, turn off led */ | ||
+ | if (PINC & _BV(PC3)) | ||
+ | { | ||
+ | if (status==1) | ||
+ | { | ||
+ | uart_printf("aus"); | ||
+ | status=0; | ||
+ | } | ||
+ | |||
+ | PORTD &= ~_BV(PD3); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if (status==0) | ||
+ | { | ||
+ | uart_printf("an"); | ||
+ | status=1; | ||
+ | } | ||
+ | |||
+ | PORTD |= _BV(PD3); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | static void zeitmessen() | ||
+ | { | ||
+ | |||
+ | } | ||
</source> | </source> | ||
− | |||
=== Aufgabe zur Vorbereitung === | === Aufgabe zur Vorbereitung === |
Revision as of 21:14, 30 October 2008
Contents
Mitglieder
- Christian
- Steffen
- Stefan
- Martin
1. Projektabend (20. Oktober)
Aufgabe
Eine LED soll zum leuchten gebracht werden.
Code:
<source lang ="c">
- include <avr/io.h>
int main(void) {
/* PC4 als Ausgang konfig. */ DDRC = &b10000; /* PC4 auf high setzen */ PORTC = &b10000; /* Endlosschleife */ while(1){ }
}
</source>
Aufgabe zur Vorbereitung
Eine LED Sequenz
Code:
<source lang ="c">
- include <avr/io.h>
- include <util/delay.h>
static void led_ausgabe(uint8_t led, uint16_t zeit);
int main(void)
{
uint16_t anzeigedauer = 1000; /* Ausgaenge konfig. */ DDRC = (1 << DDC4); DDRD = (1 << DDD3) | (1 << DDD6) | (1 << DDD7); /* Animation */ while(1){ led_ausgabe (0b1000,anzeigedauer); led_ausgabe (0b0100,anzeigedauer); led_ausgabe (0b0010,anzeigedauer); led_ausgabe (0b0001,anzeigedauer); }
}
static void led_ausgabe(uint8_t led, uint16_t zeit) {
if (led & 0b1){ PORTC |= (1 << DDC4); } else{ PORTC &= ~(1 << DDC4);}
if (led & 0b10){ PORTD |= (1 << DDD3);} else{ PORTD &= ~(1 << DDD3);} if (led & 0b100){ PORTD |= (1 << DDD6);} else{ PORTD &= ~(1 << DDD6);} if (led & 0b1000){ PORTD |= (1 << DDD7);} else{ PORTD &= ~(1 << DDD7);} _delay_ms(zeit);
} </source>
2. Projektabend (27. Oktober)
Aufgabe
Code: <source lang ="c">
- include <avr/io.h>
- include <string.h>
- include <stdio.h>
- include <avr/pgmspace.h>
- include "uart.h"
static void zeitmessen();
int main(void) {
uint8_t status; status = 0;
/* initialize serial uart */ uart_init();
/* configure irrx as input */ DDRC &= ~_BV(PC3);
/* init led pin as output */ DDRD |= _BV(PD3);
while(1) { /* if ir rx is high, turn off led */ if (PINC & _BV(PC3))
{
if (status==1)
{ uart_printf("aus"); status=0; }
PORTD &= ~_BV(PD3); } else { if (status==0) { uart_printf("an"); status=1; }
PORTD |= _BV(PD3); }
}
}
static void zeitmessen() {
} </source>
Aufgabe zur Vorbereitung
Code: <source lang ="c"> </source>
3. Projektabend (03. November)
Aufgabe
Code: <source lang ="c"> </source>
Aufgabe zur Vorbereitung
Code: <source lang ="c"> </source>
4. Projektabend (10. November)
Aufgabe
Code: <source lang ="c"> </source>
Aufgabe zur Vorbereitung
Code: <source lang ="c"> </source>
5. Projektabend (17. November)
Aufgabe
Code: <source lang ="c"> </source>
Aufgabe zur Vorbereitung
Code: <source lang ="c"> </source>
6. Projektabend (24. November)
Aufgabe
Code: <source lang ="c"> </source>
Aufgabe zur Vorbereitung
Code: <source lang ="c"> </source>
Abschlussabend (vorrausichtlich 27. November)
Vorstellung der Ergebnisse