Help with C code for a PIC18f4550 GPS Clock
Posted: Fri Sep 13, 2019 12:05 am
Background:
Windows 10/PIC18F4550/MPLAB X IDE v5.25/XC8 v2.10/C90/PICKit2 V2.61/PICCircuits programmer/ LCD is 1602 (HD44780 Clone) 8-Wired.
Built on my custom "Lunch Break" board, which is a "Pinguino" type PCB with sockets for the pin connections/All pin placements confirmed and checked for continuity/Pin to Pin wiring for control lines/Breadboard for the power distribution and the Contrast Pot./DuPont wires and a few jumpers.
I am using a 1602 LCD, instead of the 2004 LCD listed in the project. My understanding is it should work with the code, but I just won’t get the extra two lines of output. I have ordered 2004s.
This post looks similar to one I posted on the Microchip forum, but it is a completely different subject. It is a continuation of the same project’s development.
======================================================================
I am using this tutorial to make my first attempt at making a GPS Clock.
https://www.electronicwings.com/pic/gps ... pic18f4550
(See file links on the web page for originals.)
I plan to get the code working and then comment out everything but the time and date information. I will leave the remainder to activate in future GPS projects.
I flashed the hex that was provided, but I did not get any output displayed.
So, I used Ric’s trick to get a clean start on compiling the code, myself. = Create a new project; create blank header and .c files having the exact same titles; copy and paste the code from each header and .c file directly to the fresh, new pages, clean/compile.
The code did compile successfully, but with lots of warnings. I flashed the resulting hex, but I still didn’t get any output displayed.
My compiled code is at DropBox:
https://www.dropbox.com/s/a5bq1vjk82c36 ... X.zip?dl=0
Here’s the warnings:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CLEAN SUCCESSFUL (total time: 114ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X'
make -f nbproject/Makefile-default.mk dist/default/production/Ewings_18F4550_GPS_Clean.X.production.hex
make[2]: Entering directory 'C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X'
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F4550 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/LCD_20x4_C_file.p1 LCD_20x4_C_file.c
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F4550 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/GPS_info.p1 GPS_info.c
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F4550 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/USART_Source_File.p1 USART_Source_File.c
GPS_info.c:85:26: warning: (373) implicit signed to unsigned conversion
GPS_info.c:90:42: warning: (373) implicit signed to unsigned conversion
GPS_info.c:108:39: warning: (373) implicit signed to unsigned conversion
GPS_info.c:126:38: warning: (373) implicit signed to unsigned conversion
USART_Source_File.c:14:16: warning: (373) implicit signed to unsigned conversion
LCD_20x4_C_file.c:60:30: warning: (373) implicit signed to unsigned conversion
LCD_20x4_C_file.c:62:30: warning: (373) implicit signed to unsigned conversion
LCD_20x4_C_file.c:64:30: warning: (373) implicit signed to unsigned conversion
LCD_20x4_C_file.c:66:30: warning: (373) implicit signed to unsigned conversion
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F4550 -Wl,-Map=dist/default/production/Ewings_18F4550_GPS_Clean.X.production.map -DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/Ewings_18F4550_GPS_Clean.X.production.elf build/default/production/GPS_info.p1 build/default/production/LCD_20x4_C_file.p1 build/default/production/USART_Source_File.p1
Non line specific message::: advisory: (1492) using updated 32-bit floating-point libraries; improved accuracy might increase code size
LCD_20x4_C_file.c:70:: warning: (520) function "_LCD_Clear" is never called
USART_Source_File.c:19:: warning: (520) function "_USART_TxChar" is never called
USART_Source_File.c:26:: warning: (520) function "_USART_RxChar" is never called
USART_Source_File.c:40:: warning: (520) function "_USART_SendString" is never called
Memory Summary:
Program space used 3C28h ( 15400) of 8000h bytes ( 47.0%)
Data space used 122h ( 290) of 800h bytes ( 14.2%)
Configuration bits used 7h ( 7) of 7h words (100.0%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
ID Location space used 8h ( 8) of 8h bytes (100.0%)
Data stack space used 0h ( 0) of 6B0h bytes ( 0.0%)
make[2]: Leaving directory 'C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X'
make[1]: Leaving directory 'C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X'
BUILD SUCCESSFUL (total time: 11s)
Loading code from C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X/dist/default/production/Ewings_18F4550_GPS_Clean.X.production.hex...
Loading completed
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I would think that these are the primary problems:
USART_Source_File.c:19:: warning: (520) function "_USART_TxChar" is never called
USART_Source_File.c:26:: warning: (520) function "_USART_RxChar" is never called
USART_Source_File.c:40:: warning: (520) function "_USART_SendString" is never called
I have just taken a look at the debugger, but I don’t know enough about it to use it effectively, yet. So, I am reaching out to learn what might be the problem and the cure.
Please remember that I am very much a novice. I look forward to your thoughts and suggestions. Thank you for your help.
Windows 10/PIC18F4550/MPLAB X IDE v5.25/XC8 v2.10/C90/PICKit2 V2.61/PICCircuits programmer/ LCD is 1602 (HD44780 Clone) 8-Wired.
Built on my custom "Lunch Break" board, which is a "Pinguino" type PCB with sockets for the pin connections/All pin placements confirmed and checked for continuity/Pin to Pin wiring for control lines/Breadboard for the power distribution and the Contrast Pot./DuPont wires and a few jumpers.
I am using a 1602 LCD, instead of the 2004 LCD listed in the project. My understanding is it should work with the code, but I just won’t get the extra two lines of output. I have ordered 2004s.
This post looks similar to one I posted on the Microchip forum, but it is a completely different subject. It is a continuation of the same project’s development.
======================================================================
I am using this tutorial to make my first attempt at making a GPS Clock.
https://www.electronicwings.com/pic/gps ... pic18f4550
(See file links on the web page for originals.)
I plan to get the code working and then comment out everything but the time and date information. I will leave the remainder to activate in future GPS projects.
I flashed the hex that was provided, but I did not get any output displayed.
So, I used Ric’s trick to get a clean start on compiling the code, myself. = Create a new project; create blank header and .c files having the exact same titles; copy and paste the code from each header and .c file directly to the fresh, new pages, clean/compile.
The code did compile successfully, but with lots of warnings. I flashed the resulting hex, but I still didn’t get any output displayed.
My compiled code is at DropBox:
https://www.dropbox.com/s/a5bq1vjk82c36 ... X.zip?dl=0
Here’s the warnings:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CLEAN SUCCESSFUL (total time: 114ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X'
make -f nbproject/Makefile-default.mk dist/default/production/Ewings_18F4550_GPS_Clean.X.production.hex
make[2]: Entering directory 'C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X'
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F4550 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/LCD_20x4_C_file.p1 LCD_20x4_C_file.c
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F4550 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/GPS_info.p1 GPS_info.c
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F4550 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/USART_Source_File.p1 USART_Source_File.c
GPS_info.c:85:26: warning: (373) implicit signed to unsigned conversion
GPS_info.c:90:42: warning: (373) implicit signed to unsigned conversion
GPS_info.c:108:39: warning: (373) implicit signed to unsigned conversion
GPS_info.c:126:38: warning: (373) implicit signed to unsigned conversion
USART_Source_File.c:14:16: warning: (373) implicit signed to unsigned conversion
LCD_20x4_C_file.c:60:30: warning: (373) implicit signed to unsigned conversion
LCD_20x4_C_file.c:62:30: warning: (373) implicit signed to unsigned conversion
LCD_20x4_C_file.c:64:30: warning: (373) implicit signed to unsigned conversion
LCD_20x4_C_file.c:66:30: warning: (373) implicit signed to unsigned conversion
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xc8-cc.exe" -mcpu=18F4550 -Wl,-Map=dist/default/production/Ewings_18F4550_GPS_Clean.X.production.map -DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/Ewings_18F4550_GPS_Clean.X.production.elf build/default/production/GPS_info.p1 build/default/production/LCD_20x4_C_file.p1 build/default/production/USART_Source_File.p1
Non line specific message::: advisory: (1492) using updated 32-bit floating-point libraries; improved accuracy might increase code size
LCD_20x4_C_file.c:70:: warning: (520) function "_LCD_Clear" is never called
USART_Source_File.c:19:: warning: (520) function "_USART_TxChar" is never called
USART_Source_File.c:26:: warning: (520) function "_USART_RxChar" is never called
USART_Source_File.c:40:: warning: (520) function "_USART_SendString" is never called
Memory Summary:
Program space used 3C28h ( 15400) of 8000h bytes ( 47.0%)
Data space used 122h ( 290) of 800h bytes ( 14.2%)
Configuration bits used 7h ( 7) of 7h words (100.0%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
ID Location space used 8h ( 8) of 8h bytes (100.0%)
Data stack space used 0h ( 0) of 6B0h bytes ( 0.0%)
make[2]: Leaving directory 'C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X'
make[1]: Leaving directory 'C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X'
BUILD SUCCESSFUL (total time: 11s)
Loading code from C:/Users/t1dun/Desktop/GPS/PIC Clock/Ewings_18F4550_GPS_Clean.X/dist/default/production/Ewings_18F4550_GPS_Clean.X.production.hex...
Loading completed
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I would think that these are the primary problems:
USART_Source_File.c:19:: warning: (520) function "_USART_TxChar" is never called
USART_Source_File.c:26:: warning: (520) function "_USART_RxChar" is never called
USART_Source_File.c:40:: warning: (520) function "_USART_SendString" is never called
I have just taken a look at the debugger, but I don’t know enough about it to use it effectively, yet. So, I am reaching out to learn what might be the problem and the cure.
Please remember that I am very much a novice. I look forward to your thoughts and suggestions. Thank you for your help.