أظن أنه عند تجاهل قيمة المتغيرات في بداية البرنامج
يأخذها 0
لكن المشكل ليس هنا
|
السلام عليكم
تمت حل مشكله
http://up.top4top.net/downloadf-top4...2e6a1-rar.html
هذا كود بأستخدام مكتبه جديده
كود:
sbit LCD0_RS at RD1_bit;
sbit LCD0_EN at RD0_bit;
sbit LCD0_D4 at RD4_bit;
sbit LCD0_D5 at RD5_bit;
sbit LCD0_D6 at RD6_bit;
sbit LCD0_D7 at RD7_bit;
sbit LCD0_RS_Direction at TRISD1_bit;
sbit LCD0_EN_Direction at TRISD0_bit;
sbit LCD0_D4_Direction at TRISD4_bit;
sbit LCD0_D5_Direction at TRISD5_bit;
sbit LCD0_D6_Direction at TRISD6_bit;
sbit LCD0_D7_Direction at TRISD7_bit;
/// Configuration de LCD
bit P1,P2,P3,P4;
unsigned char y=0,size1,i,display=0, count;
char text_lcd[16];
const char x0[] = " MESSAGE NUMBER ONE IS HERE ... (O_O) ";
const char x1[] = " MESSAGE NUMBER TWO IS HERE ... (O_O) ";
void show_message(const char *text);
void main()
{
//option_reg.b7=0;
TRISB=0XFF; // initialisation du port B en entrée
ADCON1=0X06;
cmcon=7;
Lcd0_Init();
Lcd0_Command(1);
Lcd0_GotoYX(0,0);
Lcd0_CstrOut("press any switch");
while(1)
{
if(RB0_bit==0) {display=1;delay_ms(250); }
if(RB1_bit==0) {display=2;delay_ms(250);}
if(display==1){
size1=sizeof(x0);//calcaulate size of txt
show_message(x0);
}
if(display==2)
{
size1=sizeof(x1);//calcaulate size of txt
show_message(x1);
}
}
}
void show_message(const char *text)
{
Lcd0_GotoYX(0,0);
Lcd0_CstrNout(text+y,16);
//lcd_out(1,1,text_lcd);
count++;
delay_ms(10);
if(count==10)// to reducing time
{
y++;
if(y==(size1-15))y=0;
count=0;
}
}
وهذا بأستخدام مكتبه القديمه
كود:
sbit LCD_RS at RD1_bit;
sbit LCD_EN at RD0_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD1_bit;
sbit LCD_EN_Direction at TRISD0_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
/// Configuration de LCD
bit P1,P2,P3,P4;
unsigned char y=0,size1,i,display=0, count;
char text_lcd[17];
const char x0[] = " MESSAGE NUMBER ONE IS HERE ... (O_O) ";
const char x1[] = " MESSAGE NUMBER TWO IS HERE ... (O_O) ";
void show_message(const char *text);
void main()
{
//option_reg.b7=0;
TRISB=0XFF; // initialisation du port B en entrée
ADCON1=0X06;
cmcon=7;
Lcd_Init();
lcd_cmd(_LCD_CURSOR_OFF);
Lcd_Cmd(1);
lcd_out(1,1,"press any switch");
while(1)
{
if(RB0_bit==0) {display=1;delay_ms(250); }
if(RB1_bit==0) {display=2;delay_ms(250);}
if(display==1){
size1=sizeof(x0);//calcaulate size of txt
show_message(x0);
}
if(display==2)
{
size1=sizeof(x1);//calcaulate size of txt
show_message(x1);
}
}
}
void show_message(const char *text)
{
for(i=0;i<17;i++)
{
if(i==16){text_lcd[16]=0;break;}
else text_lcd[i]=text[i+y];
}
lcd_out(1,1,text_lcd);
count++;
delay_ms(10);
if(count==10)// to reducing time
{
y++;
if(y==(size1-15))y=0;
count=0;
}
}
أخي رأيت انك أختاريت تردد كرستاله للمشروع 8mhz وضعت في بروتيس تردد كرستاله 4mhz يجب عليك مراعاه أعدادت وضبط كرستاله لكي لايحدث هناك مشاكل خصوصا مع الازمنه
تحياتي