Вы находитесь на странице: 1из 4

Response of output voltage under PI control

2.5

2
output voltage in volts

1.5

0.5

0
0 10 20 30 40 50 60

time in seconds

Fig. : out put voltage for RC network for reference of 2 volts.

1.6

1.4
output voltage in volts

1.2

0.8

0.6

0.4

0.2

0
0 10 20 30 40 50 60

time in seconds
Fig. : out put voltage for RC network for reference of 1.5 volts.
U1
19 39
XTAL1 P0.0/AD0
38
P0.1/AD1
37
P0.2/AD2
18 36 C1(2)
XTAL2 P0.3/AD3
35
P0.4/AD4
34 R10
P0.5/AD5
33
P0.6/AD6
9 32
RST P0.7/AD7 U3 5k
C1 U4
21 12 3
P2.0/A8 A8 VEE
U2(CLOCK) 22 11 16
P2.1/A9 A7 COMP
23 10
P2.2/A10 A6
29 24 9 4 0.1uF
U2 PSEN P2.3/A11 A5 IOUT
VCC 30 25 8
ALE P2.4/A12 A4
26 10 31 26 7 15
IN0 CLOCK EA P2.5/A13 A3 VREF- OPAMP
27 6 27 6 R15k
IN1 START P2.6/A14 A2
28 28 5 14
IN2 P2.7/A15 A1 VREF+
1 7 R11 +88.8
IN3 EOC 5k
2 1 10 DAC0808 Volts
IN4 P1.0 P3.0/RXD
+88.8 3 21 2 11 R1(2)
IN5 OUT1 P1.1 P3.1/TXD
Volts 4 20 3 12
IN6 OUT2 P1.2 P3.2/INT0
5 19 4 13
IN7 OUT3 P1.3 P3.3/INT1
18 5 14
OUT4 P1.4 P3.4/T0
25 8 6 15
ADD A OUT5 P1.5 P3.5/T1
24 15 7 16
ADD B OUT6 P1.6 P3.6/WR
23 14 8 17
ADD C OUT7 P1.7 P3.7/RD
22 17
ALE OUT8
U2(VREF(+)) AT89C51 R3(2)
12 DBG_TRACE=1
VREF(+)
16 9
VREF(-) OE
A
ADC0808 R2 R3
B
500k 500k
C

+88.8
Volts

C2 C3
0.1uF 0.1uF

Fig.: simulation circuit in PROTEUS software. RC network has resistance value of 500 k and capacitor value of 0.1 micro farad.
8051 code:
#include <reg51.h>
#include <intrins.h>
#include <math.h>

sbit ale=P3^2; //Address latch enable


sbit oe=P3^3; //Output enable
sbit sc=P3^5; //Start conversion
sbit eoc=P3^4;
sbit wave = P3^0;
static volatile unsigned int input ;

static volatile float m_k_1 = 0;


static volatile float y_k_1 = 0;
static volatile float e_k_1 = 1;

void delay(unsigned char ns)


{
unsigned char n;
unsigned int i;
for (n=0; n<ns; n++)
{
for (i=0; i<5; i++);
}
}
void main() //INTERRUPT
{
while(1)
{
P1=0xFF;
delay(1);
ale=1; //Address latch enable
delay(1);
sc=1; //Start conversion
delay(1);
ale=0; //Address latch Disable
delay(1);
sc=0;
while(eoc==1); //End of conversion
while(eoc==0);
oe=1; //Output enable
input=P1;
e_k=200-input;
delay(1);
oe=0;

m_k = m_k_1+10*(e_k-e_k_1)+0.009*e_k; //Kp = 10, Ki = 0.009

P2 =m_k;
delay(1);
m_k_1 = m_k;
e_k_1 = e_k;
y_k_1 = y_k;
delay(1);

}
}