ARM Microcontroller Course May 6, 2015 ARM Microcontroller Course - - PowerPoint PPT Presentation

arm microcontroller course
SMART_READER_LITE
LIVE PREVIEW

ARM Microcontroller Course May 6, 2015 ARM Microcontroller Course - - PowerPoint PPT Presentation

Introduction C Microcontroller ARM Microcontroller Course May 6, 2015 ARM Microcontroller Course Introduction C Microcontroller Table of Contents 1 Introduction 2 C Data types Operators Events 3 Microcontroller ARM Microcontroller


slide-1
SLIDE 1

Introduction C Microcontroller

ARM Microcontroller Course

May 6, 2015

ARM Microcontroller Course

slide-2
SLIDE 2

Introduction C Microcontroller

Table of Contents

1 Introduction 2 C

Data types Operators Events

3 Microcontroller

ARM Microcontroller Course

slide-3
SLIDE 3

Introduction C Microcontroller

The Course

4 Evenings

ARM Microcontroller Course

slide-4
SLIDE 4

Introduction C Microcontroller

The Course

4 Evenings Nucleo-F411RE board

ARM Microcontroller Course

slide-5
SLIDE 5

Introduction C Microcontroller

The Course

4 Evenings Nucleo-F411RE board Programming in C

ARM Microcontroller Course

slide-6
SLIDE 6

Introduction C Microcontroller

The Course

4 Evenings Nucleo-F411RE board Programming in C Manual and Datasheet

ARM Microcontroller Course

slide-7
SLIDE 7

Introduction C Microcontroller

The Course

4 Evenings Nucleo-F411RE board Programming in C Manual and Datasheet Build a Function Generator

ARM Microcontroller Course

slide-8
SLIDE 8

Introduction C Microcontroller

What is a Microcontroller?

Processor

ARM Microcontroller Course

slide-9
SLIDE 9

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

ARM Microcontroller Course

slide-10
SLIDE 10

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

Program Memory

ARM Microcontroller Course

slide-11
SLIDE 11

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

Program Memory RAM

ARM Microcontroller Course

slide-12
SLIDE 12

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

Program Memory RAM

Peripherals

ARM Microcontroller Course

slide-13
SLIDE 13

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

Program Memory RAM

Peripherals

Clock Generator

ARM Microcontroller Course

slide-14
SLIDE 14

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

Program Memory RAM

Peripherals

Clock Generator Digital General Purpose I/O

ARM Microcontroller Course

slide-15
SLIDE 15

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

Program Memory RAM

Peripherals

Clock Generator Digital General Purpose I/O Analog I/O (eg. ADC, Comparator)

ARM Microcontroller Course

slide-16
SLIDE 16

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

Program Memory RAM

Peripherals

Clock Generator Digital General Purpose I/O Analog I/O (eg. ADC, Comparator) Timers

ARM Microcontroller Course

slide-17
SLIDE 17

Introduction C Microcontroller

What is a Microcontroller?

Processor Memory

Program Memory RAM

Peripherals

Clock Generator Digital General Purpose I/O Analog I/O (eg. ADC, Comparator) Timers Hardware Serial Communication (eg. UART, SPI, I2C)

ARM Microcontroller Course

slide-18
SLIDE 18

Introduction C Microcontroller Data types Operators Events

Table of Contents

1 Introduction 2 C

Data types Operators Events

3 Microcontroller

ARM Microcontroller Course

slide-19
SLIDE 19

Introduction C Microcontroller Data types Operators Events

Data types

Integer types (uint8_t,uint16_t,int32_t,..)

ARM Microcontroller Course

slide-20
SLIDE 20

Introduction C Microcontroller Data types Operators Events

Data types

Integer types (uint8_t,uint16_t,int32_t,..) Float types (float,double,..)

ARM Microcontroller Course

slide-21
SLIDE 21

Introduction C Microcontroller Data types Operators Events

Data types

Integer types (uint8_t,uint16_t,int32_t,..) Float types (float,double,..) Enumerated types (enum)

ARM Microcontroller Course

slide-22
SLIDE 22

Introduction C Microcontroller Data types Operators Events

Data types

Integer types (uint8_t,uint16_t,int32_t,..) Float types (float,double,..) Enumerated types (enum) Void (void)

ARM Microcontroller Course

slide-23
SLIDE 23

Introduction C Microcontroller Data types Operators Events

Data types

Integer types (uint8_t,uint16_t,int32_t,..) Float types (float,double,..) Enumerated types (enum) Void (void) Derived types (pointers, arrays, structs, unions, function types,..)

ARM Microcontroller Course

slide-24
SLIDE 24

Introduction C Microcontroller Data types Operators Events

Operators

Arithmetic

+ Adds two operands − Subtracts second operand from first ∗ Multiplies both operands / Divides numerator by de-numerator ++ Increases integer by 1 −− Decreases integer by 1

ARM Microcontroller Course

slide-25
SLIDE 25

Introduction C Microcontroller Data types Operators Events

