Você está na página 1de 7

45

4 DESIGN PART

Digital control system can be built based on various microcontrollers.


There are tasks that require quick response of microcontroller system to
changes in external conditions. Such tasks require the use of microcontrollers with
a large range of peripherals, integrated into the crystal, including the
implementation of program and data memory, input-output devices, reducing
hardware costs and reduces the cost of manufacture of microcontroller system.
The design part is the design of the control computer (CCP) system for
automatic stabilization of the pitch angle of the AN-140. The Governing calculator
is a microcontroller with the work program that implements the control law of the
developed system. Microcontroller for interfacing with the control system using a
PWM modulator, which converts the input data coming from sensors in analog
form in a PWM signal to the MCU. An actuator control signal from tire through
the shaper of the MC transmitted to the DAC, which produces an analog control
signal to the power amplifier.
4.1 Preparation and implementation of control algorithms to control calculator
In the synthesis of system were formed limb-difference equations, whose
implementation on the control calculator and leads to correction system. Software
development begins with the design of the control algorithms calculator
implementing the control law in the contours of the developed system. After the
analysis of control algorithms can be seen that the input to the calculator is given
information about the (desired) value of the voltage to be considered in the serial
code in the standard RS-232, as well as signals from the tachometer (speed sensor)
and a feedback signal representing the levels and unipolar in the range of 0 ... 10 V
(based on the raw data.) The voltage adjustment range for the first sensor 4 ... 6 V,
and the second - 3 ... 5 V.
The input data received from sensors in analog form, and therefore they must
be converted into digital form. This requires the analog-to-digital signal
conversion. The input and output data determines the accuracy of information in
digital form. The required length of the discharge grid is determined by the
following step:

46

n n D nV

where

n D

(4.1)

digit capacity analog-to-digital converter (ADC)

n D

nV

additional bits to compensate for the computational error. The value


is
calculated on the basis of an accurate conversion is not worse than the accuracy of

D 0.5%

measurements, hence;
or
Absolute error of the AD conversion is

D D U max 0,005 12 0,06V

(4.2)

U max

where
the maximum value of the signal received from the sensors.
Find the necessary digit capacity of analog-to-digital converter:

n D log 2 MAX log 2 ( D U max ) log 2 10 log 2 (0,06) 7,64.

Given the rounding error and accept the ADC value of


must be at least ten digits.

n D 10

(4.3)

digits, ie the ADC

4.2 Structure of the complete system operation algorithm


Complete functioning of the algorithm for calculating the solution of the
T0
control consists of the steps that are executed cyclically with a period :
U [ kT0 ]
1) PWM code receive with the voltage value
;
U [kT0 ]
2) scaling and format conversion for
;
3) implementation of computing dependences in accordance with relations;
4) waiting for the completion period, realized through the expectation timer
interrupt signal;
5) reinitialization timer (starting record number) and go to step 1.

47

Asynchronous event in the system being developed are interrupt signals.


Interrupt temporary cessation of the main program in order to implement more
urgent at the moment of action (even not directly related to the main program),
occurring at any time on request of the external device, or in the case of the special
situation in the processor. Use of the system enables the interrupt arrange parallel
and independent operation of the processor and peripheral devices so that the
devices working in conjunction with the processor to inform the end of the next
cycle (phase) of its interrupt request signals.
T0
Timer interrupt sources are that implements the computation period
of the
discrete and the serial port, which generates an interrupt upon completion of
reception bytes.
4.3 Construction of functional diagram of the control calculator
Functional diagram of the control of the calculator is represented in
Figure 4.1.

Figure 4.1 Functional diagram of the control calculator


where,
S1, S2 Sensors;
PWM Pulse Width Modulator;
MC Microcontrollers;
BC Bus conditioners;
DAC Digital to Analog Converter.
4.4 Development of electrical schematic diagram of the calculator

48

AT89S8252 microcontroller series, shown in Fig. 4.2, one based on the


Atmel microcontroller MCS-51 series, which are able to function independently in
a local area network. This microcontroller is able to interrogate eight sensors and
perform PWM control five actuators.
D D 1
3
3
3
3
3
3
3
3

9
8
7
6
5
4
3
2
1
2
3
4
5
6
7
8

19
18
9
31
40

P
P
P
P
P
P
P
P

0
0
0
0
0
0
0
0

.0
.1
.2
.3
.4
.5
.6
.7

/A
/A
/A
/A
/A
/A
/A
/A

D
D
D
D
D
D
D
D

0
1
2
3
4
5
6
7

P
P
P
P
P
P
P
P

1
1
1
1
1
1
1
1

.0
.1
.2
.3
.4
.5
.6
.7

/T 2
/T 2 -E X
/S S
/M O S I
/M IS O
/S C K

