mplan ide v8.83 compiling error

Status
Not open for further replies.

chalani0088

Junior Member level 3
Joined
Jun 19, 2012
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,562
mplab ide v8.83 compiling error

HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83
Copyright (C) 2011 Microchip Technology Inc.
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error [500] ; 0. undefined symbols:
_getche(sirial.obj) __scanf_buf_(sirial.obj)

********** Build failed! **********


i used sscanf command i my program and i get this error message ; can anybody help me out on this! i am using pic 16f877a controller and i want to convert the stored gps nmea data into float type or numeric! can anybody suggest something to solve the problem?
 
Last edited:

I would suggest posting, by using the code tags, or upload your code.

Typically routines which input or output data need to be explicitly instructed where to do so.

Often this is accomplished by writing a routine to handle the I/O.

Hi-Tech Compiler Manual:


Another issue which can be a source of error messages is the use of legacy headers with the newer versions of the compiler.

One possible solutions is the inclusion of the following at the start of the code:

#define _LEGACY_HEADERS




BigDog
 














how to manupulate gps nmea data to float type using pic16f877a


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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include <htc.h>
 
#define RX_PIN TRISC7
#define TX_PIN TRISC6
#define _XTAL_FREQ 4000000
 
 
__CONFIG(1,XT & WDTDIS & LVPDIS);
 
/****** serial comms using USART to comm port ***************/
 
void serial_setup()
{
SYNC=0; //Asynchronous mode
BRGH=1; //High Speed
SPBRG=25; //9600 bps
SPEN=1; //Enable serial port
CREN=1; //Enable reception
SREN=0; //No effect
TXIE=0; //Desable interrupts
RCIE=0; //disable rx interrupts
TX9=0; //8-bit transmission
RX9=0;  //8-bit reception
TXEN=1; // Enable transmission
}
 
void putch(unsigned char byte) 
{
/* output one byte */
while(!TXIF)    /* set when register is empty */
continue;
TXREG = byte;
}
 
unsigned char getch() {
/* retrieve one byte */
while(!RCIF)    /* set when register is not empty */
continue;
return RCREG;   
}
 
 
 
unsigned char getch();
unsigned char longi_data[12];
unsigned char lati_data[12];
unsigned char data,value=0;
unsigned int i=0,pos;
 
float latitude;
 
void main(void){
RX_PIN = 1; 
TX_PIN = 0;
unsigned char input1;
unsigned char input2;
unsigned char input3;
serial_setup();
INTCON=0;   // purpose of disabling the interrupts.
 
 
 
 
while(1){
 
{
data=getch(); // Check the string '$GPGGA,'
if(data=='$')
{
data=getch();
if(data=='G')
{
data=getch();
if(data=='P');
{
data=getch();
if(data=='G');
{
data=getch();;
if(data=='G')
{
data=getch();
if(data=='A')
{
data=getch();
if(data==',')
{
data=getch();
while(data!=',')
 
data=getch();
 
for(i=0;data!='N';i++)
{   data=getch();
lati_data[i]=data; // Store the Latitude data
 
putch(data);
}
}    data=getch();
if(data==',')
{
for(i=0;data!='E';i++)
{
data=getch();
 
longi_data[i]=data; // Store the Longitude data
putch(data);
}
}
 
 
 
 
i=0;
 
while(i<11)
{
PORTB=lati_data[i]; // Print the Latitude data
 
i++;
}
 
i=0;
 
while(i<12)
{
PORTD=longi_data[i];     // Print the Longitude data
 
 
i++;
}
 
 
 
 
 
}
 
 
 
 
 
 
 
 
 
}
}
}
}
}
}
 
__delay_ms(10);
for(i=0;i<12;i++)
{
data=0;
lati_data[i]=0;
longi_data[i]=0;
}
}
 
 
}




am doing my final project on gps based warning system for fishermen, and i want to receive gps data into my controller and exctract only the longitudanal and latitudanal data, and then i have to compare it with my previously stored boundaries and make nececsary outputs by comaparing, In my program i could exctract only the longitudanal and latitudanal data , and stored them as character strings. This worked fine and i checked using pic simulator i gave the sentence $GPGGA,100156.000,2650.9416,N,07547.8441,E,1,08,1. 0,442.8,M,-42.5,M,,0000*71 to the hardware UART simulation interface and it correctly worked.I am using MPLAB IDE V8.83 and now i want to convert this character string in to numerics in order to compare with my boundaries. so i used sscanf command and it doesnt work well! and i want to know wheathr i need to insetr stdio.h header and the source code. can you please help me on this?

Thank you
 
Last edited by a moderator:

hi,
i found a way to get rid of my problem, i used a for loop and switch command to convert my characters in to integers, but again i faced a problem i.e. i couldnt store the decimal point inside my integer array. how to get rid of this problem?




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
float long_arr[11];
 
for(i=0; i!=12;i++)
{
 
switch (lati_data[i])
{
 
case '0' :
long_arr[i]=0;
break;
case '1':
long_arr[i]=1;
break;
 
case '2':
long_arr[i]=2;
break;
 
case '3':
long_arr[i]=3;
break;
case '4':
long_arr[i]=4;
break;
 
case '5':
long_arr[i]=5;
break;
case '6':
long_arr[i]=6;
break;
 
case '7':
long_arr[i]=7;
break;
 
case '8':
long_arr[i]=8;
break;
 
case '9':
long_arr[i]=9;
break;
case '.' :
long_arr[i]=0;
break;
 
}
 
}

 
Last edited by a moderator:

The Hi-Tech C Compiler for the PIC10/12/16 does offer several routines which can convert an ASCII string to an integer, long or float:

Reference: HI-TECH C® for PIC10/12/16 User’s Guide, Section Library Functions, Page: 181-183





You could also use the strtok() routine to parse the GPGGA sentence into its appropriate tokens.


The resulting tokens can be convert into their appropriate numerical values and stored in a structure type.

BigDog
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…