adilumer
Newbie level 3
- Joined
- Nov 13, 2010
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,319
C Program does not work when ported from PIC16F688 to PIC16F1825
I've been working on a CCS C program which read temperature from DS18B20 device and displays it to the LCD using sprintf statement. While my program works like a charm on PIC16F688 but once I upgrade the chip to PIC16F1825 it seems to crash when reading the temperature from DS1820.
If I replace this statement with "temperature = -4.75;"
Then the LCD displays the temperature correctly. The DS1820 device is connected to PortA pin A2.
Any ideas or pointers would be very helpful, thankyou.
I've been working on a CCS C program which read temperature from DS18B20 device and displays it to the LCD using sprintf statement. While my program works like a charm on PIC16F688 but once I upgrade the chip to PIC16F1825 it seems to crash when reading the temperature from DS1820.
Code C - [expand] 1 2 3 4 5 6 7 8 9 void DisplayLCD(void) { static char temp_str[20]; static float temperature; temperature = ds1820_read(); <<-----This is where it seems to fail. temperature = (temperature* 0.0625*9/5)+32; // Deg F; sprintf(temp_str,"%2.1f",temperature); lcdStr(temp_str,4);//Degree F }
If I replace this statement with "temperature = -4.75;"
Then the LCD displays the temperature correctly. The DS1820 device is connected to PortA pin A2.
Any ideas or pointers would be very helpful, thankyou.