0% found this document useful (0 votes)
42 views2 pages

8 Leds Blink

The document describes the configuration of ports on a microcontroller. It explains initializing the ports by setting specific pins to high, initializing and enabling the ports used, and configuring the mode of pins on ports A and B. It also describes using interrupts from buttons connected to pins on port A.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
42 views2 pages

8 Leds Blink

The document describes the configuration of ports on a microcontroller. It explains initializing the ports by setting specific pins to high, initializing and enabling the ports used, and configuring the mode of pins on ports A and B. It also describes using interrupts from buttons connected to pins on port A.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 2

CONFIGURACION DE PUERTOS

1. Diagrama de bloques

2. Inicialización de los puertos


//Set Pin A5,A6,A7 to HIGH
ldr r0,=GPIOA_BASE
movw r1,0x00E0
movt r1,0
bl DRV_GPIOx_Set

//Set Pin B0,B5,B6,B7,B11 to HIGH


ldr r0,=GPIOB_BASE
movw r1,0x08E1
movt r1,0
bl DRV_GPIOx_Set
3. Inicialización y encendido de los puertos usados.
//Bus AHB2 (Salidas)
Ldr r0,=RCC_BASE
movw r1,0x3
movt r1,0
bl DRV_RCC_AHB2ENR_Init

//Moder Pin 5,6,7 Puerto A


ldr r0,=GPIOA_BASE
movw r1,0x5400
movt r1,0
movw r2,0xA800
movt r2,0
bl DRV_GPIOx_MODER_Init

//Moder Pin B0,B5,B6,B7,B11 Puerto B


ldr r0,=GPIOB_BASE
movw r1,0x5401
movt r1,0x0010
movw r2,0xA802
movt r2,0x0080
bl DRV_GPIOx_MODER_Init
4. Interruptores utilizados.
loop:
ldr r0, =SysTick_BASE
ldr r1, [r0, #SysTick_CTRL]
and r1,(1<<16)
cbz r1,readbutton
ldr r0,=current_tick
ldr r1,[r0]
add r1,1
str r1,[r0]

readbutton:

ldr r2, =GPIOA_BASE


ldr r3,[r2,#GPIO_IDR]
and r3,#(1<<1)
cmp r3,#0
bne endreadtick
ldr r2, =GPIOA_BASE
ldr r3,[r2,#GPIO_IDR]
and r3,#(1<<4)
cmp r3,#0
bne endreadtick

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy