Файл: Microcontroller based applied digital control (D. Ibrahim, 2006).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 14.06.2025

Просмотров: 3308

Скачиваний: 1

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

52 SYSTEM MODELLING

where C is the thermal capacity, i.e. C = ρ V C p and V is the volume of the tank. Substituting (2.114)–(2.116) into (2.113) gives

Q p + WC p Ti = C

d T

+ WC p T

dt

or

d T

=

WC p (Ti − T ) + Q p

.

dt

ρ V C p

2.6 EXERCISES

1.Figure 2.27 shows a simple mechanical system consisting of a mass, spring and damper. Derive a mathematical model for the system, determine the transfer function, and draw the block diagram.

2.Consider the system of two massless springs shown in Figure 2.28. Derive a mathematical model for the system.

3.Three massless springs with the same stiffness constant are connected in series. Derive an expression for the equivalent spring stiffness constant.

4.Figure 2.29 shows a simple mechanical system. Derive an expression for the mathematical model for the system.

5.Figure 2.30 shows a rotational mechanical system. Derive an expression for the mathematical model for the system.

6.Two rotational springs are connected in parallel. Derive an expression for the equivalent spring stiffness constant.

7.Figure 2.31 shows a simple system with a gear-train. Derive an expression for the mathematical model for the system.

8.A simple electrical circuit is shown in Figure 2.32. Derive an expression for the mathematical model for the system.

9.Figure 2.33 shows an electrical circuit. Use Kirchhoff’s laws to derive the mathematical model for the system.

10.A liquid level system is shown in Figure 2.34, where qi and qo are the inflow and outflow rates, respectively. The system has two fluid resistances, R1 and R2, in series. Derive an expression for the mathematical model for the system.

11.Figure 2.35 shows a liquid level system with three tanks. Liquid enters the first tank at the rate qi and leaves the third tank at the rate qo . Assume that all tanks have the same dimensions. Derive an expression for the mathematical model for this system.


EXERCISES 53

Figure 2.27 Simple mechanical system for Exercise 1

Figure 2.28 System of two massless springs for Exercise 2

Figure 2.29 Simple mechanical system for Exercise 4

T1

k

T2

I1

I2

θ1

b

θ2

Figure 2.30 Simple mechanical system for Exercise 5

Figure 2.31 Simple system with a gear-train for Exercise 7

54 SYSTEM MODELLING

Figure 2.32 Simple electrical circuit for Exercise 8

L2

R

i1

i3

i4

i6

1

2

i2

i5

L3

Va

L1

C

Figure 2.33 Electrical circuit for Exercise 9

qi

h

R1

R2

qo

A, ρ, g

Figure 2.34 Liquid level system for Exercise 10

qi

h1

R

R

R

h3

qo

A1, ρ, g

P1

q1

P2

P3

q2

P4

P5

P6

A1, ρ, g

A1, ρ, g

Figure 2.35 Three-tank liquid level system for Exercise 11


FURTHER READING

55

FURTHER READING

[Cannon, 1967]

Cannon, R.H. Jr. Dynamics of Physical Systems. McGraw-Hill, New York, 1967.

[Cochin, 1980]

Cochin, I. Analysis and Design of Dynamic Systems. Harper & Row, New York,

1980.

[D’Souza, 1988]

D’Souza, A. Design of Control Systems. Prentice Hall, Englewood Cliffs, NJ, 1988.

[Franklin and Powell, 1986] Franklin, G.F. and Powell, J.D. Feedback Control of Dynamic Systems. Addison-

Wesley, Reading, MA, 1986.

[Leigh, 1985]

Leigh, J.R. Applied Digital Control. Prentice Hall, Englewood Cliffs, NJ, 1985.

[Ogata, 1990]

Ogata, K. Modern Control Engineering 2nd edn., Prentice Hall, Englewood Cliffs,

NJ, 1990.

3

The PIC Microcontroller

3.1 THE PIC MICROCONTROLLER FAMILY

The PIC microcontroller is a family of microcontrollers manufactured by the Microchip Technology Inc. Currently the PIC is one of the most popular microcontrollers used in education, and in commercial and industrial applications. The family consists of over 140 devices, ranging from simple 4-pin dual in-line devices with 0.5 K memory, to 80-pin complex devices with 32 K memory.

Even though the family consists of a large number of devices, all the devices have the same basic structure, offering the following fundamental features:

reduced instruction set (RISC) with only 35 instructions;

bidirectional digital I/O ports;

RAM data memory;

rewritable flash, or one-time programmable program memory;

on-chip timer with pre-scaler;

watchdog timer;

power-on reset;

external crystal operation;

25 mA current source/sink capability;

power-saving sleep mode.

More complex devices offer the following additional features:

analog input channels;

analog comparators;

serial USART;

nonvolatile EEPROM memory;

additional on-chip timers;

external and internal (timer) interrupts;

PWM output;

CAN bus interface;

I2C bus interface;

USB interface;

LCD interface.

Microcontroller Based Applied Digital Control D. Ibrahim

C 2006 John Wiley & Sons, Ltd. ISBN: 0-470-86335-8

58 THE PIC MICROCONTROLLER

The PIC microcontroller product family currently consists of six groups:

PIC10FXXX 12-bit program word;

PIC12CXXX/PIC12FXXX 12/14-bit program memory;

PIC16C5X 12-bit program word;

PIC16CXXX/PIC16FXXX 14-bit program word;

PIC17CXXX 16-bit program word;

PIC18CXXX/PIC18FXXX 16-bit program word.

3.1.1 The 10FXXX Family

Table 3.1 gives a summary of the features of this family. PIC10F200 is a member of this family with the following features.

PIC10F200. This microcontroller is available in a 6-pin SOT-23 package (see Figure 3.1), or in 8-pin PDIP package (see Figure 3.2). The device has 33 instructions, 256 × 12 word flash program memory, 16 bytes of RAM data memory, four I/O ports, and one 8-bit timer. Clocking is from a precision 4 MHz internal oscillator. Other members of the family have larger memories and also an internal comparator.

Table 3.1 Some PIC10FXXX family members

Program

Data

A/D

Microcontroller

memory

RAM

I/O pins

Comparators

converters

10F200

256 × 12

16

4

0

0

10F202

512 × 12

24

4

0

0

10F204

256 × 12

16

4

1

0

10F206

512 × 12

24

4

1

0

10F220

256 × 12

16

4

0

3/8-bit

SOT-23

SOT-23

1

PIC10F200/202

6

1

PIC10F204/206

6

GP0/lCSPDAT

GP3/MCLR/VPP

GP0/lCSPDAT/CIN+

GP3/MCLR/VPP

VSS

2

5

VDD

VSS

2

5

VDD

GP1/ICSPCLK

3

4

GP2/T0CKI/FOSC4

GP1/ICSPCLK/CIN–

3

4

GP2/T0CKI/COUT/FOSC4

Figure 3.1 PIC10FXXX family in 6-pin SOT-23 package

PDIP

N/C

1

VDD 2 GP2/T0CKI/FOSC4 3 GP1/ICSPCLK 4

PIC10F200/202

PDIP

8

N/C

1

GP3/MCLR/V

PP

7

VSS

VDD

2

6

N/C

GP2/T0CKI/COUT/FOSC4

3

5

GP0/ICSPDAT

GP1/ICSPCLK/CIN−

4

PIC10F204/206

8

GP3/MCLR/VPP

7

VSS

6

N/C

5

GP0/CIN+

Figure 3.2 PIC10FXXX family in 8-pin PDIP package


THE PIC MICROCONTROLLER FAMILY

59

Table 3.2 Some PIC12CXXX family members

Program

Data

A/D

Microcontroller

memory

RAM

I/O pins

EEPROM

converters

12C508

256

× 12

25

6

0

0

12C509

1024

× 12

41

