Design Part

10
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

description

DESIGN PART

Transcript of Design Part

Page 1: Design Part

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:

Page 2: Design Part

46

n=nАD+nV , (4.1)

where n АD – digit capacity analog-to-digital converter (ADC)

nV – additional bits to compensate for the computational error. The value n АD is

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

measurements, hence; δ АD<δ or δ АD<0 .5 % . Absolute error of the AD conversion is

ΔАD=δ АD⋅Umax=0 ,005⋅12=0 ,06V (4.2)

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

n АD=log2αMAX−log2 (δАD⋅Umax )=log210−log2(0 ,06 )=7 ,64 . (4.3)

Given the rounding error and accept the ADC value of n АD=10

digits, ie the ADC must be at least ten digits.

4.2 Structure of the complete system operation algorithm

Complete functioning of the algorithm for calculating the solution of the

control consists of the steps that are executed cyclically with a period T 0 :

1) PWM code receive with the voltage value U [ kT 0 ];

2) scaling and format conversion for U [ kT 0 ];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.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

Page 3: Design Part

47

devices working in conjunction with the processor to inform the end of the next cycle (phase) of its interrupt request signals.

Timer interrupt sources are that implements the computation period T 0 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 inFigure 4.1.

Figure 4.1 – Functional diagram of the control calculatorwhere,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

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.

Page 4: Design Part

48

D D 1

AT89S 8252

91819

20

29

30

31

40

12345678

2122232425262728

1011121314151617

3938373635343332

R STXTA L2XTA L1

G N D

PSEN

ALE /PR OG

EA /VPP

VC C

P1 .0 /T2P 1 . 1 /T2 -E XP 1 .2P 1 . 3P 1 . 4 /S SP 1 .5 /MO S IP 1 . 6 /M ISOP 1 .7 /SC K

P 2 .0 /A 8P 2 . 1 /A 9P 2 . 2 /A 10P 2 . 3 /A 11P 2 . 4 /A 12P 2 . 5 /A 13P 2 . 6 /A 14P 2 . 7 /A 15

P 3 . 0 /R XDP 3 .1 /TXDP 3 .2 / IN T0P 3 .3 / IN T1P 3 .4 /T0P 3 . 5 /T1

P 3 . 6 /W RP3 .7 /R D

P 0 .0 /AD 0P 0 .1 /AD 1P 0 .2 /AD 2P 0 .3 /AD 3P 0 .4 /AD 4P 0 .5 /AD 5P 0 .6 /AD 6P 0 .7 /AD 7

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 real-

time 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.

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

Page 5: Design Part

49

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.

Figure 4.3 – Connection diagram of the DAC, DAC0809As 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.

Page 6: Design Part

50

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)

Page 7: Design Part

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.

Figure 4.6 – Bus generator.