I
imroun1992
Guest
Hello,
I had already post a thread about I2C Communication & LM75 Thermometer .. After several time, I wrote a program which is used to read temperature :
In the void function DisplayTemp(void) at last line "sprintf...", there is a mistake i don't know what is it, anyone to help me Compiler said :
argument of type "int" is incompatible with parameter of type "const char *restrict"
Anyone to help I include with this post the LCD Screen source files
Kind regards
I had already post a thread about I2C Communication & LM75 Thermometer .. After several time, I wrote a program which is used to read temperature :
Code:
#include <LPC43xx.h>
#include "LED.h"
#include "KBD.h"
#include "GLCD.h"
#include "I2C.h"
#include "TH_LM75.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define Font1 1
#define Font0 0
#define STRINGBUF_LEN 21
char StringBuf[STRINGBUF_LEN];
/*** Prototypes des fonctions ***/
void configuration_lm75(char);
int acquisition_temperature(void);
void DisplayTemp(void);
/*** Fonction principal ***/
int main(void)
{
I2C_Init();
TH_Init();
GLCD_Init();
GLCD_Clear (White);
GLCD_SetBackColor (Blue);
GLCD_SetTextColor (White);
GLCD_DisplayString (0, 0, 1, " Project ");
GLCD_DisplayString (1, 0, 1, " Electronics ");
GLCD_SetBackColor (White);
GLCD_SetTextColor (Blue);
while(1)
{
configuration_lm75(0x00);
DisplayTemp();
configuration_lm75(0x01);
}
}
/* Ecriture des données dans le registre de configuration du LM75 */
void configuration_lm75(char data)
{
I2C_Start();
I2C_Write(0x90); // Slave address + Write
I2C_Write(0x01); // Configuration register address
I2C_Write(data); // Data to register
I2C_Stop();
}
/* Lecture de la température */
int acquisition_temperature(void)
{
int data;
TH_DATA Temp;
signed char high, low;
I2C_Start();
I2C_Write(0x90); // Slave address + Write
I2C_Write(0x00); // Temperature register address
I2C_Start();
I2C_Write(0x90|0x01); // Slave address + Read
TH_GetTemp(&Temp);
I2C_Stop();
data = high;
data *= 10;
if(low & 0x80)
data += 5;
return data;
}
void DisplayTemp(void)
{
int temp;
temp = acquisition_temperature(); // Leer temperatura
sprintf("\r\n Temp = %d.%d C",&temp/10, abs(temp%10));
}
In the void function DisplayTemp(void) at last line "sprintf...", there is a mistake i don't know what is it, anyone to help me Compiler said :
argument of type "int" is incompatible with parameter of type "const char *restrict"
Anyone to help I include with this post the LCD Screen source files
Kind regards