Operators

Logical

&& Logical AND. Returns True when both operands are non-zero || Logical OR. Returns True when any of the operands is non-zero ! Logical NOT. Reverses the logical state of the

  • perand.

ARM Microcontroller Course

slide-26
SLIDE 26

Introduction C Microcontroller Data types Operators Events

Operators

Bitwise

& Bitwise AND. Copies bit when it exists in both

  • perands.

| Bitwise OR. Copies bit when it exists in either

  • perand.

ˆ Bitwise XOR. Copies the bit if set in one operand, but not both. ∼ Flips the bits. << Binary Left Shift. Left operands value is moved left by right number of bits. >> Binary Right Shift. Left operands value is moved right by right number of bits.

ARM Microcontroller Course

slide-27
SLIDE 27

Introduction C Microcontroller Data types Operators Events

Operators

Example uint8_t A = 0xEE; // equal to 0b11101110 uint8_t B = 5; // equal to 0b00000101 uint8_t C; // declare C C = A + B; // C = 0b11110011 C = A && B; // C = True = 0b00000001 C = A << 2; // C = 0b10111000 C = A & B; // C = 0b00000100

ARM Microcontroller Course

slide-28
SLIDE 28

Introduction C Microcontroller Data types Operators Events

Polling and Interrupts

Two approaches to checking a state

Polling Check a value If changed, perform some action

ARM Microcontroller Course

slide-29
SLIDE 29

Introduction C Microcontroller Data types Operators Events

Polling and Interrupts

Two approaches to checking a state

Polling Check a value If changed, perform some action Interrupt When a change of a value happens, go immediately to ISR Perform Interrupt Service Routine (ISR) Resume code

ARM Microcontroller Course

slide-30
SLIDE 30

Introduction C Microcontroller

Table of Contents

1 Introduction 2 C

Data types Operators Events

3 Microcontroller

ARM Microcontroller Course

slide-31
SLIDE 31

Introduction C Microcontroller

Memory

Register

ARM Microcontroller Course

slide-32
SLIDE 32

Introduction C Microcontroller

Memory

Register Memory Space

ARM Microcontroller Course

slide-33
SLIDE 33

Introduction C Microcontroller

Memory

Register Memory Space Memory Mapped Peripherals

ARM Microcontroller Course

slide-34
SLIDE 34

Introduction C Microcontroller

Memory

Register Memory Space Memory Mapped Peripherals Register Name Description 0x0800 0000 Flash Memory Start Address 0x2000 0000 SRAM Start Address 0x4002 0400 GPIOB MODER GPIO Port B Mode register 0x4002 000C GPIOA PUPDR GPIO Port A Pullup register 0x4001 300C SPI1 DR SPI Data register

ARM Microcontroller Course

slide-35
SLIDE 35

Introduction C Microcontroller

Programming in Eclipse

The procedure:

1 Read the manual

ARM Microcontroller Course

slide-36
SLIDE 36

Introduction C Microcontroller

Programming in Eclipse

The procedure:

1 Read the manual 2 Start a project in Eclipse

ARM Microcontroller Course

slide-37
SLIDE 37

Introduction C Microcontroller

Programming in Eclipse

The procedure:

1 Read the manual 2 Start a project in Eclipse 3 Write your code

ARM Microcontroller Course

slide-38
SLIDE 38

Introduction C Microcontroller

Programming in Eclipse

The procedure:

1 Read the manual 2 Start a project in Eclipse 3 Write your code 4 Compile the code

ARM Microcontroller Course

slide-39
SLIDE 39

Introduction C Microcontroller

Programming in Eclipse

The procedure:

1 Read the manual 2 Start a project in Eclipse 3 Write your code 4 Compile the code 5 Flash to Nucleo board with STLink

ARM Microcontroller Course

slide-40
SLIDE 40

Introduction C Microcontroller

Planning

Today: Read the manual1

1Yes I know, that was on the previous slide as well. Do it! :-) ARM Microcontroller Course

slide-41
SLIDE 41

Introduction C Microcontroller

Planning

Today: Read the manual Get used to Eclipse

ARM Microcontroller Course

slide-42
SLIDE 42

Introduction C Microcontroller

Planning

Today: Read the manual Get used to Eclipse Turn a LED on/off

ARM Microcontroller Course

slide-43
SLIDE 43

Introduction C Microcontroller

Planning

Today: Read the manual Get used to Eclipse Turn a LED on/off

ARM Microcontroller Course

slide-44
SLIDE 44

Introduction C Microcontroller

Planning

Today: Read the manual Get used to Eclipse Turn a LED on/off What’s yet to come: Timers Analog Peripherals SPI Build a Function Generator using DDS

ARM Microcontroller Course

slide-45
SLIDE 45

Introduction C Microcontroller

Material

You can find all material on http://www.scintilla.utwente.nl/docs/cursus Make sure you download: The Manual The Usermanual of the Nucleo-F411RE The Reference Manual of the STM32F411RE

ARM Microcontroller Course