


La tentative via la fonction putsUSART() est OK et lève le doute sur un défaut matériel ou un mauvais réglage du terminal (PC/KTTY : 9600B, 8bits, 1Stop, pas de controle de flux). It: resets IC, reads coeffs, starts conversion, reads ADC & then calls calc.Avec un pic 18F252, le programme ci-dessous tente d'afficher un message via la fonctionnalié USART. nbproject/Makefile-default.mk:99: recipe for target 'build/default/debug/TSYS01.p1' failed main_temp.c:686: warning: (343) implicit return at end of non-void function make: *** Error 2 make: Leaving directory 'C:/Users/home/MPLABXProjects/SDI12_TEMP.X' make: *** Error 2 nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed make: Leaving directory 'C:/Users/home/MPLABXProjects/SDI12_TEMP.X' nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed BUILD FAILED (exit value 2, total time: 429ms)Ĭode: //****************************************************************************** // TSYS01.h //****************************************************************************** //TSYS01 variable declarations unsigned short long ADC16 // was double unsigned long ADC24 = 9378708 // TSYS01 temperature result, was double unsigned short long ADC_MSB = 0 // 3 x 8 bit bytes read from TSYS01 combined = ADC24 unsigned int ADC_MID = 0 unsigned int ADC_LSB = 0 float Temp_C //calculated temperature Celcius //unsigned char TempStr="." //temp ascii string //calibration coefficients, 16 bit integers double k4 = 28446 //unsigned int unsigned int k3 = 0 //24926 unsigned int k2 = 0 //36016 unsigned int k1 = 0 //32791 unsigned int k0 = 0 //40781 //calibration coefficient nibbles unsigned char k4MSB = 0 unsigned char k4LSB = 0 unsigned char k3MSB = 0 unsigned char k3LSB = 0 unsigned char k2MSB = 0 unsigned char k2LSB = 0 unsigned char k1MSB = 0 unsigned char k1LSB = 0 unsigned char k0MSB = 0 unsigned char k0LSB = 0 //TSYS01 function declarations void TSYS01_read(void) //Reads sensor using functions below void TSYS01_reset(void) //Reset the TSYS01 sensor IC void TSYS01_read_coeffs(void) //Reads 5 x 16 bit coefficients from the TSYS01 void TSYS01_convert(void) //Instructs TSYS01 sensor to do a measurement void TSYS01_read_ADC(void) //Reads TSYS01 ADC result, ADC result left in ADC24 void TSYS01_calc(void) //Calc temp using ADC val & coeffs from TSYS01 TSYS01.cĬode: //***************************************************************************** //TSYS01.c F U N C T I O N S F O R T S Y S 0 1 T E M P S E N S O R //***************************************************************************** // // void TSYS01_read(void) Reads sensor using functions below // // void TSYS01_reset(void) Reset the TSYS01 sensor IC // void TSYS01_read_coeffs(void) Reads 5 x 16 bit coefficients from the TSYS01 // void TSYS01_convert(void) Instructs TSYS01 sensor to do a measurement // void TSYS01_read_ADC(void) Reads TSYS01 ADC result, ADC result left in ADC24 // void TSYS01_calc(void) Calc temp using ADC val & coeffs from TSYS01 // // Use TSYS01_read() function to read the sensor. Quote TSYS01.c:26: warning: (361) function declared implicit int (908) exit status = 1 TSYS01.c:27: warning: (361) function declared implicit int TSYS01.c:28: warning: (361) function declared implicit int TSYS01.c:29: warning: (361) function declared implicit int TSYS01.c:30: warning: (361) function declared implicit int TSYS01.c:39: error: (984) type redeclared TSYS01.c:39: error: (1098) conflicting declarations for variable "TSYS01_reset" (TSYS01.c:38) make: *** Error 1 make: *** Waiting for unfinished jobs. How should I be handling all of this and why? Cheers!

Sometimes I'll have a separate header file for additional source files (eg LCD, sensor, comms etc) sometimes I will just put the variable and function declarations etc at the start of the source. Do I need to or should I be 'adding' the LCD.c file as a source file? Header and source files.
#MPLAB XC8 LCD H CODE#
without adding the LCD.c file as source (I have "include LCD.c" in the main.c file) the code will load/compile/run correctly but I need to open the LCD.c file directly in order to edit it. When I try to add the LCD.c file as a source file, the code will no longer compile. I can add the LCD.h file as an additional header file - all good. If I want to add in some code for my LCD in files called LCD.c and LCD.h then I run into trouble. If I set up a simple standalone project I have a couple of files say main.c and header.h I add main.c as the source file and header.h as the header file and it all works well. Any way I've got a couple of basic questions about using MPLABx and header / source files. What I know about C I've learnt from you guys and browsing the net. I bang away on a few Pic projects using MPLABx + XC8.
