<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\hypertarget{main_8c}{}\doxysection{main.\+c-\/Dateireferenz}
\label{main_8c}\index{main.c@{main.c}}


BJ-\/\+Keyer, ein elektronischer Morsekeyer.  


{\ttfamily \#include \char`\"{}main.\+h\char`\"{}}\newline
Include-\/\+Abhängigkeitsdiagramm für main.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{main_8c__incl}
\end{center}
\end{figure}
\doxysubsection*{Funktionen}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{main_8c_a4472695bac138b033a3d7fcd42dd3153}{Init\+Timer}} (void)
\begin{DoxyCompactList}\small\item\em Initialsieren der Timer. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{main_8c_a7ce0a14b6e7779fbb2d9a05333792c41}{Init}} (void)
\begin{DoxyCompactList}\small\item\em Initialisierung aller Variablen, Timer. \end{DoxyCompactList}\item 
\mbox{\hyperlink{main_8c_ad39420cdd896dd12c68e36313139d0a5}{ISR}} (TIMER1\+\_\+\+COMPA\+\_\+vect)
\begin{DoxyCompactList}\small\item\em 8 Bit Timer 1 ISR routine \end{DoxyCompactList}\item 
\mbox{\hyperlink{main_8c_aec43762dc86e029b395d4e5819192c2d}{ISR}} (TIMER0\+\_\+\+COMPA\+\_\+vect)
\begin{DoxyCompactList}\small\item\em 8 Bit Timer 0 ISR routine \end{DoxyCompactList}\item 
\mbox{\hyperlink{main_8c_a09ce999e15ad60b8a3f07d08af1946f9}{ISR}} (USART\+\_\+\+RX\+\_\+vect)
\begin{DoxyCompactList}\small\item\em Interrupt RX serielle Schnittstelle. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{main_8c_ab1f1ff64cfdd7f3c70e793afb9b0e3af}{Re\+Start}} (void)
\begin{DoxyCompactList}\small\item\em Initialisierung bei Reset und Power On. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{main_8c_a840291bc02cba5474a4cb46a9b9566fe}{main}} (void)
\begin{DoxyCompactList}\small\item\em One Infinite Loop. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variablen}
\begin{DoxyCompactItemize}
\item 
const unsigned char {\bfseries sinewave} \mbox{[}$\,$\mbox{]}
\end{DoxyCompactItemize}


\doxysubsection{Ausführliche Beschreibung}
BJ-\/\+Keyer, ein elektronischer Morsekeyer. 

\begin{DoxyDate}{Datum}
2023-\/09-\/05 
\end{DoxyDate}
\begin{DoxyAuthor}{Autor}
Tom, DL7\+BJ 
\end{DoxyAuthor}
\begin{DoxyVersion}{Version}
1.\+03 \begin{DoxyVerb}        Morsekeyer für 3 Handtasten und 3 Paddle mit einem 
        Sinus Mithörton und Ausgängen für 2 Transceiver

        OLED Funktionen von https://github.com/Sylaina/oled-display
        Encoder Funktionen von https://www.mikrocontroller.net/articles/Drehgeber
\end{DoxyVerb}

