U23 2008/Gruppe1

From C4 Wiki
< U23 2008
Revision as of 15:34, 24 August 2008 by Pylon (talk | contribs) (Category)
Jump to: navigation, search

Gruppe1

Mitglieder:


-...(Hier eure Namen eintragen)
-Maike
-skullbocks
-Gesche
-Trella
-Smasher (Brille und anthrazit-farbenes dell notebook ;) )





Sourcecode, Projektabend1:

/*Dieses Programm lässt ein bestimmtes Muster auf unserem Testboard ablaufen*/

#include <avr/io.h>
#include <util/delay.h>
void lampe(uint8_t l)
{ 
	switch (l) 
	{
		case 0: PORTC ^= _BV(PC4);
			break;
		case 1: PORTD ^= _BV(PD3);
			break;
		case 2: PORTD ^= _BV(PD6);
			break;
		case 3: PORTD ^= _BV(PD7);
			break;
		default: break;
	}
}
void main(void) {
	/* config PD7 as output */

	DDRC = _BV(PC4);
	DDRD = _BV(PD3) | _BV(PD6) | _BV(PD7); 

	uint8_t ls[] = {0, 1, 0, 2, 1, 3, 2, 1, 3};
	uint8_t p=0;

	while(1) {
		//PORTD ^= _BV(PD7);
		uint8_t i;
		
		lampe(ls[p]);
		p++;
		for (i = 0; i < 76; i++) {
			/* wait 4 * 65536 cycles */
			_delay_loop_2(0);
		}
	}
	for ( ;; ) ;

}