100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Samenvatting Programmeren 1 - theorie embedded $5.89
Add to cart

Summary

Samenvatting Programmeren 1 - theorie embedded

 3 views  0 purchase
  • Course
  • Institution

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

Preview 4 out of 62  pages

  • January 19, 2023
  • 62
  • 2021/2022
  • Summary
avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller compie. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $5.89. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

52510 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$5.89
  • (0)
Add to cart
Added