Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

C program does now work after migrating from PIC16F688 to PIC16F1825

Status
Not open for further replies.

adilumer

Newbie level 3
Newbie level 3
Joined
Nov 13, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
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.


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.
 

You didn't show the ds1820_read() code or told which library you are importing. Also no compiler info.

Don't expect a reasonable answer so far.
 

To get a solution zip and post complete CCS PIC C project files so that it can be examined.
 

I overlooked the reference to CCS C.

It looks like the question has been answered at CCS forum: option register problem.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top