السلام عليكم ..
انا بصدد برمجة PIC16F877A موصولة ب LCD20X2 وكتبت البرنامج لكنه لا يعرض بطريقة صحيحة ارجو المساعدة البرنامج كالاتي:
/*Header******************************************* ***********/
// LCD module connections
sbit LCD_RS at RC0_bit;
sbit LCD_EN at RC2_bit;
sbit LCD_D3 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 TRISC0_bit;
sbit LCD_EN_Direction at TRISC2_bit;
sbit LCD_D3_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
int a,roaa,H,E,k;
int t;
void main() {
t=0;
INTCON=0X00;
ADCON1=0X0F;
CMCON=0X00;
TRISC=0X00;
PORTB=0X00;
TRISB=0X00;
/*TRISB=0X00;
PORTB=0X00;
TRISC=0X00;
PORTC=0X00; */
TRISD=0XFF;
TRISA=0x00;
PORTA=0X0F;
LCD_Init( );
LCD_Cmd(_LCD_CLEAR);
LCD_Cmd(_LCD_CURSOR_OFF);
delay_ms(1000);
LCD_Out(1,3,"Nova Engineering");
delay_ms(3000);
LCD_Cmd(_LCD_CLEAR);
LCD_Out(1,3,"Welcome To Laser");
LCD_Out(2,7,"Therapy");
delay_ms(3000);
LCD_Cmd(_LCD_CLEAR);
roaa:
LCD_Out(1,5,"PRESS MENU");
if(RD4_bit==1)
{ delay_ms(900);
LCD_Cmd(_LCD_CLEAR); }
else
goto roaa;
LCD_Out(1,1,"Select Time");
LCD_Out(2,2,"<<");
LCD_Out(2,8,">>");
H:
if(RD5_bit==1)
{
t=t+1;
}
if(t==1)
{
LCD_Out(2,5,"01");
}
if(t==2)
{
LCD_Out(2,5,"02");
}
if(t==3)
{
LCD_Out(2,5,"03");
}
if(t==4)
{
LCD_Out(2,5,"04");
}
if(t==5)
{
LCD_Out(2,5,"05");
}
if(t==6)
{
LCD_Out(2,5,"06");
}
if(t==7)
{
LCD_Out(2,5,"07");
}
if(t==8)
{
LCD_Out(2,5,"08");
}
if(t==9)
{
LCD_Out(2,5,"09");
}
if(t==10)
{
LCD_Out(2,5,"10");
}
if(t==11)
{
LCD_Out(2,5,"11");
}
if(t==12)
{
LCD_Out(2,5,"12");
}
if(t==13)
{
LCD_Out(2,5,"13");
}
if(t==14)
{
LCD_Out(2,5,"14");
}
if(t==15)
{
LCD_Out(2,5,"15");
}
if(RD2_bit==1)
{
t=t-1;
}
if(t==0)
{
LCD_Out(2,5,"0");
}
if(RD1_bit==1)
{ delay_ms(4000);
LCD_Cmd(_LCD_CLEAR);
delay_ms(1000);
}
else
{
delay_ms(200);
goto H;
}
LCD_Out(1,1,"Time=");
LCD_Out(2,8,"min.");
delay_ms(3000);
LCD_Cmd(_LCD_CLEAR);
delay_ms(900);
LCD_Out(1,1,"Select Power");
LCD_Out(2,2,"<<");
LCD_Out(2,7,"mw");
LCD_Out(2,10,">>");
delay_ms(3000);
E:
if (RD6_bit==1)
{
LCD_Out(2,5,"25");
}
if(RD3_bit==1)
{
LCD_Out(2,5,"50");
}
if(RD1_bit==1)
{ delay_ms(2000);
LCD_Cmd(_LCD_CLEAR);
delay_ms(500);
}
else
{delay_ms(200);
goto E;
}
LCD_Out(1,1,"Power=");
LCD_Out(1,10,"mw");
if (RD6_bit==1)
{
LCD_Out(1,7,"25");
}
if(RD3_bit==1)
{
LCD_Out(1,7,"50");
}
delay_ms(4000);
LCD_Cmd(_LCD_CLEAR);
delay_ms(1000);
LCD_Out(1,1,"PRESS POWER TO START");
p:
if(RD0_bit==1)
{ delay_ms(3000);
LCD_Cmd(_LCD_CLEAR);
delay_ms(1000);
}
else
{delay_ms(200);
goto p ;
}
LCD_Out(1,5,"LASER ON");
while(1);
}