السلام عليكم
هل من احد طبق مشروع توصيل الجي بي اس مع البك والعرض على شاشة LCD
اني من يومين وانا اتخبط بين المواقع ولم انجح ابداا في عرض الداتا على الشاشه
هذا هوا الكود
كود:
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;
unsigned char message [70]; // array to store data needed
unsigned char dat [7]={'$','G','P','G','G','A','\0'}; //array used to compare
unsigned short i=0;
int m=0 ; // indicator for data array
int y =0 ;
void display_protocol() // function to display $GPGGA
{
int a=0;
Lcd_out(1,1,"First Protocol"); // to display first protocol first
for (a=0; a<=5; a++)
{
Lcd_chr(2,a+4,message[a]);
delay_ms(500); // delay between o/p letters
}
}
void display_longitude ()//function to print the longitude
{
int b=0;
Lcd_out(1,4,"Longitude");
for (b=18 ; b<=27 ; b++) // loop for longitude range
{
Lcd_chr(2,b-14,message[b]);
delay_ms(500);
}
}
void display_direction()
{
lcd_out(1,4,"direction");
lcd_chr(2,7,message[29]);
Delay_ms(800);
Lcd_Cmd(_LCD_CLEAR);
}
void display_latitude () //function to read latitude
{
int c=0;
Lcd_out(1,4,"Latitude");
for (c=31;c<=40;c++) // loop for latitude
{
Lcd_chr(2,C-28,message[c]);
delay_ms(500);
}
}
void main()
{
//anselb=0;
//anselc=0;
//anseld=0;
Lcd_Init();
UART1_Init(9600);
Delay_ms(500);
//UART2_Init(9600);
Delay_ms(500);
while(1)
{
if (UART1_data_ready())
{
i = uart1_read(); // Read the data from uart1 and put it in i
message[m]= i; // put i in the first location of message matrix
if (message[0]=='$')
{
m++;// increment m to save the rest of data
}
else
{
m=0; // to read data till receive $
}
}
if (m==60) // length of data needed
{
i=0;
while (i<=6) // loop for the first 6 characters in the sentence
{
if(message[i]== dat[i]) // compare data read from port with the data stored "GPGGA"
{
i++;
if (i == 6) // if they are equal
{
y=1; // indicator for the start of data after $GGPGA
}
}
else
{
break; // if data is not $GGPGA
}
}
if (y==1 ) // to dsiplay output on LCD
{
display_protocol();
Lcd_Cmd(_LCD_CLEAR);
delay_ms(300);
Lcd_Cmd(_LCD_CLEAR);
display_longitude ();
Lcd_Cmd(_LCD_CLEAR);
delay_ms(300);
display_direction();
delay_ms(300);
display_latitude ();
delay_ms(300);
m=0;
Lcd_Cmd(_LCD_CLEAR);
}
}
y=0;
} // of while (1)
} // of void main
اما بالنسبه الى التوصيل فقد جربت عده نصائح وافكار ..ولكن لا نتيجه بعد
بالنسبه الى المودم قد اختبرته بالاوسليسكوب وهوا يعمل جيداا ..وخرجه يصل الى 2.8 فولت .....
هل من شخص نفذ هذا المشروع ؟؟