6

0

0

12C671

1024

× 14

128

6

0

4

12F629

1024

× 14

64

6

128

0

12F675

1024

× 14

64

6

128

4

3.1.2 The 12CXXX/PIC12FXXX Family

Table 3.2 gives a summary of the features of this family. The PIC12C508 is a member of this family with the following features.

PIC12C508. This is another low-cost microcontroller available in an 8-pin dual in-line package. The device has 512 × 12 word flash memory, 25 bytes of RAM data memory, six I/O ports, and one 8-bit timer. Operation is from a 4 MHz clock. Other members of the family have larger memories, higher speed, and A/D converters (e.g. 12C672).

The PIC12FXXX family has the same structure as the 12CXXX but with flash program memory and additional EEPROM data memory.

3.1.3 The 16C5X Family

Table 3.3 gives a summary of the features of this family. These devices have 14-, 18-, 20and 28-pin packages. The PIC16C54 is a member of this family with the following features.

PIC16C54. This is an 18-pin microcontroller with 384 × 12 EPROM program memory. The device has 25 bytes of RAM, 12 I/O port pins, a timer and a watchdog timer. Other members of the family have larger memories and more I/O ports.

3.1.4 The 16CXXX Family

Table 3.4 gives a summary of the features of this family. These devices are similar to the 16CXX series, but they have 14 bits of program memory and some of them have A/D converters. The PIC16C554 is a member of this family with the following features.

Table 3.3 Some PIC16C5X family members

Program

Data

A/D

Microcontroller

memory

RAM

I/O pins

EEPROM

converters

16C54

512

× 12

25

12

0

0

16C56

1024

× 12

25

12

0

0

16C58

2048

× 12

73

12

0

0

16C505

1024

× 12

72

12

0

0


60

THE PIC MICROCONTROLLER

Table 3.4 Some PIC16CXXX family members

Program

Data

A/D

Microcontroller

memory

RAM

I/O pins

EEPROM

converters

16C554

512

× 14

80

13

0

0

16C620

512

× 14

96

13

0

0

16C642

4096

× 14

176

22

0

0

16C716

2048

× 14

128

13

0

4

16C926

8192

× 14

336

52

0

5

PIC16C554. This is an 18-pin device with 512 × 14 program memory. The data memory is 80 bytes and 13 I/O port pins are provided. Other members of this family provide A/D converters (e.g. PIC16C76), USART capability (e.g. PIC16C67), larger memory, more I/O port pins and higher speed.

The PIC16FXXX family (e.g. PIC16F74) is upward compatible with the PIC16CXXX family. These devices are also 14 bits wide and have flash program memory and an internal 4 MHz clock oscillator as added features.

3.1.5 The 17CXXX Family

These are 16-bit microcontrollers. The program memory capacity ranges from 8192 × 16 (e.g. PIC17C42) to 16 384 × 16 (e.g. PIC17C766). The devices also have larger RAM data memories, higher current sink capabilities and larger I/O port pins, e.g. the PIC17C766 provides 66 I/O port pins. Table 3.5 gives a summary of the features of this family.

3.1.6 The PIC18CXXX Family

These are high-speed 16-bit microcontrollers, with maximum clock frequency 40 MHz. The devices in this family have large program and data memories, a large number of I/O pins, and A/D converters. They have an instruction set with 77 instructions, including multiplication. Table 3.6 gives a summary of the features of this family.

PIC18FXXX family members are upward compatible with PIC18CXXX. These microcontrollers in addition offer flash program memories and EEPROM data memories. Some members of the family provide up to 65 536 × 16 program memories and 3840 bytes of RAM memory.

Table 3.5 Some PIC17CXXX family members

Program

Data

A/D

Microcontroller

memory

RAM

I/O pins

EEPROM

converters

17C42

2048

× 16

232

33

0

0

17C43

4096

× 16

454

33

0

0

17C762

8192

× 16

678

66

0

16

17C766

16384

× 16

902

66

0

16