GPS, PIC18f452 and LCD

Status
Not open for further replies.

emanuelss

Junior Member level 1
Joined
Mar 11, 2011
Messages
16
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,446
i'm student tring to develop an aplication that gets the nmea code $gpgga from gps garmin and send thought gprs SIMM900.

but my first step is get the code...
i did and send to pc thought max 232 to pc... fine works beautiful... but when i send it thought pic to display in the lcd, some caracteres are not fine, are grab... i dont know why is that.

some one can help me?

my garmin is from etrax summit
 

what help you expect here now???? who can understand your problem without circuit and code.... you did not tell how many characters you are getting properly. increase the array length used to store the incoming data.

are you printing data on LCD in ISR ?????

learn to post the requirement properly.....
 

take it easy bro...
for testing, i'm geting 1 caractere each time and storing in an char array.
and afater that i'm printing on the display.
but i dont know what is ISR...
sory, i'm just in the beginning of it.

dont use sms kind or short hand typing language in the forum
 

    V

    Points: 2
    Helpful Answer Positive Rating
hi this is the code just for the first step, whitch is to get de gps and disply in the lcd.

char i;
unsigned short j;
char strGPS[16];

void main (){

Usart_Init(4800);

do{

LCD_init(&portB); //Init sinaliza a configuração 'default' (D7,D6,D5,D4,E,RS)
delay_ms(1000);
Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(Lcd_Cursor_Off);

if (Usart_Data_Ready())
{
for (j = 0; j < 15; j++)
{
i = Usart_Read();
Lcd_Out(1,2,i);
strGPS[j]=i;
Lcd_Out(2,1,strGPS);

}

Lcd_Cmd(Lcd_Clear);
Lcd_Cmd(Lcd_Cursor_Off);
}

}while(1);

}

---------- Post added at 12:13 ---------- Previous post was at 12:12 ----------

i'm organizing the circuit to post.
 

hi, ckshivaram
my circuit...


and here goes an youtube video that show exactly what i want.
YouTube - GPS GT-320 + PIC 16f877A - By Marlon
but my pic is 18f452.

thanks!

---------- Post added at 11:28 ---------- Previous post was at 11:26 ----------

i think there is a problem in the usart_read;
 

yes.
but the code i've send to you just take what came from gps and show on the lcd.
this part i still dont know why it's wrong because the caracteres are not ok, it's showing some garbage, not the proper caracteres.
 

some times????? could you clarify more on it. when you get junk and when you get correct.. what is the probability of getting correct data out of ten trials.........
 

I was thinking it was casual, but no.
some characters appear, I thought were valid, but all are garbage.

---------- Post added at 14:07 ---------- Previous post was at 14:06 ----------

sometimes appear the "G" caracter... i thik "ohh i did it" but in sequence.... garbage... garbage... garbage
 

#include <p18f2610.h>
#include <delays.h>
#include <usart.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define CR 0x0D //carriage return char

#pragma config OSC=HSPLL, WDT=OFF, LVP=OFF, DEBUG=ON

int data=0;


volatile char signal, received;
void high_int_handler (void);

#pragma code high_interrupt = 0x08

void high_int (void){
_asm goto high_int_handler _endasm
}

#pragma code
#pragma interrupt high_int_handler

void high_int_handler (void){

received = 1;
signal = getcUSART(); // Get a character from the USART
i = RCREG; //clear RCREG to clear receive interrupt flag

}

void main (void){

unsigned int j=0; //counter to print gps string
char GPS[100];
unsigned int count=0; //count number of char

TRISC = 0x80;
PORTC = 0;

OpenUSART(USART_TX_INT_OFF &
USART_RX_INT_ON &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_LOW, 64);

RCONbits.IPEN = 1; // Enable interrupt priority
IPR1bits.RCIP = 1; // Make receive interrupt high priority
INTCONbits.GIEH = 1; // Enable all high priority interrupts

received = 0;

while(data<100){

if (received == 1) {
received = 0;

GPS[data] = signal; //copy into array
data++;

}

}
putsUSART(GPS);
}

---------- Post added at 22:39 ---------- Previous post was at 22:38 ----------

" One suggestion increase the array size to 100 and try it.........."
 
Reactions: MRAMA

    MRAMA

    Points: 2
    Helpful Answer Positive Rating
thanks!
i'll test it.
but whitch cimpiler did u used?
i use microC, and it don't acept "#includes"
 

The procedure of catching and saving of $GPRMC sentence is like this : eg
1)Is the signal '$' ?
If Yes goto step 2 else Exit
2)Is the signal 'G' ?
If Yes goto step 3 else Exit
3)Is the signal 'P' ?
If Yes goto step 4 else Exit
4)Is the signal 'R' ?
If Yes goto step 5 else Exit
5)Is the signal 'M' ?
If Yes goto step 6 else Exit
6)Is the signal 'C' ?
If Yes goto step 7 else Exit
7)Neglect ','
8) Start saving the next signals up to a selected number
9) Check for 'A'
If Yes goto step 10 else Exit
10) This is a valid sentence you can process it as you like .

