04.pdf

(794 KB) Pobierz
Co zawiera komputer PC ?
c
Technika cyfrowa 2
cc
wykĀad 4
c
Katedra Metrologii Elektronicznej i Fotonicznej
Andrzej Stİpieĺ
A to jest w mikrokontrolerze
MCS
À 51 Family (8 - bit)
ÒC51
ÒC517A
c
Wewnħtrzna pamiħę ROM
Wewnħtrzna
pamiħę RAM
(XDATA)
cc
Wewnħtrzna pamiħę
RAM (DATA, IDATA)
Port
P0
we/wy
we
analo-
gowe/
/cyfro-
we
Port
P7
Port
P8
Licznik
T0
Port
P1
10-bitowy
przetwornik
analogowo-
-cyfrowy
Jednostka
arytmetyczno-
-logiczna
ALU
Port
szeregowy
we/wy
Licznik
T1
Port
P2
we/wy
c
koprocesor
arytmetyczny
Licznik
T2
Port
P3
Port
P5
we/wy
Watchdog
we/wy
Port
P6
Licznik
CT
Port
P4
2 Porty
szeregowe
we/wy
we/wy
Generator + redukcja mocy
ST7 Family (8-bit, STMicroelectronics)
MSP430F13x/14x Mixed Signal Microcontroller (16 - bit)
c
c
mcu.st.com/mcu/modules
Documents and files for family ST7.
ST7 Training Î Core: 1117550082.pdf (1,322MB)
1
788022963.359.png 788022963.370.png 788022963.380.png 788022963.391.png 788022963.001.png 788022963.012.png 788022963.023.png 788022963.034.png 788022963.045.png 788022963.056.png 788022963.067.png 788022963.078.png 788022963.089.png 788022963.100.png 788022963.111.png 788022963.122.png 788022963.133.png 788022963.143.png 788022963.154.png 788022963.165.png 788022963.176.png 788022963.187.png 788022963.198.png 788022963.209.png 788022963.220.png 788022963.231.png 788022963.242.png 788022963.253.png 788022963.264.png 788022963.275.png 788022963.285.png 788022963.296.png 788022963.307.png 788022963.318.png 788022963.329.png 788022963.340.png 788022963.341.png 788022963.342.png 788022963.343.png 788022963.344.png 788022963.345.png 788022963.346.png 788022963.347.png 788022963.348.png 788022963.349.png 788022963.350.png 788022963.351.png 788022963.352.png 788022963.353.png 788022963.354.png 788022963.355.png 788022963.356.png 788022963.357.png 788022963.358.png 788022963.360.png 788022963.361.png 788022963.362.png 788022963.363.png 788022963.364.png 788022963.365.png 788022963.366.png 788022963.367.png 788022963.368.png 788022963.369.png 788022963.371.png 788022963.372.png 788022963.373.png 788022963.374.png 788022963.375.png
 
