Professional Documents
Culture Documents
2-Programacao ES Intro 2023
2-Programacao ES Intro 2023
Programação de SE – Introdução
© 2014 by M. Jiménez, R.
Palomera, & I. Couvertier
EEE026 – PSE – UFMG 2023 2
Time-to-market: a demanding design metric
Time required to develop a product to the point it can be sold to
customers
Market window
Period during which the product would have highest sales
Average time-to-market constraint is about 8 months
Delays can be costly
Revenues ($)
Time (months)
Embedded Systems Design: A Unified
Hardware/Software Introduction, (c) 2000 Vahid/Givargis
Review of battery powered embedded systems design for mission-critical low-power applications
Matthew Malewski, David M. J. Cowell & Steven Freear http://orcid.org/0000-0001-7858-4155
https://doi.org/10.1080/00207217.2017.1409813
tBOUNCE n
⁄⁄
GPIO Entrada
GPIO Saída
Main Features
Arduino UNO is a microcontroller
board based on the ATmega328P. It has
14 digital input/output pins (of which 6
can be used as PWM outputs), 6 analog
inputs, a 16 MHz ceramic resonator, a
USB connection, a power jack, an ICSP
header and a reset button. It contains
everything needed to support the
microcontroller; simply connect it to a
computer with a USB cable or power it
with a AC-to-DC adapter or battery to
get started. You can tinker with your
UNO without worrying too much about
doing something wrong, worst case
scenario you can replace the chip for a
few dollars and start over again.
https://docs.arduino.cc/hardware/uno-rev3
Digital I/O
Time
digitalRead() delay()
digitalWrite() delayMicroseconds()
pinMode() micros()
millis()
https://www.arduino.cc/reference/en/libraries/
Etapas
Diretivas de pré-processamento
#include <file>
#define <symbolic name> expression
#pragma (para recursos dependentes do compilador)
attributes:
name, type, scope, storage class, and storage duration.
storage class:
auto, extern, static and register (when the variable is created
and when it is destroyed).
storage duration:
automatic (local) or static (global).
scope of visibility:
file scope, function scope, or block scope.
Problemas:
1. The compiler is not aware of the effect of the assembly
code. For this reason, registers and memory locations that
are not restored within the sequence of inline assembler
instructions might cause the rest of the code to not work
properly.
2. As opposed to the Application Programming Interface used
with high level code, inline assembly code sequences do not
have a well-defined interface with the surrounding code.
This makes it fragile and introduces the possibility of
maintenance problems.
3. Optimizations will not take into account inline assembly
code sequences.
4. With the exception of the data definition directives the rest
of the assembler directives will cause errors.
5. There is no control over the alignment.
6. Variables with auto duration cannot be accessed.
Pisca led
LED1 is connected to pin
P1.0 in active high mode;
https://scienceprog.com/microcontroller-simulators-and-emulators/ https://microcontrollershop.com/An%20Embedded%20Tools%20Introduction.php
TI SLAU278af
EEE026 – PSE – UFMG 2023 38
4-wire JTAG
TI SLAU278af
EEE026 – PSE – UFMG 2023 39
MSP430
TI SLAU647o
#1. Print things a lot #8. If you’re not sure where the
#2. Start with code that already problem is, do a binary search
works #9. Take a break and walk away
#3. Run your code every time from the keyboard
you make a small change #10. How to ask for help
Explain what you’re trying to do
#4. Read the error message
Show the code that’s giving the
#5. Google the error message error
#6. Guess and Check Show the entire stack trace
including the error message
#7. Comment-out code Explain 2-3 things that you’ve
tried already and why they didn’t
work
https://blog.hartleybrody.com/debugging-code-beginner/
https://barrgroup.com/embedded-systems/how-to/bug-killing-standards-for-embedded-c