---------- Post added at 22:49 ---------- Previous post was at 22:49 ----------

i use MPLAB..
 
humm MPLAB.... ok
yes the process had a clue how to do... at the first time i did the function that process the string... but the caracteres garbage, so i'd never found the correct sequence.
thanks again.
 

erro!
erro!
erro!
Executing: "C:\Program Files (x86)\MPLAB IDE\MCHIP_Tools\mpasmwin.exe" /q /p18F452 "gps.c" /l"gps.lst" /e"gps.err" /o"gps.o"
Error[105] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 1 : Cannot open file (Include File "p18f2610.h" not found)
Error[105] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 2 : Cannot open file (Include File "delays.h" not found)
Error[105] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 3 : Cannot open file (Include File "usart.h" not found)
Error[105] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 4 : Cannot open file (Include File "stdio.h" not found)
Error[105] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 5 : Cannot open file (Include File "string.h" not found)
Error[105] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 6 : Cannot open file (Include File "stdlib.h" not found)
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 10 : Illegal opcode (config)
Error[150] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 12 : Labels must be defined in a code or data section when making an object file
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 12 : Illegal character (=)
Error[152] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 12 : Executable code and data must be defined in an appropriate section
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 14 : Illegal opcode (char)
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 15 : Illegal opcode (high_int_handler)
Error[113] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 17 : Symbol not previously defined (high_interrupt)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 17 : Illegal character (=)
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 19 : Illegal opcode (high_int)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 20 : Illegal character ({)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 21 : Found label after column 1. (_asm)
Error[113] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 21 : Symbol not previously defined (high_int_handler)
Error[113] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 21 : Symbol not previously defined (_endasm)
Error[112] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 21 : Missing operator
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 22 : Illegal character (})
Error[154] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 24 : Each object file section must be contiguous (section #pragma)
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 25 : Illegal opcode (interrupt)
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 27 : Illegal opcode (high_int_handler)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 28 : Found label after column 1. (received)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 29 : Found label after column 1. (signal)
Error[113] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 29 : Symbol not previously defined (getcUSART)
Error[124] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 29 : Illegal argument
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 30 : Found label after column 1. (i)
Error[113] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 30 : Symbol not previously defined (RCREG)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 31 : Illegal character (})
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 33 : Illegal opcode (main)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 35 : Found label after column 1. (unsigned)
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 35 : Illegal opcode (int)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 36 : Found label after column 1. (char)
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 36 : Illegal opcode (GPS)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 37 : Found label after column 1. (unsigned)
Error[122] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 37 : Illegal opcode (int)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 39 : Found label after column 1. (TRISC)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 40 : Found label after column 1. (PORTC)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 42 : Found label after column 1. (OpenUSART)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 42 : Illegal character (()
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 43 : Found label after column 1. (USART_RX_INT_ON)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 43 : Illegal character (&)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 44 : Found label after column 1. (USART_ASYNCH_MODE)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 44 : Illegal character (&)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 45 : Found label after column 1. (USART_EIGHT_BIT)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 45 : Illegal character (&)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 46 : Found label after column 1. (USART_CONT_RX)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 46 : Illegal character (&)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 47 : Found label after column 1. (USART_BRGH_LOW)
Error[108] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 47 : Illegal character (,)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 49 : Found label after column 1. (RCONbits.IPEN)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 50 : Found label after column 1. (IPR1bits.RCIP)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 51 : Found label after column 1. (INTCONbits.GIEH)
Warning[207] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 53 : Found label after column 1. (received)
Error[129] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 68 : Expected (ENDW)
Error[129] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 69 : Expected (END)
BUILD FAILED: Tue Mar 15 13:43:14 2011
 

yes. pic 18f452.

---------- Post added at 14:02 ---------- Previous post was at 13:58 ----------

the erro starts at the first line:
Error[105] C:\USERS\ESSOUZA2\DESKTOP\RASTREMANTOPICGPS\GPS.C 1 : Cannot open file (Include File "p18f2610.h" not found)

mplab is a kind of complex....
microC is simple...rsrs

i think i will quit.... the final date for the entire project is MAR-21,
i will not make at time, i still have to send the lat and long though gprs....
i dont know nothing about it...
 

i did!
my program now is right!
it takes part of the string and send to the computer... yesterday i did!
i did not used your program, but i understand what you did (some part of it)
my problem now is the lcd... i remove the part of the code that initialize the lcd, and did some testes using usart_write to send messages to the PC, now its ok, but without the lcd...
the line "LCD_init(&portB);" have some problem... not the program, but i think is some problem with the ports of the pic
i'm using 18f452.
 

ckshivaram,
i finaly make the lat, long, and date show on the lcd...
now i got some more time....
and i have some other problem... i don't know nothing about gprs...
and qhat i whant to do is... to send the message to a ip, that have and php program listening for the message, to record and show on the browser...
do you have an idea how can i start?
i have the string ready to send.

the next objective is to show the location in google maps. but this step is the last one.

thanks!
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…