Professional Documents
Culture Documents
September 1999
Lesson 1
September 1999
Lesson #1
September 1999
Introduction
Digital Control Advantages: Advantages: Flexibility Ease of upgrade Man to Machine Interface (MMI) Sophisticated control techniques Reduced number of components Unsensitivity to components ageing Digital Control Disadvantages: Disadvantages: Design complexity Cost Dynamic performance (sampling (sampling frequency, frequency, quantization...) quantization ...)
September 1999 Simone Buso - University of Padova - Lesson 1 3
Introduction
Available tools for digital control implementation Microcontrollers ( C) CISC ( (C Complex I Instruction nstruction S Set et C Computer omputer) ) machines (micro(micro-coded coded instructions) instructions) RISC (R (Reduced I Instruction nstruction S Set et Computer omputer) ) machines ( (with with/ /without hardware multiplier multiplier) ) 4 to 32 bit CPU and bus Digital Signal Processors (DSP) Fixed Fixed- point arithmetic Floating Floating-point arithmetic
September 1999
Lesson #1
September 1999
Introduction
General C features: features: specifically designed for control tasks A/D converters almost always included on chip capture and compare input pins available several programmable I/O pins timers and counters available (PWM) different kinds of external memory available (ROM, EEPROM, FLASH) different computational powers available ( (from from 32 bit RISC to simple 8 bit CPUs and even less less) ) lots of third party development tools (EV(EV-Boards Boards, , in incircuit emulators ( (ICEs ICEs)) ))
September 1999 Simone Buso - University of Padova - Lesson 1 5
Introduction
General DSP features features: : not specifically designed for control tasks A/D converters not always included on chip useful peripheral units ( (CapCom CapCom, , timers timers, , PWM) normally not present on chip very high computational power available (32 bit RISC CPUs both fixed and floating point) point) relatively few third party development tools (EVBoards) Boards ) new DSP solutions for power electronic applications are now becoming available (TMS320F240, ADMC401)
September 1999 Simone Buso - University of Padova - Lesson 1 6
Lesson #1
September 1999
Microcontrollers
A C is essentially a computing machine where, where, on the same chip, chip, a CPU core is interfaced with different peripheral units, units, allowing it to perform various control functions. functions . In modern Cs Cs, , the typical CPU architecture is the sosocalled Harvard architecture architecture, , based on separate program and data memories and buses. buses . An hardware multiplier is quite often present in state of the art products products. . The typical peripheral units include: include :
September 1999
Microcontrollers
In the selection of a C unit for any given control application some key parameters must be considered: considered : performance parameters cost parameters As in any project, project, these two aspects typically have to be tradedtraded-off off. .
September 1999
Lesson #1
September 1999
Microcontrollers
Typical performance parameters are: CPU clock period instruction cycle instruction set (RISC or CISC) memory area interrupt management peripheral unit availability The cost is indirectly determined also by: by : avaliability of development tools cost of the evalution board, board, ICE, etc etc. . etc etc. . and strongly depends on production volume
September 1999 Simone Buso - University of Padova - Lesson 1 9
Microcontrollers
The C market is very large and rich of products. products. A lot of manufacturers offer complete sets of C solutions solutions, , with increasing complexity, complexity, level of performance and cost. cost . An exhaustive overview is practically impossible impossible; ; some examples can be shown of different products with different complexities, complexities, which allow to get a glimpse of what can be found on the market. market. Common features in terms of system architecture and peripheral units can be easily identified. identified.
September 1999
10
Lesson #1
September 1999
September 1999
11
September 1999
12
Lesson #1
September 1999
ST6 microcontroller
CPU block diagram
September 1999
13
Lesson #1
September 1999
C166 C166W
M M M M M M
M = Metric Quad Flatpack
88 Flash EEPROM
(-) no suffix
September 1999
15
Dual Port 16
32
RAM
Data
1 KByte
XTAL
OSC
External Instr./Data
PEC Watchdog
19 ext. IR 16
Peripheral Data
Interrupt Controller
Interrupt Bus 16
t
o P r ot
Bus Controller
16 Channels
ASC BRG
T3 T4
T5 T6
16
Port 1
Port 5
Port 2
16
2 16 10 16
September 1999
Timer 0
T2
Timer 1
External
10-Bit ADC
USART
CAPCOM
16
Lesson #1
September 1999
Dual Port
CPU
32
RAM 2 KByte
Data
16
XTAL
(input: 5 MHz)
OSC
(output: 20MHz)
External Instr./Data
PEC Watchdog
36 ext. IR 16
Interrupt Controller
16
2KB
XRAM
Interrupt Bus
Peripheral Data
P r o t r o P r ot
Multi Funktional
Timer 1
T2 T3 T4 T5
16 Channels
32 Channels
Timer 7 Timer 8
Timer 0
External Bus ,
10-Bit
USART
ADC
GPT1 GPT2
CAPCOM1, 2
PWM Module
PT 1 PT 2 PT 3 PT 4
T6
16
Port 1
Port 5
Port 3
Port 2
Port 8
Port 7
167
16
16
16
16
September 1999
17
18
Lesson #1
September 1999
September 1999
19
=78 KHz
x 50ns
Four operation modes Standard, edge edge-aligned PWM Symmetrical Symmetrical, , center center- aligned PWM for asynchronous motor control Burst Burst-mode for modulated PWM signals Single Single-shot mode
September 1999 Simone Buso - University of Padova - Lesson 1 20
Lesson #1
10
September 1999
305 Hz 4.77 Hz
610 Hz 9.54 Hz
152.6 Hz 2.4 Hz
September 1999
21
Tim
Pe er
rio
Tim
Interrupt Request and Latch of the Shadow Register PWM Signal
P er
er
er
Pe
rio
If all channels are programmed to mode 0, edge-aligned PWM signals will be generated. A duty cycle from 0 to 100% is programmable PWMx PWMy
If all channels are programmed to mode 1, center -aligned PWM signals will be generated . A duty cycle from 0 to 100% is programmable
Possible PWM Signals from other channels programmed to the same mode September 1999 Simone Buso - University of Padova - Lesson 1 22
Lesson #1
11
September 1999
Single Shot : Only one PWM Pulse is generated Mode available for channel 2 and 3
e rP rio d
Period Value
Ti m e
Period Value
Tim
er
Period Value
Output Signal
The Timer can be dynamically changed to lengthen (retrigger) or shorten the output pulse
23
September 1999
Lesson #1
12
September 1999
CPU
Timer
A\D Converter
September 1999
25
Lesson #1
13
September 1999
Microchip PIC17C7xx
September 1999
27
CPU
Microchip PIC17C7xx
Data memory
Program memory
September 1999
28
Lesson #1
14
September 1999
September 1999
30
Lesson #1
15
September 1999
Lesson #1
16
September 1999
Instruction Memory
Data Memory
Instruction Stream
Data Stream
September 1999
Lesson #1
17
September 1999
September 1999
35
2: Data Bus
Lesson #1
18
September 1999
September 1999
37
Lesson #1
19
September 1999
September 1999
39
Lesson #1
20
September 1999
21xx core
September 1999
C peripheral units
Simone Buso - University of Padova - Lesson 1 42
Lesson #1
21
September 1999
September 1999
43
Lesson #1
22
September 1999
September 1999
46
Lesson #1
23
September 1999
ADMC401: Other Ancillary Fuctions 2 auxiliary 8 bit PWM timers 16 bit watchdog timer Programmable digital I/O port (12 pin pin) ) 2 synchronous serial ports
September 1999
47
Lesson #1
24
September 1999
TMS320F240 Functional Block Diagram Central Arithmetic Logic Unit (CALU) Event Manager: Manager: Timers Compare Units ... Dual 10 bit ADC
September 1999
49
September 1999
50
Lesson #1
25
September 1999
Lesson #1
26
September 1999
TMS320F240 Ancillary Peripheral Functions 4 pin serial peripheral interface watchdog timer Quadrature - encoder pulse circuit 28 programmable I/O pins
September 1999
53
References
[1] ST 1999 Product and Company Information [2] Siemens 1999 Technical Product Information - Edition 7 [3] Hitachi 1998 Electronic Components Databook [4] Microchip 1999 Technical Library [5] P. Pirsch Pirsch, , Architectures for Digital Signal Processing, Processing, 1998, John Wiley and Sons (ISBN 0-471-97145-6) [6] Analog Devices Winter 1999 Designers Reference Manual [7] Texas Instruments 1999 TMS320 DSP Solutions CD-ROM
September 1999
54
Lesson #1
27