|
Islom karimov
|
bet | 9/17 | Sana | 15.05.2024 | Hajmi | 8,88 Mb. | | #235422 |
Bog'liq БМИ Дониер (Lotincha) охиргиIshni bajarish tartibi:
1.Protes dasturni ochamiz va bizga kerak bo’lgan qurulmalarni to’pib olamiz.Biz kerak bo’lgan qurulmalar quyagilardan iboard:
1.lcd 16x2 –display ekran;
2.pic18F45K22-mikrokontroleri;
3.LM35-Xarorat o’lchaydigan datchik;
4.Potensiyometr;
5.Button-knopka;
Protes dastur:
Yangi oychish uchun:
Kerakli elementlarni olish uchun shu knopkani bosamiz:
Shu yerda kerakli elemantlarni tanlab olamiz.
2. Kerak elemantlarni olganmizdan keyin sxemani teramiz.
3. Sxemani terib bo’lganmizdan keyin mikrokatrolerga kod yozish uchun mikroC dasturiga o’tamiz.Bu dastur yordamda biz pic oylasiga kiradigan mikrokatrolerlarga kodlar yozishimiz mumkin.
MikroC dasturiga kirish:
Yangi oyna ochamiz:
Yangi oyna ochilganidan quydagi ketma-ketlikda dasturni to’ldirib chiqamiz:
Ketma-ketlikni to’g’ri bajarsangiz quydagi oyna ochiladi:
MikroC dasturni ishga turganimizdan so’ng u yerga kod quydagicha kod yozamiz:
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
unsigned int temp_res;
float temp;
unsigned char tempText[15];
void main()
{
ANSELB=0;
ANSELC=0x04;
TRISC4_bit=1;
ADC_Init();
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,"Xasanboyev");
Lcd_Out(2,6,"Dilshodjon");
Delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Digital");
Lcd_Out(2,6,"Termometr");
Delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Tempertura: ");
Lcd_Out(2,8,223);
do
{
temp_res=ADC_Read(15);
temp=(temp_res*5000.0)/1024;
temp=temp/10.0;
FloatToStr(temp,tempText);
tempText[4]=0;
Lcd_Out(2,3,tempText);
Delay_ms(300);
}while(1);
}
Kod yozilganidan keyin uni ishga tushuramiz:
Dasturni ishga tushurganimizdan keyin dasturning pastki oynasida quydagi yozuvlar chiqadi:
|
| |