بسم الله الرحمن الرحيم
إخواني الكرام أحب أن أقدم لكم إن شاء الله أول مشروع من سلسلة المشاريع مفتوحة المصدر والتي سأقدمها لكم إن شاء الله عبر عدة مواضيع .. ولمن لا يعلم ماذا تعني المشاريع مفتوحة المصدر OPEN SOURCE ..
إ
نها المشاريع التي تحتوي على الكود ... (كود البرنامج) .
أسأل الله أن يوفقني في أن أقدم لكم عدد كبير من هذه المشاريع لكي يستفيد الجميع منها إن شاء الله .. وكم أتمنى أن يمتلئ هذا المنتدى المبارك بمثل هذه المشاريع التي تحتوي على الكود كاملا وبعض الشرح حوله ( إن أمكن) فأتمنى من الأعضاء والمشرفين المشاركة في تقديم مثل هذه المشاريع .. و
ربما في يوم من الأيام بعد أن تكثر هذه المشاريع يخصص لها قسم في هذا المنتدى .. الله أعلم ..
=============================================
التحكم في 48ريلاي بواسطة keypad و LCD وباستخدام 4514
هذا المشروع في الأصل طلب مني بواسطة الأخ الفاضل المهندس محمد (العابدي)
برنامج لتشغيل متحكم من نوع pic16f877A وذلك للتحكم بتشغيل 40 رلي مربوط على مخرجات البك بحيث يتم اختيار رقم الرلي المطلوب من خلال مفاتيح keybad واظهار الرقم المختار من خلال lcd وبعد ذلك يمكن عمل تصفير من خلال احد المفاتيح للقيام باختيار رقم رلي جديد
|
وإليكم إخواني الكرام رسمة الدائرة التي أرسلها لي أخي (العابدي)
وضعت لها تعديل بسيط في توصيل الكايباد . يمكنكم ملاحظته في ملف المحاكاه
وإليكم الكود الكامل (وإن شاء الله سيكون هناك شرح موجز عن هذا الكود)
علما أن هذا الكود بلغة مايكروسي
كود:
/*
Project : this project is designed to control of 45 relays
by typing the number of relay by using keypad
then this number displayed on LCD
and this relay which has this number will be ON if you push "=" button.
and you can clear LCD to write another number so the another relay
will be ON ,you can do this if you push"ON/c" button.
hardware: I use in this project pic16f877a , LCD 2*16 , IC 4514,relays
and keypad.
you can use another hardware by some adjusting.
Author : Ahmad Samir Fayed.
Country : Egypt.
Date :26/2/2009
copyright : all muslims and Arabs can use this code but without replacing
my name to another when using the same code.
(please don't waste my fatiguing)
*/
char m;
char result=0;
char number[]={'x',' ','9','8','7','x','6','5','4','x','3','2','1','x','x','0','x'};
char number2[]={'x',' ',9,8,7,'x',6,5,4,'x',3,2,1,'x','x',0,'x'};
char tens=0,ones=0;
void on() {
result=(tens*10)+ones;
if(result<16){result.f4=0;result.f5=1;result.f6=1;}
else if(result>=16&&result<=31){result=result-16;result.f4=1;result.f5=0;result.f6=1;}
else if(result>=32&&result<=47){result=result-32;result.f4=1;result.f5=1;result.f6=0;}
else if(result>47){Lcd_Cmd(Lcd_Clear);lcd_out_cp("error");delay_ms(1000);return;}
portd=result;
}
void main()
{
trisd=0;portd=0xF0;
Keypad_Init(&PORTC);
lcd_init(&portb);
lcd_cmd(LCD_CURSOR_OFF);
lcd_out(1,1,"Enter the number");
lcd_out(2,1," of relay");
loop: //testing the first pushing down
m=keypad_read();
if(m==0) {goto loop;}
else if(m==14){goto loop;}
else if(m==16){Lcd_Cmd(Lcd_Clear);portd=0xF0;goto loop;}
else {Lcd_Cmd(Lcd_Clear);tens=number2[m];lcd_chr_cp(number[m]);delay_ms(500);}
test2: //testing the second pushing down
m=keypad_read();
if(m==0) {goto test2;}
else if(m==14){ones=tens;tens=0;on();goto test3;}
else if(m==16){Lcd_Cmd(Lcd_Clear);portd=0xF0;goto loop;}
else {ones=number2[m];lcd_chr_cp(number[m]);delay_ms(500);}
test3: //testing the third pushing down
m=keypad_read();
if(m==0) {goto test3;}
else if(m==14){on();goto test3;}
else if(m==16){Lcd_Cmd(Lcd_Clear);portd=0xF0;goto loop;}
else {goto test3;}
}
ويمكنكم أحبتي في الله تحميل ملف المحاكاه وملف الهيكس والكود
من هذا الرابط
وفقنا الله جميعا لما يحب ويرضى ورزقنا وإياكم العلم النافع