Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Embedded Systems
4 - Hardware Architecture
CPU Input/Output mechanisms Memory Buses and Aux I/O Input/Output interfaces
RMR2012
Power Management
CPU Buses
RMR2012
CPU bus
RMR2012
Bus protocol
Determines who gets to use the bus at any particular time. Governs length, style of communication.
RMR2012
Four-cycle handshake
dev1
data ack
dev2
RMR2012
Four-cycle example
enq 1 2 3
data
ack
Maths is not everything
time
RMR2012
Clock. R/W: true when bus is reading. Address: a-bit bundle. Data: n-bit bundle. Data ready.
Maths is not everything
RMR2012
Timing diagrams
one A zero 10 ns rising falling
stable
B
changing
C
2008 Wayne Wolf
time
RMR2012
CPU:
set R/W=1; asserts address, address enable.
Memory:
asserts data; asserts data ready.
Maths is not everything
CPU:
deasserts address, address enable.
RMR2012
Get data
Done
See ack
Adrs
Wait
RMR2012
Transaction types
Wait state:
state in a bus transaction to wait for acknowledgment.
Disconnected transfer:
bus is freed during wait state.
Burst:
multiple transfers.
Maths is not everything
RMR2012
RMR2012
Very similar:
a timer is incremented by a periodic signal; a counter is incremented by an asynchronous, occasional signal.
RMR2012
Timers
RMR2012
14
Timers (MSP430)
System timing is fundamental for real-time applications The MSP430F2274 has 2 timers, namely Timer_A and Timer_B The timers may be triggered by internal or external clocks Timer_A and Timer_B also include multiple independent capture/compare blocks that are used for applications such as timed events and Pulse Width Modulation (PWM)
RMR2012
5
MCx
3
-
2
TxCLR
1
TxIE
0
TxIFG
(Used by Timer_B)
TxSSELx
Bit
9-8 TxSSELx
Description
Timer_x clock source: 0 0 ! TxCLK 0 1 ! ACLK 1 0 ! SMCLK 1 1 ! INCLK 00!/1 01!/2 10!/4 11!/8 0 0 ! Stop mode 0 1 ! Up mode 1 0 ! Continuous mode 1 1 ! Up/down mode
7-6
IDx
5-4
MCx
2
Maths is not everything
Timer_x clear when TxCLR = 1 Timer_x interrupt enable when TxIE = 1 Timer_x interrupt pending when TxIFG = 1
1 0
RMR2012
Description
The timer is halted. The timer repeatedly counts from 0x0000 to the value in the TxCCR0 register. The timer repeatedly counts from 0x0000 to 0xFFFF. The timer repeatedly counts from 0x0000 to the value in the TxCCR0 register and back down to zero.
RMR2012
Continuous Mode
Up/Down Mode
RMR2012
TA_isr: ; timer A ISR bic.w #TAIFG,&TACTL ; acknowledge interrupt ; <<add interrupt code here>> reti .sect .word ".int08" TA_isr ; timer A section ; timer A isr
RMR2012
Watchdog timer
Watchdog timer is periodically reset by system timer. If watchdog is not reset, it generates an interrupt to reset the host.
interrupt
host CPU
Maths is not everything
RMR2012
reset
watchdog timer
The primary function of the watchdog timer+ (WDT+) module is to perform a controlled system restart after a software problem occurs. If the selected time interval expires, a system reset is generated. If the watchdog function is not needed in an application, the module can be configured as an interval timer and can generate interrupts at selected time intervals.
RMR2012
RMR2012
After a power-up clear (PUC), the WDT+ module is automatically configured in the watchdog mode with an initial 32768 clock cycle reset interval using the DCOCLK. The user must setup or halt the WDT+ prior to the expiration of the initial reset interval.
RMR2012
In Assembly
RESET: ! mov.w ! mov.w ! bis.b ! mov.w ...
passwd = 0x5A
; Initialize stack pointer ; Stop WDT ; Set P1.0-3 output
In C
RMR2012
RMR2012
Switch debouncing
RMR2012
Encoded keyboard
An array of switches is read by an encoder. N-key rollover remembers multiple key depressions. row
2008 Wayne Wolf
RMR2012
LED
RMR2012
RMR2012
Digital-to-analog conversion
bn bn-1 bn-2
Maths is not everything
Vout
2R 4R 8R
RMR2012
bn-3
...
RMR2012
Dual-slope conversion
Use counter to time required to charge/ discharge capacitor. Charging, then discharging eliminates nonlinearities.
Vin
Maths is not everything
RMR2012
timer
Sample-and-hold
RMR2012