\end{DoxyVersion}
\begin{DoxyVerb} History
 ------------------------------------------------------------------------------
 2012-05-24 DL7BJ   erste Version
 2013-05-10 DL7BJ   Generierung des Mithörtons als Sinus mit PWM/DDS
 2013-07-15 DL7BJ   Änderungen der Keyerfunktionen
 2013-07-19 DL7BJ   Beep/Boop (Spielkram)
 2013-10-20 DL7BJ   Änderungen der PWM Funktionen für besseren Sinus
 2022-04-10 DL7BJ   erste Leiterplatten für Prototyp (bisher Lochraster)
 2022-09-02 DL7BJ   viele Softwareänderungen, neuer Filter für PWM
 2022-09-11 DL7BJ   Encoder, LC-Display, Frontplatine "entsorgt"
 2023-06-28 DL7BJ   Port Anpassungen an neue Leiterplatte V1.01
 2023-07-29 DL7BJ   Menü für Einstellungen implementiert
 2023-08-06 DL7BJ   Quelltexte umstrukturiert, Aufteilung
 2023-08-25 DL7BJ   Code dokumentiert und aufgeräumt
 2023-09-03 DL7BJ   Funktionen für die Speichertasten hinzugefügt
 2023-09-04 DL7BK   Programmierung der Textspeicher über serielle Schnittstelle
 
 ATMEGA328(P)
                             ----------
  (PCINT14/_RESET)     PC6 -| 1      28|- PC5 (ADC5/SCL/PCINT13)
  (PCINT16/RXD)        PD0 -| 2      27|- PC4 (ADC4/SDA/PCINT12)
  (PCINT17/TXT)        PD1 -| 3      26|- PC3 (ADC3/PCINT11)
  (PCINT18/INT0)       PD2 -| 4      25|- PC2 (ADC2/PCINT10)
  (PCINT19/OC2B/INT1)  PD3 -| 5      24|- PC1 (ADC1/PCINT9)
  (PCINT20/XCK/T0)     PD4 -| 6      23|- PC0 (ADC0/PCINT8)
                       VCC -| 7      22|- GND
                       GND -| 8      21|- AREF
  (PCINT6/XTAL1/TOSC1) PB6 -| 9      20|- AVCC
  (PCINT7/XTAL2/TOSC2) PB7 -|10      19|- PB5 (SCK/PCINT5)
  (PCINT21/OC0B/T1)    PD5 -|11      18|- PB4 (MISO/PCINT4)
  (PCINT22/OC0A/AIN0)  PD6 -|12      17|- PB3 (MOSI/OC2A/PCINT3)
  (PCINT23/AIN1)       PD7 -|13      16|- PB2 (SS/OC1B/PCINT2)
  (PCINT0/CLK0/ICP1)   PB0 -|14      15|- PB1 (OC1A/PCINT1)
                             ----------
 
  Pin  1 - PC6  - Reset                  Pin 28 - PC5    - SCL Display
  Pin  2 - PD0  - RxD                    Pin 27 - PC4    - SDA Display
  Pin  3 - PD1  - TxD                    Pin 26 - PC3    - LED Key
  Pin  4 - PD2  - Left Paddle            Pin 25 - PC2    - TRX 2 Out
  Pin  5 - PD3  - Right Paddle           Pin 24 - PC1    - TRX 1 Out
  Pin  6 - PD4  - Straight Key           Pin 23 - PC0    - Mem 4
                                         Pin 19 - PB5    - Mem 5
  Pin 11 - PD5  - Mem 1                  Pin 18 - PB4    - _Audio SD
  Pin 12 - PD6  - Mem 2                  Pin 17 - OC2A   - Audio PWM output
  Pin 13 - PD7  - Mem 3                  Pin 16 - PB2    - Encoder Switch
  Pin 14 - PB0  - Encoder A              Pin 15 - PB1    - Encoder B\end{DoxyVerb}
 

