jayanth.devarayanadurga
Banned
- Joined
- Dec 4, 2012
- Messages
- 4,280
- Helped
- 822
- Reputation
- 1,654
- Reaction score
- 791
- Trophy points
- 1,393
- Location
- Bangalore, India
- Activity points
- 0
Does your GPS send line break character at the end of each data transmission? If you GPS data frequency is 1 Hz that is emits data every 1 sec?
How do you get data with different formats everytime?
mikroC PRO AVR Code.
How do you get data with different formats everytime?
mikroC PRO AVR Code.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 unsigned char gpsData[85], myData[18], processNMEA = 0; unsigned int k = 0; void extractData(){ unsigned int i = 0, j = 0, gotData = 0; if(gpsData[1] == '0'){ j = 0; do{ while(gpsData[i] != ',')i++; ++i; ++gotData; j = 0; while(gpsData[i] != ','){ myData[j] = gpsData[i]; ++i; ++j; } myData[j] = '\0'; UART1_Write_Text(myData); UART1_Write(13); UART1_Write(10); }while(gotData < 8); } } void main() { DDRD = 0xFE; PORTD = 0x00; UART1_Init(57600); Delay_ms(2000); UART1_Write_Text("Paste some GPS data to Virtual Terminal\r\n\r\n"); while(1){ UART1_Read_Text(gpsData, "st", 85); k = strlen(gpsData); gpsData[k] = ','; k = 0; extractData(); } }
Attachments
Last edited: