Essays.club - TCC, Modelos de monografias, Trabalhos de universidades, Ensaios, Bibliografias
Pesquisar

ECO033 – Sistemas Embarcados

Por:   •  16/7/2018  •  1.380 Palavras (6 Páginas)  •  280 Visualizações

Página 1 de 6

...

[pic 9][pic 10]

Esses valores podem ser exibidos na tela do terminal com:

GPIOE->ODR = (GPIOD->IDR & 0xF800); /* Mostrar Joystick */

[pic 11][pic 12]O arquivo GLCD_SPI_STM32.c contém funções para inialização e escrita para o QVGA TFT LCD colorido. Inclua-o no seu projeto.

Seu projeto agora deve parecer com isso: -

A função main() é mostrada no apêndice C. A função updateLCD() também é mostrada. Essa função escreve o valor ADC na tela LCD pelo uso da função sprintf() para formatar o valor inteiro como string hexadecimal. Após compilar e baixar para a memória flash você deve ver a saída ADC exibida na tela LCD.

Referências

[1] wikipedia, PuTTY at http://en.wikipedia.org/wiki/PuTTY

[2] wikipedia, Busy Waiting at http://en.wikipedia.org/wiki/Busy_waiting

[3] keil, “MCBSTM32C schematics”, mcbstm32c-base-board-schematics.pdf

Apêndice A

/*----------------------------------------------------------------------------

* Name: Serial.c

* Purpose: Low level serial routines for STM32

* Note(s):

*----------------------------------------------------------------------------

* This file is part of the uVision/ARM development tools.

* This software may only be used under the terms of a valid, current,

* end user licence from KEIL for a compatible version of KEIL software

* development tools. Nothing else gives you the right to use this software.

*

* This software is supplied "AS IS" without warranties of any kind.

*

* Copyright (c) 2009 Keil - An ARM Company. All rights reserved.

*----------------------------------------------------------------------------*/

#include

/*----------------------------------------------------------------------------

* init_serial: Initialize Serial Interface

*---------------------------------------------------------------------------*/

void init_serial (void)

{

int i;

/* Configure UART2 for 115200 baud */

RCC->APB2ENR |= 1

RCC->APB2ENR |= 1

AFIO->MAPR |= 0x00000008; /* Configure used Pins */

GPIOD->CRL &= 0xF00FFFFF;

GPIOD->CRL |= 0x04B00000;

RCC->APB1ENR |= 0x00020000; /* Enable USART#2 clock */

USART2->BRR = 0x0135; /* Configure 115200 baud, */

USART2->CR3 = 0x0000; /* 8 bit, 1 stop bit, */

USART2->CR2 = 0x0000; /* no parity */

for (i = 0; i

USART2->CR1 = 0x200C;

}

/*----------------------------------------------------------------------------

Write character to Serial Port

*----------------------------------------------------------------------------*/

int sendchar (int c)

{

if (c == '\n')

{

while (!(USART2->SR & 0x0080));

USART2->DR = 0x0D;

}

while (!(USART2->SR & 0x0080));

USART2->DR = (c & 0x1FF);

return (c);

}

/*----------------------------------------------------------------------------

Read character from Serial Port (blocking read)

*----------------------------------------------------------------------------*/

int getkey (void)

{

while (!(USART2->SR & 0x0020));

return (USART2->DR);

}

---------------------------------------------------------------

Apêndice B

for (;;) /* Loop infinito */

{

while (!(USART2->SR & 0x0020)) /* espera ocupada */

{

j++;

if (j==100000)

{

GPIOE->ODR = i

j=0;

if (i==0xFFFF)

{

i=0x0000;

}

i++;

}

}

c

...

Baixar como  txt (12.1 Kb)   pdf (69 Kb)   docx (22.8 Kb)  
Continuar por mais 5 páginas »
Disponível apenas no Essays.club