السلام عليكم
لقد قمت بتطبيق مشروع بسيط للاستاذ فهد فى هذا الموضوع
http://www.qariya.com/vb/showthread.php?t=104060
ولكن الشاشه لا تريد عرض اي شئ مع ان الدائره سليمه مئه بالمئه فقد جربت عليها مشروع عرض درجات الحرارة ومشروع اخر بسيط WELCOME
وهذا شكل الشاشه عند تشغيل الداره
وهذا هوا الكود :
كود:
// 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 Message1[]="T.P.H.A="; // Message for line1;
unsigned int number = 0;
char *digit = "0000";
void Display_init() // define display_init;
{
digit[0] = number/1000 + 48; // thousands digit;
digit[1] = (number/100)%10 +48; // hundreds digit;
digit[2] = (number/10)%10 + 48; // tens digit;
digit[3] = number%10 +48;
Lcd_Out(2,1,"DEPTH NOW=");
Lcd_Out(2,15,"FT"); // unit digit;
Lcd_Out(2,11,digit);
}
bit oldstate1;
bit oldstate2;
void main() // main;
{
TRISC=0XFF ; // make PORTC as inputs for buttons;
TRISB = 0; // Set PORTB direction to be output;
PORTB = 0;
Lcd_init(); // LCD Initialization;
Lcd_cmd(_LCD_CLEAR); // Clear LCD;
Lcd_cmd(_LCD_CURSOR_OFF); // Cursor mode, off;
Lcd_out(1,1,Message1);
Delay_ms(500);
while(1) {
if (Button(&PORTC, 0, 1, 1)) { // Button 1 : Detect logical 1
oldstate1 = 1; // Update flag
}
if (oldstate1 && Button(&PORTC, 0, 1, 0)) { // Detect one-to-zero transition
//Delay_ms(200); // If button is pressed, delay 0,2s and decrement "number" with 1;
number = number + 1;
oldstate1 = 0; // Update flag
}
if(Button(&PORTC,1,1,1)){ // Button 1 : Detect logical 1
oldstate2 = 1; // Update flag
}
if (oldstate2 && Button(&PORTC, 1, 1, 0)) { // Detect one-to-zero transition
Delay_ms(200); // If button is pressed, delay 0,2s and decrement "number" with 1;
number = number -1;
oldstate2 = 0; // Update flag
}
if (number > 9999u) // if it's more than 9999 go to 0;
number = 0;
display_init(); // call display_init();
}
}
وهنا ملفات المشروع
http://www.mediafire.com/?hinsrzkahm4yb4q
والفرق بيني وبين موضوع الاستاذ فهد فقط تغيير الاطراف من البورت دي الى البورت بي لتعريف الشاشه ..طبعاا مع تغيير الكود ..وقد الغيت اخر ربع اسطر فى الكود وهذا ليس له علاقه بمشكله العرض