\doxysubsection{Dokumentation der Funktionen}
\mbox{\Hypertarget{main_8c_a7ce0a14b6e7779fbb2d9a05333792c41}\label{main_8c_a7ce0a14b6e7779fbb2d9a05333792c41}} 
\index{main.c@{main.c}!Init@{Init}}
\index{Init@{Init}!main.c@{main.c}}
\doxysubsubsection{\texorpdfstring{Init()}{Init()}}
{\footnotesize\ttfamily void Init (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Initialisierung aller Variablen, Timer. 


\begin{DoxyParams}{Parameter}
{\em none} &amp; \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} &amp; \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{main_8c_a4472695bac138b033a3d7fcd42dd3153}\label{main_8c_a4472695bac138b033a3d7fcd42dd3153}} 
\index{main.c@{main.c}!InitTimer@{InitTimer}}
\index{InitTimer@{InitTimer}!main.c@{main.c}}
\doxysubsubsection{\texorpdfstring{InitTimer()}{InitTimer()}}
{\footnotesize\ttfamily void Init\+Timer (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Initialsieren der Timer. 

\begin{DoxyVerb}    Alle Parameter der Timer basieren auf 16MHz Systemtakt.

    Timer 0  - 8 Bit timer für 1ms
    Timer 2  - 8 Bit timer für PWM zur Erzeugung des Sinustons
    Timer 1A - 16 Bit timer zur Erzeugung der Hüllkurve 
\end{DoxyVerb}
 
\begin{DoxyParams}{Parameter}
{\em none} &amp; \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} &amp; \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{main_8c_aec43762dc86e029b395d4e5819192c2d}\label{main_8c_aec43762dc86e029b395d4e5819192c2d}} 
\index{main.c@{main.c}!ISR@{ISR}}
\index{ISR@{ISR}!main.c@{main.c}}
\doxysubsubsection{\texorpdfstring{ISR()}{ISR()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily ISR (\begin{DoxyParamCaption}\item[{TIMER0\+\_\+\+COMPA\+\_\+vect}]{ }\end{DoxyParamCaption})}



8 Bit Timer 0 ISR routine 

\begin{DoxyVerb}    Der Timer 0 mit CTC Interrupt läuft mit einem Takt
    von einer Millisekunde Es werden mehrere Werte innerhalb 
    des Timerinterrupts verarbeitet.
\end{DoxyVerb}
 
\begin{DoxyParams}{Parameter}
{\em none} &amp; \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} &amp; \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{main_8c_ad39420cdd896dd12c68e36313139d0a5}\label{main_8c_ad39420cdd896dd12c68e36313139d0a5}} 
\index{main.c@{main.c}!ISR@{ISR}}
\index{ISR@{ISR}!main.c@{main.c}}
\doxysubsubsection{\texorpdfstring{ISR()}{ISR()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily ISR (\begin{DoxyParamCaption}\item[{TIMER1\+\_\+\+COMPA\+\_\+vect}]{ }\end{DoxyParamCaption})}



8 Bit Timer 1 ISR routine 

\begin{DoxyVerb}    Der Timer 1 lädt die Sinuswerte für die PWM
\end{DoxyVerb}
 
\begin{DoxyParams}{Parameter}
{\em none} &amp; \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} &amp; \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{main_8c_a09ce999e15ad60b8a3f07d08af1946f9}\label{main_8c_a09ce999e15ad60b8a3f07d08af1946f9}} 
\index{main.c@{main.c}!ISR@{ISR}}
\index{ISR@{ISR}!main.c@{main.c}}
\doxysubsubsection{\texorpdfstring{ISR()}{ISR()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily ISR (\begin{DoxyParamCaption}\item[{USART\+\_\+\+RX\+\_\+vect}]{ }\end{DoxyParamCaption})}



Interrupt RX serielle Schnittstelle. 


\begin{DoxyParams}{Parameter}
{\em none} &amp; \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} &amp; \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{main_8c_a840291bc02cba5474a4cb46a9b9566fe}\label{main_8c_a840291bc02cba5474a4cb46a9b9566fe}} 
\index{main.c@{main.c}!main@{main}}
\index{main@{main}!main.c@{main.c}}
\doxysubsubsection{\texorpdfstring{main()}{main()}}
{\footnotesize\ttfamily int main (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



One Infinite Loop. 


\begin{DoxyParams}{Parameter}
{\em none} &amp; \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} &amp; \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{main_8c_ab1f1ff64cfdd7f3c70e793afb9b0e3af}\label{main_8c_ab1f1ff64cfdd7f3c70e793afb9b0e3af}} 
\index{main.c@{main.c}!ReStart@{ReStart}}
\index{ReStart@{ReStart}!main.c@{main.c}}
\doxysubsubsection{\texorpdfstring{ReStart()}{ReStart()}}
{\footnotesize\ttfamily void Re\+Start (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Initialisierung bei Reset und Power On. 


\begin{DoxyParams}{Parameter}
{\em none} &amp; \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Rückgabewerte}
{\em none} &amp; \\
\hline
\end{DoxyRetVals}


\doxysubsection{Variablen-\/\+Dokumentation}
\mbox{\Hypertarget{main_8c_aaa3b9b932db0e7ef48036fde65c16cfd}\label{main_8c_aaa3b9b932db0e7ef48036fde65c16cfd}} 
\index{main.c@{main.c}!sinewave@{sinewave}}
\index{sinewave@{sinewave}!main.c@{main.c}}
\doxysubsubsection{\texorpdfstring{sinewave}{sinewave}}
{\footnotesize\ttfamily const unsigned char sinewave\mbox{[}$\,$\mbox{]}}

{\bfseries Initialisierung\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{    0x00, 0x01, 0x02, 0x05, 0x0a, 0x0f, 0x15, 0x1d, 0x25, 0x2f, 0x39, 0x43, 0x4f, 0x5a, 0x67, 0x73, }
\DoxyCodeLine{    0x80, 0x8c, 0x98, 0xa5, 0xb0, 0xbc, 0xc6, 0xd0, 0xda, 0xe2, 0xea, 0xf0, 0xf5, 0xfa, 0xfd, 0xfe, }
\DoxyCodeLine{    0xff, 0xfe, 0xfd, 0xfa, 0xf5, 0xf0, 0xea, 0xe2, 0xda, 0xd0, 0xc6, 0xbc, 0xb0, 0xa5, 0x98, 0x8c, }
\DoxyCodeLine{    0x80, 0x73, 0x67, 0x5a, 0x4f, 0x43, 0x39, 0x2f, 0x25, 0x1d, 0x15, 0x0f, 0x0a, 0x05, 0x02, 0x01}
\DoxyCodeLine{\}}

\end{DoxyCode}
</pre></body></html>