XTA L1
XTA L2
R ST

P 2 .0 /A 8
P 2 .1 /A 9
P 2 .2 /A 1 0
P 2 .3 /A 1 1
P 2 .4 /A 1 2
P 2 .5 /A 1 3
P 2 .6 /A 1 4
P 2 .7 /A 1 5
P 3 .0 /R XD
P 3 .1 /T XD
P 3 .2 /IN T 0
P 3 .3 /IN T 1
P 3 .4 /T0
P 3 .5 /T1
P 3 .6 /W R
P 3 .7 /R D
PSEN
A L E /P R O G

21
22
23
24
25
26
27
28
10
11
12
13
14
15
16
17
29
30

E A /V P P
VC C

G N D

20

AT89S8252

Figure 4.2 Microcontroller AT89S8252


Selecting this microcontroller due to the following:
1) Low cost;
2) The ability to work at lower clock frequencies, which is important in realtime systems;
3) Flash-memory capacity of 8K programs, programmable through SPI;
4) EEPROM data memory 2K;
5) Internal 256 bytes of RAM;
6) Three 16-bit timer;
7) 9 interrupt sources;
8) Serial interfaces UART and SPI;
9) WD-programmable timer;
10) Two registers DPTR.
The lower 128 bytes of internal RAM are standard for MCS-51 structure.
The upper 128 bytes for the address value (80h-FFh) coincide with the address of
the RCF. Therefore, service registers RSF available through direct addressing (ie
the names of registers), and bytes of RAM - only through indirect addressing.

49

Flash-memory address space programs takes 0000h-1FFFh. When


programming through SPI interface overwrites the entire memory array.
DAC generates a voltage or current functionally script associated with the
control code. Functional relationship is linear in most cases. DAC taken as nodes
and feedback ADC to generate signals output digital measuring and computing
equipment. In this case, apart from the DAC chip in the circuit is not used, and the
process of converting binary to control analog signal occurs as follows: in the MC
program formed vihodnoy pulse signal, which is then on the operating smoothed
Amplifiers (LM324) with a filter that because equality ratings operates as a
repeater. Scheme incorporating this chip is shown in Fig. 4.3.
R18

VCC

3
2

DD4
12
11
10
9
8
7
6
5
14
15

B8

IOUT

4
R17

B7
B6
IOUT

B5

DA3

LM324

11

R16

B4
B3
B2
B1

COMP

16

VR+
VLC

VR-

DAC0802

Figure 4.3 Connection diagram of the DAC, DAC0809


As the sensor defining amperage battery specified in the technical task
variable resistor. In this regard, the input signal, proportional to the angle rheostat
efficiently expressed in the form of a pulse width modulated signal.
Pulse Width Modulation (PWM) - pulse sequence information which is
contained in the duty cycle, ie time ratio in the active state of the signal to the
PWM period. This signal is characterized by two levels - a logic zero and logic
one.
Develop electrical schematic diagram of the PWM modulator. One way to
structure developed modulator circuit is on two operational amplifiers. Wherein the
first operational amplifier is the reference frequency PWM generator and its circuit
is shown in Fig. 4.4.

50
R2
VCC

VCC
4

R3

DA2-1

C1
3

11

LM324

R5
R6

R7

Figure 4.4 Reference oscillator.


The second operational amplifier outputs PWM signal proportional to the
resistance of the potentiometer. For this purpose, one of its inputs is fed the
reference ramp signal, and the second (inverting) output - signal from the voltage
divider, one resistor which is a temperature sensor.
As operational amplifier microcircuit have chosen LM324, which is a four
operational amplifiers in a single housing. PWM modulator scheme is represented
in Fig. 4.5.

Figure 4.5 PWM (pulse width modulator)

51

Converted PWM signal via bus generator comes INTO microcontroller


input, where the measurement is the length of the pulse.
Since the output levels are insufficient to supply the microcontroller to the
input of the actuator need to use the bus generator which is used to increase the
power output signal to the microcontroller 20 mA, and for distinguishing the data
line and the microcontroller ports.
As a bus generator microcircuit KR1533AP6 use. Chip is a eight-bit
bidirectional transceiver with two states at the output and input information
without inversion. Mode is determined by a combination of signals on two control
inputs - COZ and COD. When submitting a low level signal to both inputs, we
obtain the transmission direction S2 S1. Wiring bus driver is shown in Fig. 4.6.
DD2
E

o19

T 1
18
17
16
15
14
13
12
11

B0

A0

B1

A1

B2

A2

B3

A3

B4

A4

B5

A5

B6

A6

B7

A7

2
3
4
5
6
7
8
9

KR1533AP6

Figure 4.6 Bus generator.

Você também pode gostar