Hey Leute,

habe ein Verständnisproblem zum IRCollisiontestprogramm,
ich hab den IRSensor umgelötet, das Programm aufgespielt,
es klappt auch. Nur leider verstehe ich aufgrund der Microcontroller programmierung kein Wort von der Source.
Kann mir jemand die einzelnen Abläufe erklären, bzw. hat jemand das Programm ausdokumentiert?

Das wäre mir wirklich eine große Hilfe

Hier ist das Programm nochmal (quelle: AsuroWiki)

00001 /************************************************** *****************************
00002 *
00003 * Description: Asuro IR-Detektor Testprogramm
00004 *
00005 ************************************************** ***************************/
00006 /************************************************** *************************
00007 * *
00008 * This program is free software; you can redistribute it and/or modify *
00009 * it under the terms of the GNU General Public License as published by *
00010 * the Free Software Foundation; either version 2 of the License, or *
00011 * any later version. *
00012 ************************************************** *************************/
00013 #include "asuro.h"
00014 #include <stdlib.h>
00015
00016 static unsigned char ocr2 = 0x91;
00017
00018 void InitIRDetect(void)
00019 {
00020 UCSRB = 0;
00021 DDRD |= (1 << DDD1); // Port D1 als Ausgang
00022 PORTD &= ~(1 << PD1); // PD1 auf LOW
00023 OCR2 = ocr2;
00024 }
00025
00026 void InitUart(void)
00027 {
00028 OCR2 = 0x91; // duty cycle fuer 36kHz
00029 }
00030
00031 int main(void)
00032 {
00033
00034 unsigned char sw;
00035
00036 Init();
00037
00038 DDRD |= (1 << DDD1); // Port D1 als Ausgang
00039 PORTD &= ~(1 << PD1); // PD1 auf LOW
00040
00041 // InitIRDetect();
00042 while (1)
00043 {
00044 UCSRB = 0;
00045 OCR2 = 0xFE;
00046
00047 if (PIND & (1 << PD0))
00048 StatusLED(GREEN);
00049 else
00050 StatusLED(RED);
00051
00052 sw = PollSwitch();
00053 if (sw & 0x01)
00054 ocr2 = 0xFE; //Pulsbreite 1
00055 if (sw & 0x02)
00056 ocr2 = 0xFD; //Pulsbreite 2
00057 if (sw & 0x04)
00058 ocr2 = 0xFB; //Pulsbreite 4
00059 if (sw & 0x0
00060 ocr2 = 0xF7; //Pulsbreite 8
00061 if (sw & 0x10)
00062 ocr2 = 0xEF; //Pulsbreite 16
00063 if (sw & 0x20)
00064 ocr2 = 0x90; //Pulsbreite 110
00065
00066 if (sw)
00067 {
00068 OCR2 = 0x91;
00069 PrintInt(sw);
00070 SerPrint(" ");
00071 PrintInt(ocr2);
00072 SerPrint("\r\n");
00073 }
00074 // Msleep(100);
00075 }
00076 return 0;
00077 }