Об игре
Новости
Войти
Регистрация
Рейтинг
Форум
13:27
3898
 online
Требуется авторизация
Вы не авторизованы
   Форумы-->Форум для внеигровых тем-->

Авторкоментарии к програме написаной на C++
Помогите написать коментарии к проге, на сишке!
Оч нужно(нун сдать курсак((()

#include "ADuC812.h"
#include "max.h"
#include "KB.h"
#include "i2c.h"
#include "lcd.h"
#include "rtc.h"
//#include "stdio.h"
//#include "math.h"



extern int sprintf (char *, const char *, ...);

int T,VL,DV,kol,Tmin,Tmax;
TIME Opros;



void FROM_TM0(void) interrupt 1
{
TIME vrem;
char outstr[16];
unsigned int ch;

TH0=0xDC;
TL0=0x31;
kol++;
if (kol==100)
{
kol=0;
TR0=0;

GetTime(&vrem);
sprintf (outstr,"%d:%d:%d ", (int)vrem.hour, (int)vrem.min, (int)vrem.sec);
LCD_GotoXY(0,0);
LCD_Type(&outstr);

if (((vrem.min*60+vrem.sec)-(Opros.min*60+Opros.sec))==10)
{
LCD_GotoXY(0,1);
LCD_Type("Temp ");

LCD_Putch((T/10)+48);
LCD_Putch((T%10)+48);

LCD_Type(" Vlag ");
LCD_Putch((VL/10)+48);
LCD_Putch((VL%10)+48);
Opros=vrem;

ch=0;
if ((VL<=47)||(VL>=52)) {ch=ch | 1;}
// if ((T<=Tmin)||(T>=Tmax)) {ch= ch | 2;}
WriteMax(SV,ch);
// if (T<=20) {Buzz();}

}

TR0=1;
}
}


void SetVector(unsigned char xdata *Address, void *Vector)
{
unsigned short xdata *TmpVector;
*Address = 0x02;
TmpVector = (unsigned short xdata *) (Address+1);
*TmpVector = (unsigned short) Vector;
}


void main(void)
{

unsigned char s;
int i;

T=38;
Tmin=36;
Tmax=40;
VL=50;
DV=0;
s=0;
kol=0;
InitLCD();
SetVector(0x200B,(void *) FROM_TM0);
TMOD=1;
ET0=1;
EA=1;
TH0=0xDC;
TL0=0x31;
GetTime(&Opros);
TR0=1;


while (1)
{
while (ScanKBOnce(&s)==0) {}
if (s=='1') {T-=5;}
if (s=='2') {T+=5;}
if (s=='4') {VL-=5;}
if (s=='5') {VL+=5;}
if (s=='0') {DV=1;}


for (i=0;i<20000;i++)
{Delay();}

}
}
// made by К.О.

#include "ADuC812.h"
#include "max.h"
#include "KB.h"
#include "i2c.h"
#include "lcd.h"
#include "rtc.h"
//#include "stdio.h"
//#include "math.h"



extern int sprintf (char *, const char *, ...);

int T,VL,DV,kol,Tmin,Tmax; // обьявляем переменные
TIME Opros; // еще одна перенменная



void FROM_TM0(void) interrupt 1 // обьявляем функцию
{ // фигурная скобка
TIME vrem; // опять обьявляем
char outstr[16]; // строка
unsigned int ch; // целое

TH0=0xDC;
TL0=0x31;
kol++; // увеличиваем kol на 1
if (kol==100) // если
{ // фигурная скобка
kol=0;
TR0=0; // ТР0лоло ~_O

GetTime(&vrem); // получаем время
sprintf (outstr,"%d:%d:%d ", (int)vrem.hour, (int)vrem.min, (int)vrem.sec); // выводим время
LCD_GotoXY(0,0); // отправляемся в ЛСДшный трип
LCD_Type(&outstr);

if (((vrem.min*60+vrem.sec)-(Opros.min*60+Opros.sec))==10) // если
{ // фигурная скобка
LCD_GotoXY(0,1);
LCD_Type("Temp ");

LCD_Putch((T/10)+48);
LCD_Putch((T%10)+48);

LCD_Type(" Vlag ");
LCD_Putch((VL/10)+48);
LCD_Putch((VL%10)+48);
Opros=vrem;

ch=0;
if ((VL<=47)||(VL>=52)) {ch=ch | 1;}
// if ((T<=Tmin)||(T>=Tmax)) {ch= ch | 2;}
WriteMax(SV,ch);
// if (T<=20) {Buzz();}

}

TR0=1; // TR0лоло!
}
}


void SetVector(unsigned char xdata *Address, void *Vector)
{
unsigned short xdata *TmpVector;
*Address = 0x02;
TmpVector = (unsigned short xdata *) (Address+1);
*TmpVector = (unsigned short) Vector;
}


void main(void) // функция main
{

unsigned char s;
int i;

T=38;
Tmin=36;
Tmax=40;
VL=50;
DV=0;
s=0;
kol=0;
InitLCD();
SetVector(0x200B,(void *) FROM_TM0);
TMOD=1;
ET0=1;
EA=1;
TH0=0xDC;
TL0=0x31;
GetTime(&Opros);
TR0=1;


while (1)
{
while (ScanKBOnce(&s)==0) {}
if (s=='1') {T-=5;}
if (s=='2') {T+=5;}
if (s=='4') {VL-=5;}
if (s=='5') {VL+=5;}
if (s=='0') {DV=1;}


for (i=0;i<20000;i++)
{Delay();}

}
} // фигурная скобка
если серьезно то лучше переписать это поделие а не комментировать.
К списку тем
2007-2025, онлайн игры HeroesWM