100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Samenvatting Programmeren 1 - theorie embedded

Rating
-
Sold
1
Pages
62
Uploaded on
19-01-2023
Written in
2021/2022

Een samenvatting van de theorie van embedded, een subvak van programmeren 1 uit toegepaste informatica aan kdg.

Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
January 19, 2023
Number of pages
62
Written in
2021/2022
Type
Summary

Subjects

Content preview

PROGRAMMEREN
EMBEDDED C




KDG | 2021-22

,Inhoudsopgave

1. De hardware ............................................................................................................................................... 4

1.1 Arduino UNO board met microcontroller ATmega 328 ................................................................................ 4
1.1.1 Embedded systemen ............................................................................................................................ 4
1.1.2 Wat is Arduino? .................................................................................................................................... 4

1.2 Het Multifunctional Shield ............................................................................................................................ 5

1.3 ATmega328................................................................................................................................................... 6
1.3.1 De ATmega328 architectuur ................................................................................................................. 6
1.3.2 ATmega328 op de Arduino ................................................................................................................... 7
1.3.3 ATmega328 via VMA209 expansion shield op de Arduino ................................................................... 9

2. De programmeertaal C .............................................................................................................................. 10

2.1 Wat is C? ..................................................................................................................................................... 10
2.1.1 Belangrijkste kenmerken .................................................................................................................... 10
2.1.2 C libraries ............................................................................................................................................ 10
2.1.3 Van source naar executable ................................................................................................................ 10

2.2 De syntax van C........................................................................................................................................... 11
2.2.1 Identifiers ............................................................................................................................................ 11
2.2.2 Constanten en String literals ............................................................................................................... 12
2.2.3 Operatoren ......................................................................................................................................... 12
2.2.4 Punctuatoren (scheiden van tokens) .................................................................................................. 12
2.2.5 Commentaar ....................................................................................................................................... 12
2.2.6 Variabelen in C .................................................................................................................................... 13
2.2.7 Basisstructuren in C ............................................................................................................................ 13
2.2.8 Verschillen C en Java ........................................................................................................................... 14

2.3 Aanvulling ................................................................................................................................................... 14
2.3.1 Eenvoudige I/O in C ............................................................................................................................ 14
2.3.2 Arrays in C ........................................................................................................................................... 15
2.3.3 Strings in C .......................................................................................................................................... 15

2.4 Bit operaties in C ......................................................................................................................................... 16
2.4.1 Werking............................................................................................................................................... 17
2.4.2 Oefening ............................................................................................................................................. 18

3. Overige tutorials ....................................................................................................................................... 18

3.1 Schrijven naar een pin................................................................................................................................. 18
3.1.1 Welke pin? .......................................................................................................................................... 19
3.1.2 Een paar voorbeelden ......................................................................................................................... 19

3.2 DE wet van Ohm en de LED......................................................................................................................... 20
3.2.1 Wet van Ohm ...................................................................................................................................... 20
3.2.2 Elektrisch schema ............................................................................................................................... 21
3.2.3 LEDs..................................................................................................................................................... 21
3.2.4 LEDs op Multi-Functional Shield ......................................................................................................... 22

3.3 Installeren Visual code ................................................................................................................................ 22


1

, 3.4 Nieuw project in VS-Code............................................................................................................................ 22

3.5 Een eigen library gebruiken in VS code ....................................................................................................... 23
3.5.1 USART library ...................................................................................................................................... 23

1. Interfacing met de hardware ..................................................................................................................... 25

1.1 Lezen van een pin........................................................................................................................................ 25
1.1.1 Aan welke pin hangt een knop? .......................................................................................................... 25
1.1.2 En hoe test je nu of ze ingedrukt is? ................................................................................................... 26
1.1.3 Debounce ............................................................................................................................................ 26

1.2 Interrupts .................................................................................................................................................... 26
1.2.1 Hoe werkt het interrupt systeem? ...................................................................................................... 26
1.2.2 Aan de slag: hoe configureer ik een interrupt? .................................................................................. 27
1.2.3 Conclusie ............................................................................................................................................. 28

2. Programmeertaal C ................................................................................................................................... 28

2.1 Macro’s ....................................................................................................................................................... 28
2.1.1 Inleiding .............................................................................................................................................. 28
2.1.2 Voorwaardelijke compilatie ................................................................................................................ 30
2.1.3 Voor gedefinieerde macros ................................................................................................................ 31

2.2 Pointers ....................................................................................................................................................... 32
2.2.1 Poging 1 .............................................................................................................................................. 32
2.2.2 Poging 2 .............................................................................................................................................. 33
2.2.3 Oefening ............................................................................................................................................. 33

2.3 Overige tutorials ......................................................................................................................................... 34
2.3.1 Wat is een pull-up weerstand? ........................................................................................................... 34
2.3.2 Wat is een seriële poort? .................................................................................................................... 36

1. Analoog digitale conversie ........................................................................................................................ 37

1.1 Algemene principes..................................................................................................................................... 37

1.2 Aan de slag ................................................................................................................................................. 39

2. Het LED display met zijn shiftregister ........................................................................................................ 39

3. C: Geheugenmanagement ......................................................................................................................... 41

3.1 Heropfrissing............................................................................................................................................... 41
3.1.1 Variabelen ........................................................................................................................................... 41
3.1.2 Pointers ............................................................................................................................................... 41

3.2 Dynamische allocatie geheugen ................................................................................................................. 43
3.2.1 Array van strings ................................................................................................................................. 43
3.2.2 Zelf geheugen alloceren ...................................................................................................................... 43
3.2.3 Array van strings met eigen geheugenallocatie .................................................................................. 43

3.3 Stack en Heap ............................................................................................................................................. 44
3.3.1 Stack overflow en Heap overflow ....................................................................................................... 45




2

, 4. Wat is een potentiometer? ....................................................................................................................... 45

1. Muziek ...................................................................................................................................................... 47

1.1 Wat is muziek?............................................................................................................................................ 47

1.2 Squarewaves ............................................................................................................................................... 48

1.3 Aan de slag ................................................................................................................................................. 48

2. C: structures .............................................................................................................................................. 49

2.1 Typedef ....................................................................................................................................................... 50

2.2 Structures in C ............................................................................................................................................. 50
2.2.1 Definitie en declaratie......................................................................................................................... 50
2.2.2 Beter in combinatie met typedef ........................................................................................................ 51
2.2.3 Initialiseren ......................................................................................................................................... 51
2.2.4 Velden aanspreken ............................................................................................................................. 51
2.2.5 Geneste structures.............................................................................................................................. 52
2.2.6 Array van structures............................................................................................................................ 52
2.2.7 Structures als parameter .................................................................................................................... 52
2.2.8 Verkorte notatie.................................................................................................................................. 52
2.2.9 Onthouden .......................................................................................................................................... 53
2.2.10 Structures dynamisch alloceren ........................................................................................................ 53
2.2.11 Array van struct pointers .................................................................................................................. 53
2.2.12 Het uiteindelijke resultaat in het geheugen: .................................................................................... 54
2.2.13 Alles samen: ...................................................................................................................................... 54
2.2.14 Java versus C ..................................................................................................................................... 54

3. Timers ....................................................................................................................................................... 55

3.1 Automatische for-loops .............................................................................................................................. 55

4. Een piëzo-elektrische luidspreker .............................................................................................................. 61

4.1 Werking ...................................................................................................................................................... 61




3
$6.59
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
compie Karel de Grote-Hogeschool
Follow You need to be logged in order to follow users or courses
Sold
27
Member since
2 year
Number of followers
6
Documents
21
Last sold
2 months ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions