You are on page 1of 3

APPENDEX

# include<built-in.h>

# define lcd PORTC

Sbit rs at PORTD4-bit;

Sbit EN at PORTD6-bit;

Sbit RW at PORT5-bit;

Sbit relay at PORTD2-bit;

Sbit relay2 at PORTD3-bit;

Unsigned int voltage,current,temp,current2,current1;

Int decimal,integer,float analog;

Void main(){

DDRC=0*FF; //set PORTB as out put

DDRC=0*FF; //set PORTC as out put

DDRD=0*FF;

Lcd();

UART1-init(9600);

Com(0*01);

Dal(0*80);

Lcd-string(Transformer protect);

Dal(0*c0);

Lcd-string(system by buga);

Delay-ms(1000);

Com(0*01);

Dal(0*80);

Lcd-strig(aminu bugaje);
Voltage=temp=current;

While(1){

Delay-ms(1000);

Temp=ADC-Read(0*00)/4;

Voltage=ADC-Read(0*01)/4;

Current=ADC-Read(0*02)/4; //get ADC valve from second channel

Com(0*c0);

Lcd-string(TEMP:);

Ascii(temp*2);

Com(0*d4);

Lcd-string(current:);

If (temp >20)

{com(0*cb);

Lcd-string(over);

If (temp<20)

{com(0*cb);

Lcd-string(norm);}

If (current>130)

{com(0*e2);

Lcd-string(over-);

Relay=0;}

If (current< 130)

{com(0*e2);

Lcd-string(norm-);

Relay=1;
}

If(voltage>120)

{com(0*a1);

Lcd-string(over-);

Relay2=0;

If((voltage<120)&&(voltage>=110))

{com(0*a1);

Lcd-string(norm-);

Relay2=1;

If(voltage<110)

{com(0*a1);

Lcd-string(under-);

Relay2=1;

You might also like