السلام عليكم يا اخواني كانت هذه اول تجربة لي استعملت شاشة lcd16*2 كريستال و pic16f628a واستعملت المذبذب الداخلي للميكروكنترولر اليكم الخطاطة على برنامج بروتوس : http://www.mediafire.com/?th1n4yk2tn9i887 واستعملت البرنامج الميكروسي التالي:
كود:
// Lcd pinout settings
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;
// Pin direction
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;
void main() { PCON.F3=1;
Lcd_Init();
Lcd_Out(1,5,"Hello");
Lcd_out(2,3,"my computer");
}
اي انني قمت بكتابة hello في الصف الأول العمود الخامس ويمكن أن نستبدل العمود ونكتب العمود 1 مثال
كود:
Lcd_Out(1,1,"Hello");
كما يمكننا أيضا ازالة المؤشر بالامر الثالي
كود:
Lcd_Cmd(_lcd_cursor_off);
كما يمكننا ان نجعل الشاشة فارغة من اي كتابة وذلك بكتابة الأمر :
كود:
Lcd_Cmd(_lcd_clear);
ليكون شكل البرنامج كالاتي :
كود:
// Lcd pinout settings
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;
// Pin direction
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;
void main() { PCON.F3=0;
Lcd_Init();
Lcd_Cmd(_lcd_cursor_off);
Lcd_Cmd(_lcd_clear);
Lcd_Out(1,1,"Hello");
Lcd_out(2,3,"my computer");
}
كما أن هناك أوامر للتحكم انظر الى الصورة التالية :
http://www.mediafire.com/view/?tg2vsymq39ygypc#