|
ممكن تبعتلى التعديل اللى عملته فى الكود عشان اعرف المشكلة
|
لم اغير شئ سوى اني غيرت الارقام
كود:
// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
void main(){
TRISC = 0xff; // define PORT C as input
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
while(1)
{
// switch 1
if (RC0_bit == 1 )
Lcd_Out(1,1,"7");
else
Lcd_Out(1,1," ");
// switch 2
if (RC1_bit == 1 )
Lcd_Out(1,3,"4");
else
Lcd_Out(1,3," ");
//switch 3
if (RC2_bit == 1 )
Lcd_Out(1,5,"9");
else
Lcd_Out(1,5," ");
// switch 4
if (RC3_bit == 1 )
Lcd_Out(1,7,"3");
else
Lcd_Out(1,7," ");
// switch 5
if (RC4_bit == 1 )
Lcd_Out(1,9,"4");
else
Lcd_Out(1,9," ");
// switch 6
if (RC5_bit == 1 )
Lcd_Out(1,11,"6");
else
Lcd_Out(1,11," ");
// switch 7
if (RC6_bit == 1 )
Lcd_Out(1,13,"2");
else
Lcd_Out(1,13," ");
//switch 8
if (RC7_bit == 1 )
Lcd_Out(1,15,"5");
else
Lcd_Out(1,15," ");
}
}