AT9 1 SAM7x x - AT91 A RM Thumb Device (Atmel W&M)
Cechy mikrokontrolera
JTAG Scan
ARM7TDMI
Processor
32-bit
Bus
Voltage
Regulator
Advanced Int Ctrl
Wewnħtrzna pamiħę programu
(ROM, OTPROM, EPROM, FLASH)
Priorytetowy kontroler przerwaı
(wewnħtrzne / zewnħtrzne,
maskowalne / niemaskowalne)
Przetworniki A/C i C/A
(rozdzielczoĻę: 8 .. 24 bity)
Liczniki (8 .. 32-bitowe,
tryby: Compare, Capture,
Reload, PWM ..)
Porty rwnolegþe
Porty szeregowe (UART,
standard: I 2 C-Bus / SMBus, SPI,
1-Wire, MicroWire,
USB, CAN ..)
Power Mgt Ctrl
PLL
Osc RSOsc
Reset Ctrl
BrownOut Dtr
Power On Reset
SRAM
Peripheral
Bridge
Wewnħtrzna pamiħę danych
(RAM, EEPROM)
Wewnħtrzny/zewnħtrzny generator
(rezonator kwarcowy/ceramiczny
ukþad RC/LC)
Flash
32-bit
Bus
MCU
WDT
RTC
Peripheral
Data Ctrl
Flash
Programmer
Prog Int Timer
Debug Unit
PIO Ctrl
Power Fail / Brown Out Detect
USART 0-1
SPI
USB Device
PWM Ctrl
Napiħcie zasilania Vcc = 1,2 .. 6V
PrĢd zasilania Icc = 10
mA .. 30mA
Two Wire Interface
Synchro Serial Ctrl
Tryby redukcji mocy
(Idle, Halt, SlowDown, PowerDown, PPM ..
ADC0-7
Timer/Counter 0-2
CPU Architecture (1/2)
mC Introduction
C515
ST72334
  63 basic instructions
  Fast 8-bit by 8-bit multiply
  17 main addressing modes
  One 8-bit accumulator A
  One 8-bit condition code
register CC (using only 5 bits)
  Two 8-bit index registers:
X and Y
C515
ST72334
von Neumann Architecture
Harward Architecture
  111 basic instructions
  Fast 8-bit by 8-bit multiply / divide
  5 main addressing modes
  One 8-bit accumulator A
  One 8-bit program status word
PSW (using 8 bits)
  Eight 8-bit registers Rn in four
selected banks
  Eight 16-bit data pointer register
DPTR
  8-bit stack pointer SP
  16-bit program counter PC
0000h
Hardware
Register
007Fh
0080h
Data Memory
RAM (512 Bytes )
Core
027Fh
External
/
Internal
Program
Memory
(max 64KB )
Core
Reserved
External
Data
Memory
(max 64KB )
0C00h
Special
Function
Register
(256 Bytes)
Internal
Data
Memory
(128 Bytes )
Internal
Data
Memory
(128 Bytes )
EEPROM (256 Bytes) 0CFF h
Reserved
C000h
FFDF h
Program Mamory
ROM (16KBytes)
7Fh
  16-bit stack pointer SP
  16-bit program counter PC
FFE0h
FFFFh
Interrupt &
Reset Vectors
Rn
00h
CPU Architecture (2/2)
CPU Registers - Accumulator A
  The accumulator A is the register where the arithmetic and logic
operations are performed. To perform a two-operand operation
between two values stored in memory, one of the values must first be
moved to the accumulator, since the instruction code provides only
one address. It must be moved back to memory or register when the
operation is done.
C515
ST72334
ROM
RAM
SP
SFR
ROM
RAM
SP
Periph
  The instructions that require only one operand, like INCrement,
DECrement, ComPLement, ComPare, and so on, can act on the
accumulator, or directly on the data in memory or in special function
register if so desired.
Rn
B
A
temp
X
Y
A
temp
ALU
ALU
DPTR
PSW
CC
  Reset value = 00h (for C515)
xxh (ST72334)
PC
PC
  addr in SFR: Acc = 0E0h (C51 only)
2
788022963.376.png 788022963.377.png 788022963.378.png 788022963.379.png 788022963.381.png 788022963.382.png 788022963.383.png 788022963.384.png 788022963.385.png 788022963.386.png 788022963.387.png 788022963.388.png 788022963.389.png 788022963.390.png 788022963.392.png 788022963.393.png 788022963.394.png 788022963.395.png 788022963.396.png 788022963.397.png 788022963.398.png 788022963.399.png 788022963.400.png 788022963.401.png 788022963.002.png 788022963.003.png 788022963.004.png 788022963.005.png 788022963.006.png 788022963.007.png 788022963.008.png 788022963.009.png 788022963.010.png 788022963.011.png 788022963.013.png 788022963.014.png 788022963.015.png 788022963.016.png 788022963.017.png 788022963.018.png 788022963.019.png 788022963.020.png 788022963.021.png 788022963.022.png 788022963.024.png 788022963.025.png 788022963.026.png 788022963.027.png 788022963.028.png 788022963.029.png 788022963.030.png 788022963.031.png 788022963.032.png 788022963.033.png 788022963.035.png 788022963.036.png 788022963.037.png 788022963.038.png 788022963.039.png 788022963.040.png 788022963.041.png 788022963.042.png 788022963.043.png 788022963.044.png 788022963.046.png 788022963.047.png 788022963.048.png 788022963.049.png 788022963.050.png 788022963.051.png 788022963.052.png 788022963.053.png 788022963.054.png 788022963.055.png 788022963.057.png 788022963.058.png 788022963.059.png 788022963.060.png 788022963.061.png 788022963.062.png 788022963.063.png 788022963.064.png 788022963.065.png 788022963.066.png 788022963.068.png 788022963.069.png 788022963.070.png 788022963.071.png 788022963.072.png 788022963.073.png 788022963.074.png 788022963.075.png 788022963.076.png 788022963.077.png 788022963.079.png 788022963.080.png 788022963.081.png 788022963.082.png 788022963.083.png 788022963.084.png 788022963.085.png 788022963.086.png 788022963.087.png 788022963.088.png 788022963.090.png 788022963.091.png 788022963.092.png 788022963.093.png 788022963.094.png 788022963.095.png 788022963.096.png 788022963.097.png 788022963.098.png 788022963.099.png 788022963.101.png 788022963.102.png 788022963.103.png 788022963.104.png 788022963.105.png 788022963.106.png 788022963.107.png 788022963.108.png 788022963.109.png 788022963.110.png 788022963.112.png 788022963.113.png 788022963.114.png 788022963.115.png 788022963.116.png 788022963.117.png 788022963.118.png 788022963.119.png 788022963.120.png 788022963.121.png 788022963.123.png 788022963.124.png 788022963.125.png 788022963.126.png 788022963.127.png 788022963.128.png 788022963.129.png 788022963.130.png 788022963.131.png 788022963.132.png 788022963.134.png 788022963.135.png 788022963.136.png
 
ST72334 CPU Registers - Index Registers (X and Y)
C515 CPU Registers - Data Pointer Register
  The index registers X and Y are meant
to hold addresses, unlike the
accumulator which is meant to hold
data. The value stored in X or Y is
involved in the effective address
calculation in some addressing modes.
  The availability of two index registers
(X and Y) allows for calculating and
managing two addresses as is needed
in a memory-to-memory data move,
with or without alteration in between.
  However, these registers may also be
used to store temporary data.
  Reset value = xxh
ROM
RAM
SP
SFR
ROM
RAM
SP
Periph
  8-bit accesses to the internal
XRAM data memory or the
external data memory or the
code memory are executed
using the data pointer DPTR as
an 16-bit address
Rn
B
A
temp
X
Y
A
temp
ALU
DPTR
PSW
ALU
CC
  addr in SFR: DPL=82h
DPH=83h
  Reset value = 0000h
PC
PC
ST72334 CPU Registers - Condition Code Register (1/2)
ST72334 CPU Registers - Condition Code Register (2/2)
  The CC register remembers the
conditions after each instruction, and
these conditions are used by the
conditional jump instructions. The
CC is laid out as follows:
  This register holds several bits that
are actually more or less
independent from one another.
  These bits are set or reset (or left
unchanged) after the execution of
certain instructions. For example, if
an addition produces a null result,
the Z flag is set; otherwise, it is reset.
If the result is negative, the N flag is
set, otherwise it is reset and so on.
  Reset value = 111X 1XXX
ROM
RAM
SP
Periph
ROM
RAM
SP
Periph
X
Y
A
temp
X
Y
A
temp
1
1 1 H
I
N Z C
ALU
ALU
CC
CC
  H - Half carry
  I - Interrupt mask
  N - Negative
  Z - Zero
  C - Carry/borrow
PC
PC
C515 CPU Registers - Program Status Word Register
Condition Î CY, C
ROM
RAM
SP
SFR
C515
ST72334
  Reset value = 00h
  C - Carry
  AC - Auxiliary Carry
  F0 - General purpose user flag 0
  RS1,RS0 - Register Bank select
  OV - Overflow
  F1 - General purpose user flag 1
  P - Parity
CY AC F0 RS1 RS0 OV F1 P
1
1 1 H
I
N Z C
Rn
B
A
temp
  Carry Flag (CY) Î C515
Used by arithmetic (unsigned) and conditional branch instruction.
ALU
DPTR
PSW
  Carry/Borrow (C) Î ST7
When set, C indicates that a carry or borrow out of the ALU occurred
during the last arithmetic operation on the MSB operation result bit.
This bit is also affected during bit test, branch, shift, rotate and load
instructions.
PC
addr in SFR: 0D0h
CY AC F0 RS1 RS0 OV F1 P
3
788022963.137.png 788022963.138.png 788022963.139.png 788022963.140.png 788022963.141.png 788022963.142.png 788022963.144.png 788022963.145.png 788022963.146.png 788022963.147.png 788022963.148.png 788022963.149.png 788022963.150.png 788022963.151.png 788022963.152.png 788022963.153.png 788022963.155.png 788022963.156.png 788022963.157.png 788022963.158.png 788022963.159.png 788022963.160.png 788022963.161.png 788022963.162.png 788022963.163.png 788022963.164.png 788022963.166.png 788022963.167.png 788022963.168.png 788022963.169.png 788022963.170.png 788022963.171.png 788022963.172.png 788022963.173.png 788022963.174.png 788022963.175.png 788022963.177.png 788022963.178.png 788022963.179.png 788022963.180.png 788022963.181.png 788022963.182.png 788022963.183.png 788022963.184.png 788022963.185.png 788022963.186.png 788022963.188.png 788022963.189.png 788022963.190.png 788022963.191.png 788022963.192.png 788022963.193.png 788022963.194.png 788022963.195.png 788022963.196.png 788022963.197.png 788022963.199.png 788022963.200.png 788022963.201.png 788022963.202.png 788022963.203.png 788022963.204.png 788022963.205.png 788022963.206.png 788022963.207.png 788022963.208.png 788022963.210.png 788022963.211.png 788022963.212.png 788022963.213.png 788022963.214.png 788022963.215.png 788022963.216.png 788022963.217.png 788022963.218.png 788022963.219.png 788022963.221.png 788022963.222.png 788022963.223.png 788022963.224.png 788022963.225.png 788022963.226.png 788022963.227.png 788022963.228.png 788022963.229.png 788022963.230.png 788022963.232.png 788022963.233.png 788022963.234.png 788022963.235.png 788022963.236.png 788022963.237.png 788022963.238.png 788022963.239.png 788022963.240.png 788022963.241.png 788022963.243.png 788022963.244.png 788022963.245.png 788022963.246.png 788022963.247.png 788022963.248.png 788022963.249.png 788022963.250.png 788022963.251.png 788022963.252.png 788022963.254.png 788022963.255.png
Condition Î AC, H
Condition Î OV, P
C515
ST72334
C515
ST72334
CY AC F0 RS1 RS0 OV F1 P
1
1 1 H
I
N Z C
CY AC F0 RS1 RS0 OV F1 P
1
1 1 H
I
N Z C
  Auxiliary Carry Flag (AC) Î C515
Used by instructions which execute BCD operations.
  Overflow Flag (OV) Î C515
Used by arithmetic instruction (signed).
  Half carry bit (H) Î ST7
The H bit is set to 1 when a carry occurs between the bits 3 and 4 of
the ALU during an ADD or ADC instruction. The H bit is useful in BCD
arithmetic subroutines.
  Parity Flag (P) Î C515
Always set/cleared by hardware to indicate an odd/even number of
ÐoneÑ bits in the accumulator.
Condition Î I, N, Z
C51 - Addressing Mode (1/2)
C515
ST72334
  Immediate Addressing Mode (natychmiastowe):
MOV A, #3
CY AC F0 RS1 RS0 OV F1 P
1
1 1 H
I
N Z C
; A 3, wartoĻę
  Interrupt mask (I)
When the I bit is set to 1, all interrupts are disabled. Clearing this bit
enables them. Interrupts requested while I is set, are latched and can be
processed when I is cleared (only one interrupt request per interrupt
enable flag can be latched). This bit can be set/reset by software and is
automatically set after reset or at the beginning of an interrupt routine.
  Negative (N)
When set to 1, this bit indicates that the result of the last arithmetic,
logical or data manipulation is negative (i.e. the most significant bit is a
logic 1).
  Zero (Z)
When set to 1, this bit indicates that the result of the last arithmetic,
logical or data manipulation is zero.
  Register Addressing Mode (rejestrowe):
MOV A, R1
; A R1, nazwa rejestru
  Direct Addressing Mode (bezpoĻrednie) :
MOV A, 1
; A (1), adres pamiħci
  Indirect Addressing Mode (poĻrednie) :
MOV A, @R1
; A (R1), adres pamiħci w R1
IDATA
(R1)
2Ah
A
C51 - Addressing Mode (2/2)
ST7 - Addressing Mode (1/4)
(http://mcu.st.com/mcu: 1117550405.pdf)
¤ Inherent (wþaĻciwe):
PUSH A
  Indirect Register - Indexed Addressing Mode (rejestrowo-
indeksowo-poĻrednie) :
MOVC A, @A+DPTR
; (Stack) A
; A (A+DPTR), adres pamiħci w A+DPTR
¤ Short Direct Addressing Mode (bezpoĻrednie, krtkie) :
INC LABEL
; (LABEL) (LABEL) + 1
; ADDRESSABLE SPACE: 00 to FF
CODE
DPTR+0
¤ Immediate Addressing Mode (natychmiastowe):
LD A, #$55
; A $55
A
4Fh
¤ Long Direct Addressing Mode (bezpoĻrednie dþugie) :
ADD A, LABEL
DPTR+A
; A A + (LABEL)
; ADDRESSABLE SPACE: 0000 to FFFF
4
788022963.256.png 788022963.257.png 788022963.258.png 788022963.259.png 788022963.260.png 788022963.261.png 788022963.262.png 788022963.263.png 788022963.265.png 788022963.266.png 788022963.267.png 788022963.268.png 788022963.269.png 788022963.270.png 788022963.271.png 788022963.272.png 788022963.273.png 788022963.274.png 788022963.276.png 788022963.277.png 788022963.278.png 788022963.279.png 788022963.280.png 788022963.281.png 788022963.282.png 788022963.283.png 788022963.284.png
 
ST7 - Addressing Mode (2/4)
ST7 - Addressing Mode (3/4)
$5A
$4C
¤ No Offset Indexed Addressing Mode :
CPL (X) ; (X) NOT (X)
¤ Short Indexed Addressing Mode :
RRC (LABEL, X)
¤ Short Indirect Addressing Mode :
SWAP [LABEL] ; SWAP ((LABEL))
¤ Long Indirect Addressing Mode :
LD A, [LABEL.w] ; A ((LABEL)*256 + (LABEL+1))
¤ Short Indirect Indexed Addressing :
CLR ([LABEL], X) ; ((LABEL) + X) 0
¤ Long Indirect Indexed Addressing :
LD A, ([LABEL.w], X)
; A ((LABEL)*256 + (LABEL+1) + X)
$4C
LABEL
; C (LABEL + X) C
LABEL+0
rotate right logical
through Carry
LABEL+X
$82
$5A
$4C
LABEL+0
LABEL+1
¤ Long Indexed Addressing Mode :
LD X, (LABEL, X)
$5A4C+0
; X (LABEL + X)
A
$5A4C+X
$82
ST7 - Addressing Mode (4/4)
MCS
° 51 na stronach www
¤ www.8052.com
¤ Relative Addressing Mode Î Direct / Indirect Addressable Space
JRMI LABEL or JRMI [LABEL]
; Jump Relative: PC PC + dst if Condition is True (MI = Minus, N=1)
¤ www.atmel.com
¤ www.cygnal.com / www.silabs.com
¤ www.infineon.com
¤ www.intel.com
¤ www.maxim-ic.com
¤ www.semiconductors.philips.com
¤ www.st.com
¤ www.ti.com
¤ Bit Manipulation Î Direct / Indirect Addressable Space
BSET variable, #n
; set bit n in variable
BRES [variable], #n
; clear bit n in (variable)
¤ Relative Jump On BIT Test Î Direct / Indirect Addressable Space
BTJT variable, #n, label
takŇe ST7
mcu.st.com/mcu
; jump to LABEL if bit n in variable
BTJT [variable], #n, label
; jump to LABEL if bit n in (variable)
C51 Î typy pamiħci
C51 Î adresowanie pamiħci danych i kodu
CODE
XDATA
zewnħtrzna
pamiħę
kodu
programu
zewnħtrzna
pamiħę
danych
zewnħtrzna
pamiħę
kodu
programu
zewnħtrzna
pamiħę
danych
adresowanie
poĻrednie
( @Ri, @DPTR )
CODE
XDATA
DATA
IDATA
0FFh
adresowanie
indeksowo-rejestrowo-poĻrednie
( @A+DPTR )
adresowanie
natychmiastowe
( #data )
SFR
RAM
wewnħtrzna
pamiħę
danych
wewnħtrzna
pamiħę
kodu
programu
wewnħtrzna
pamiħę
danych
wewnħtrzna
pamiħę
kodu
programu
80h
7Fh
R A M
IDATA
DATA
rejestry
0
0
0
0
0
5
788022963.286.png 788022963.287.png 788022963.288.png 788022963.289.png 788022963.290.png 788022963.291.png 788022963.292.png 788022963.293.png 788022963.294.png 788022963.295.png 788022963.297.png 788022963.298.png 788022963.299.png 788022963.300.png 788022963.301.png 788022963.302.png 788022963.303.png 788022963.304.png 788022963.305.png 788022963.306.png 788022963.308.png 788022963.309.png 788022963.310.png 788022963.311.png 788022963.312.png 788022963.313.png 788022963.314.png 788022963.315.png 788022963.316.png 788022963.317.png 788022963.319.png 788022963.320.png 788022963.321.png 788022963.322.png 788022963.323.png 788022963.324.png 788022963.325.png 788022963.326.png 788022963.327.png 788022963.328.png 788022963.330.png 788022963.331.png 788022963.332.png 788022963.333.png 788022963.334.png 788022963.335.png 788022963.336.png 788022963.337.png 788022963.338.png 788022963.339.png
 
Zgłoś jeśli naruszono regulamin