 |
:: عضو ذهبي ::
تاريخ التسجيل: Apr 2011
الدولة: مصر .. محافظة دمياط
المشاركات: 1,682
|
|
نشاط [ عبدالله حجازى ]
قوة السمعة:
|
|
30-05-2020, 06:55 AM
المشاركة 1
|
|
نظام واجة لكشف الحريق برقم الغرف
السلام عليكم ورحمه الله
دائرة انترفاس
لكشف رقم الغرفة اللتي يوجد بها حريق
بستخدام شاشة لبيان أسم ورقم الغرفه
مع لمبات لبيان رقم الغرف

لغة البرمجة C مع المترجم mikroC PRO for PIC
كود المشروع
كود:
// LCD module connections
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections
char txt1[] = "SYSTEM CONTROL";
char txt2[] = "SCANNING ROOMS";
char txt3[] = "Room No. ^ 1 ^ ";
char txt4[] = "WARNING ERROR";
char txt5[] = "Room No. ^ 2 ^ ";
char txt6[] = "Room No. ^ 3 ^ ";
char txt7[] = "Room No. ^ 4 ^ ";
char txt8[] = "Room No. ^ 5 ^ ";
char txt9[] = "Room No. ^ 6 ^ ";
char txt10[] = "Room No. ^ 7 ^ ";
char txt11[] = "Room No. ^ 8 ^ ";
//////////////////////////////////
unsigned int x1=0,x2=0,x3=0,x4=0,x5=0,x6=0,x7=0,x8,x9=0,x10=0,x11=0,x12=0,x13=0,x14=0,x15=0,x16,x17,x18;
void main() {
trisa=48; porta=0;
trisb=192;
trisd=240; portd=0;
trisc=240; portc=0;
adcon1=0x06;
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
/*Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off*/
while(1)
{
if(portd.f7==0&&portd.f6==0&&portd.f5==0&&portd.f4==0&&
portc.f7==0&&portc.f6==0&&portc.f5==0&&portc.f4==0){ Lcd_Out(1, 2,txt1); Lcd_Out(2, 2,txt2); delay_ms(2800); };
//*******************************************//
if(porta.f5==1){porta.f0=0;}
//*********** test Room ( 1 ) **************//
if(portd.f7==1&&x1==0&&x2==0){porta.f0=1; portd.f3=1; Lcd_Out(1, 2,txt3); Lcd_Out(2, 2,txt4); delay_ms(3000);x2=1; x1=1;}
if(portd.f7==0&&x1==0){porta.f0=0; portd.f3=0;x1=0;x2=0;}
if(porta.f5==0&&x1==1){porta.f0=1;x1=0;}
//------**************************---------//
//***********test Room ( 2 )************//
if(portd.f6==1&&x3==0&&x4==0){porta.f0=1; portd.f2=1; Lcd_Out(1, 2,txt5); Lcd_Out(2, 2,txt4); delay_ms(3000);x4=1; x3=1;}
if(portd.f6==0&&x3==0){porta.f0=0; portd.f2=0;x3=0;x4=0;}
if(porta.f5==0&&x3==1){porta.f0=1;x3=0;}
//***************************************//
//*********test Room ( 3 )*********//
if(portd.f5==1&&x5==0&&x6==0){porta.f0=1; portd.f1=1; Lcd_Out(1, 2,txt6); Lcd_Out(2, 2,txt4); delay_ms(3000);x6=1; x5=1;}
if(portd.f5==0&&x5==0){porta.f0=0; portd.f1=0;x5=0;x6=0;}
if(porta.f5==0&&x5==1){porta.f0=1;x5=0;}
//**************************************//
//***********test Room ( 4 )**********//
if(portd.f4==1&&x7==0&&x8==0){porta.f0=1; portd.f0=1; Lcd_Out(1, 2,txt7); Lcd_Out(2, 2,txt4); delay_ms(3000);x8=1; x7=1;}
if(portd.f4==0&&x7==0){porta.f0=0; portd.f0=0;x7=0;x8=0;}
if(porta.f4==0&&x7==1){porta.f0=1;x7=0;}
//*************************************//
//***********test Room ( 5 )*********//
if(portc.f7==1&&x9==0&&x10==0){porta.f0=1; portc.f3=1; Lcd_Out(1, 2,txt8); Lcd_Out(2, 2,txt4); delay_ms(3000);x10=1; x9=1;}
if(portc.f7==0&&x9==0){porta.f0=0; portc.f3=0;x7=0;x10=0;}
if(porta.f7==0&&x9==1){porta.f0=1;x9=0;}
//*************************************//
//***********test Room ( 6 )*********//
if(portc.f6==1&&x11==0&&x12==0){porta.f0=1; portc.f2=1; Lcd_Out(1, 2,txt9); Lcd_Out(2, 2,txt4); delay_ms(3000);x12=1; x11=1;}
if(portc.f6==0&&x11==0){porta.f0=0; portc.f2=0;x7=0;x12=0;}
if(porta.f6==0&&x11==1){porta.f0=1;x11=0;}
//*************************************//
//************test Room ( 7 )*********//
if(portc.f5==1&&x13==0&&x14==0){porta.f0=1; portc.f1=1; Lcd_Out(1, 2,txt10); Lcd_Out(2, 2,txt4); delay_ms(3000);x14=1; x13=1;}
if(portc.f5==0&&x13==0){porta.f0=0; portc.f1=0;x7=0;x14=0;}
if(porta.f5==0&&x13==1){porta.f0=1;x13=0;}
//************************************//
//*************test Room ( 8 )********//
if(portc.f4==1&&x15==0&&x16==0){porta.f0=1; portc.f0=1; Lcd_Out(1, 2,txt11); Lcd_Out(2, 2,txt4); delay_ms(3000);x16=1; x15=1;}
if(portc.f4==0&&x15==0){porta.f0=0; portc.f0=0;x7=0;x16=0;}
if(porta.f4==0&&x15==1){porta.f0=1;x15=0;}
//************************************//
}
}
لتحميل ملفات المشروع
https://drive.google.com/drive/folde...9W?usp=sharing
بالتوفيق
..
التعديل الأخير تم بواسطة : عبدالله حجازى بتاريخ 30-05-2020 الساعة 07:31 AM
|