Skip to content
Snippets Groups Projects
Commit 00cdb194 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Vorbereitung 26.11.2018

parent ee3d3568
Branches
No related tags found
No related merge requests found
Showing
with 1146 additions and 17 deletions
No preview for this file type
......@@ -20,7 +20,7 @@
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
% README: Vertiefung: Bibliotheken, Differentialgleichungen
% README: Präprozessor-Makros, Bibliothek verwenden (Beispiel: GTK+), Differentialgleichungen
\documentclass[10pt,t]{beamer}
......@@ -69,13 +69,13 @@
\item[3.2] Bibliotheken einbinden
\color{orange}
\item[3.3] Bibliotheken verwenden
\color{red}
\color{black}
\item[3.4] Projekt organisieren: make
\end{itemize}
\item[\textbf{4}] \textbf{Hardwarenahe Programmierung}
\item[\textbf{5}] \textbf{Algorithmen}
\begin{itemize}
\color{medgreen}
\color{orange}
\item[5.1] Differentialgleichungen
\color{black}
\vspace*{-0.1cm}
......@@ -205,20 +205,19 @@
Compiler-Aufruf:
\begin{onlyenv}<4>
\begin{lstlisting}[style=terminal,gobble=10]
$ ¡gcc -Wall -O hello-gtk.c -pthread -I/usr/include/gtk
-3.0 -I/usr/include/at-spi2- atk/2.0 -I/usr/include/at-
spi-2.0 -I/usr/include/dbus-1 .0 -I/usr/lib/x86_64-linu
x-gnu/dbus-1.0/include -I/usr/ include/gtk-3.0 -I/usr/i
nclude/gio-unix-2.0/ -I/usr/inc lude/cairo -I/usr/inclu
de/pango-1.0 -I/usr/include/harf buzz -I/usr/include/pa
ngo-1.0 -I/usr/include/atk-1.0 -I /usr/include/cairo -I
/usr/include/pixman-1 -I/usr/inclu de/freetype2 -I/usr/
include/libpng16 -I/usr/include/gdk -pixbuf-2.0 -I/usr/
include/libpng16 -I/usr/include/glib -2.0 -I/usr/lib/x8
6_64-linux-gnu/glib-2.0/include -lgtk -3 -lgdk-3 -lpang
ocairo-1.0 -lpango-1.0 -latk-1.0 -lcai ro-gobject -lcai
ro -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject -2.0 -lglib-2.0
-o hello-gtk¿
$ ¡gcc -Wall -O hello-gtk.c -pthread -I/usr/include/gtk-
3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-sp
i-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-g
nu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/inclu
de/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pa
ngo-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.
0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/in
clude/pixman-1 -I/usr/include/freetype2 -I/usr/include/
libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/l
ibpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux
-gnu/glib-2.0/include -lgtk-3 -lgdk-3 -lpangocairo-1.0
-lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pix
buf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0-o hello-gtk¿
\end{lstlisting}
\vspace*{-1cm}
\end{onlyenv}
......@@ -466,6 +465,8 @@
\end{frame}
\iffalse
\setcounter{section}{2}
\section{Bibliotheken}
\setcounter{subsection}{3}
......@@ -541,6 +542,8 @@
\end{frame}
\fi
\nosectionnonumber{\inserttitle}
\begin{frame}
......@@ -557,6 +560,7 @@
\item[3.1] Der Präprozessor
\item[3.2] Bibliotheken einbinden
\item[3.3] Bibliotheken verwenden
\color{red}
\item[3.4] Projekt organisieren: make
\end{itemize}
\item[\textbf{4}] \textbf{Hardwarenahe Programmierung}
......
philosophy: philosophy.o answer.o
gcc philosophy.o answer.o -o philosophy
answer.o: answer.c answer.h
gcc -Wall -O answer.c -c
philosophy.o: philosophy.c answer.h
gcc -Wall -O philosophy.c -c
TARGET = philosophy
OBJECTS = philosophy.o answer.o
HEADERS = answer.h
CFLAGS = -Wall -O
$(TARGET): $(OBJECTS)
gcc $(OBJECTS) -o philosophy
answer.o: answer.c $(HEADERS)
gcc $(CFLAGS) answer.c -c
philosophy.o: philosophy.c $(HEADERS)
gcc $(CFLAGS) philosophy.c -c
clean:
rm -f $(OBJECTS) $(TARGET)
TARGET = philosophy
OBJECTS = philosophy.o answer.o
HEADERS = answer.h
CFLAGS = -Wall -O
$(TARGET): $(OBJECTS)
gcc $(OBJECTS) -o philosophy
%.o: %.c $(HEADERS)
gcc $(CFLAGS) $< -c
clean:
rm -f $(OBJECTS) $(TARGET)
#include "answer.h"
int answer (void)
{
return 23;
}
extern int answer (void);
#include <avr/io.h>
int main (void)
{
DDRA = 0xff;
DDRB = 0xff;
DDRC = 0xff;
DDRD = 0xff;
PORTA = 0x1f;
PORTB = 0x10;
PORTD = 0x10;
PORTC = 0xfc;
while (1);
return 0;
}
File added
This diff is collapsed.
File added
% hp-uebung-20181119.pdf - Exercises on Low-Level Programming / Applied Computer Sciences
% Copyright (C) 2013, 2015, 2016, 2017, 2018 Peter Gerwinski
%
% This document is free software: you can redistribute it and/or
% modify it either under the terms of the Creative Commons
% Attribution-ShareAlike 3.0 License, or under the terms of the
% GNU General Public License as published by the Free Software
% Foundation, either version 3 of the License, or (at your option)
% any later version.
%
% This document is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this document. If not, see <http://www.gnu.org/licenses/>.
%
% You should have received a copy of the Creative Commons
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
% README: Zahlensysteme, Mikro-Controller
\documentclass[a4paper]{article}
\usepackage{pgscript}
\begin{document}
\thispagestyle{empty}
\section*{Hardwarenahe Programmierung\\
Übungsaufgaben -- 26.\ November 2018}
Diese Übung enthält Punkteangaben wie in einer Klausur.
Um zu "`bestehen"', müssen Sie innerhalb von 70 Minuten
unter Verwendung ausschließlich zugelassener Hilfsmittel
14 Punkte (von insgesamt \totalpoints) erreichen.
\exercise{Zahlensysteme}
Wandeln Sie ohne Hilfsmittel
\begin{minipage}[t]{0.3\textwidth}
\begin{itemize}
\item
nach Dezimal:
\begin{itemize}
\item[(a)]
0010\,0000$_2$
\item[(b)]
42$_{16}$
\item[(c)]
17$_8$
\end{itemize}
\end{itemize}
\end{minipage}\hfill
\begin{minipage}[t]{0.3\textwidth}
\begin{itemize}
\item
nach Hexadezimal:
\begin{itemize}
\item[(d)]
0010\,0000$_2$
\item[(e)]
42$_{10}$
\item[(f)]
192.168.20.254$_{256}$
\end{itemize}
\end{itemize}
\end{minipage}\hfill
\begin{minipage}[t]{0.3\textwidth}
\begin{itemize}
\item
nach Binär:
\begin{itemize}
\item[(g)]
750$_8$
\item[(h)]
42$_{10}$
\item[(i)]
AFFE$_{16}$
\end{itemize}
\end{itemize}
\end{minipage}
\medskip
Berechnen Sie ohne Hilfsmittel:
\begin{itemize}
\item[(j)]
750$_8$ \& 666$_8$
\item[(k)]
A380$_{16}$ + B747$_{16}$
\item[(l)]
AFFE$_{16} >> 1$
\end{itemize}
Die tiefgestellte Zahl steht für die Basis des Zahlensystems.
Jede Teilaufgabe zählt 1 Punkt. \addtocounter{points}{12}
(In der Klausur sind Hilfsmittel zugelassen,
daher ist dies \emph{keine\/} typische Klausuraufgabe.)
\exercise{Mikro-Controller}
\begin{minipage}[t]{10cm}
An die vier Ports eines ATmega16-Mikro-Controllers sind Leuchtdioden angeschlossen:
\begin{itemize}
\item
von links nach rechts an die Ports A, B, C und D,
\item
von oben nach unten an die Bits Nr.\ 0 bis 7.
\end{itemize}
Wir betrachten das folgende Programm (\gitfile{hp}{20181126}{aufgabe-2.c}):
\begin{lstlisting}[gobble=6]
#include <avr/io.h>
int main (void)
{
DDRA = 0xff;
DDRB = 0xff;
DDRC = 0xff;
DDRD = 0xff;
PORTA = 0x1f;
PORTB = 0x10;
PORTD = 0x10;
PORTC = 0xfc;
while (1);
return 0;
}
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}[t]{3cm}
\strut\\[-\baselineskip]
\includegraphics[width=3cm]{leds.jpg}
\end{minipage}
\vspace*{-3cm}
\strut\hfill
\begin{minipage}{11.8cm}
\begin{itemize}
\item[(a)]
Was bewirkt dieses Programm? \points{4}
\item[(b)]
Wozu dienen die ersten vier Zeilen des Hauptprogramms? \points{2}
\item[(c)]
Was würde stattdessen die Zeile \lstinline{DDRA, DDRB, DDRC, DDRD = 0xff;} bewirken?
\points{2}
\item[(d)]
Schreiben Sie das Programm so um,
daß die durch das Programm dargestellte Figur spiegelverkehrt erscheint. \points{3}
\item[(e)]
Wozu dient das \lstinline{while (1)}? \points{2}
\item
Alle Antworten bitte mit Begründung.
\end{itemize}
\end{minipage}
\begin{flushright}
\textit{Viel Erfolg!}
\end{flushright}
\makeatletter
\immediate\write\@mainaux{\string\gdef\string\totalpoints{\arabic{points}}}
\makeatother
\end{document}
../common/io-ports-and-interrupts.pdf
\ No newline at end of file
../common/leds.jpg
\ No newline at end of file
../common/logo-hochschule-bochum-cvh-text-v2.pdf
\ No newline at end of file
../common/logo-hochschule-bochum.pdf
\ No newline at end of file
../common/pendulum.pdf
\ No newline at end of file
../common/pgscript.sty
\ No newline at end of file
../common/pgslides.sty
\ No newline at end of file
#include <stdio.h>
#include "answer.h"
int main (void)
{
printf ("The answer is %d.\n", answer ());
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment