displaying temperature on 2 7 led displays.

Hellow my fellow Arduino programmers, i have a little question.
For a school project i am designing a little set up that displays the temperature that i measure with a ntc. And i want to do this with a arduino.

i have written two pieces of arduino codes i want to combine them, and on that point i need your help. what i want for result is that my temperature is displayed on my 2* 7 led display.

first piece of code:

//#define PD5 0b00100000
//#define PD6 0b00100000
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>//voor dtostrf
#include "AInOut.h"
#include "serial.h"
#define BAUD_RATE 9600

double Volt;
int Temp;
char strTemp[15];
char *strT;
int main (void)
{
//PWMD5D6_init();
ADC_init();
serial_init(BAUD_RATE);
while (1){
Temp=(5.0 * ADC_read(0) * 100.0)/1024.0; //NB waarde afh. van weerstand en NTC
//Temp=Temp/6.036; //NB waarde afhankelijk van weerstand en NTC type
strT=dtostrf(Temp,4,2,strTemp);
strcat (strT ," grd C\n\r");
serial_print(strTemp);
_delay_ms(100);
}
return 0;
}

this piece of code is for the temperature

the next one:

#include <avr/io.h>
#include <stdlib.h>//voor dtostrf
#include <math.h>
#include "serial.h"

#define BAUD_RATE 9600

int temp;
int T1;
int T2;

int getal;
;
double getalnw;
char waarde;
char berekening;
char mystr[10];
int s;

int main(void)
{
serial_init(BAUD_RATE);

DDRB = 0xFF;
DDRC = 0xFF;
DDRD = 0xFF;
while (1) {
serial_print("geef getal NB reset voor nieuw getal: ");//
temp=serial_readdbl();
serial_print("\r\n");
//temp=serial_get();
// serial_put(temp);
// serial_print("\r\n");
T1 = temp / 10;
getalnw=T1;
dtostrf(getalnw, 6,2,mystr);//6 cijfers totaal en 3 voor de '.'
serial_print(mystr);

T2 = temp - (10*T1);
getalnw=T2;
dtostrf(getalnw, 6,2,mystr);//6 cijfers totaal en 3 voor de '.'
serial_print(mystr);

if (T2==0){PORTD = 0b00000000;PORTC = 0b00011000;}
if (T2==1){PORTD = 0b11100100;PORTC = 0b00011000;}
if (T2==2){PORTD = 0b10010000;PORTC = 0b00010000;}
if (T2==3){PORTD = 0b11000000;PORTC = 0b00010000;}
if (T2==4){PORTD = 0b01100100;PORTC = 0b00010000;}
if (T2==5){PORTD = 0b01001000;PORTC = 0b00010000;}
if (T2==6){PORTD = 0b00001000;PORTC = 0b00010000;}
if (T2==7){PORTD = 0b11100000;PORTC = 0b00011000;}
if (T2==8){PORTD = 0b00000000;PORTC = 0b00010000;}
if (T2==9){PORTD = 0b01000000;PORTC = 0b00010000;}

if (T1==0)PORTB = 0b11111111;
if (T1==1)PORTB = 0b11111001;
if (T1==2)PORTB = 0b11100100;
if (T1==3)PORTB = 0b11110000;
if (T1==4)PORTB = 0b11010001;
if (T1==5)PORTB = 0b11010010;
if (T1==6)PORTB = 0b11000010;
if (T1==7)PORTB = 0b11111000;
if (T1==8)PORTB = 0b11000000;
if (T1==9)PORTB = 0b11010000;
}
return 0;
}

this piece of code is for controling the leds on the display.

i hope you can give me some advice for combining these two so my program will display the temperature without using the computer so it is a stand alone.

Greetings Martijn

if (T2==0){PORTD = 0b00000000;PORTC = 0b00011000;}
if (T2==1){PORTD = 0b11100100;PORTC = 0b00011000;}
if (T2==2){PORTD = 0b10010000;PORTC = 0b00010000;}
if (T2==3){PORTD = 0b11000000;PORTC = 0b00010000;}
if (T2==4){PORTD = 0b01100100;PORTC = 0b00010000;}
if (T2==5){PORTD = 0b01001000;PORTC = 0b00010000;}
if (T2==6){PORTD = 0b00001000;PORTC = 0b00010000;}
if (T2==7){PORTD = 0b11100000;PORTC = 0b00011000;}
if (T2==8){PORTD = 0b00000000;PORTC = 0b00010000;}
if (T2==9){PORTD = 0b01000000;PORTC = 0b00010000;}

Clearly, this should be in a function, displayTensValue(int val).

if (T1==0)PORTB = 0b11111111;
if (T1==1)PORTB = 0b11111001;
if (T1==2)PORTB = 0b11100100;
if (T1==3)PORTB = 0b11110000;
if (T1==4)PORTB = 0b11010001;
if (T1==5)PORTB = 0b11010010;
if (T1==6)PORTB = 0b11000010;
if (T1==7)PORTB = 0b11111000;
if (T1==8)PORTB = 0b11000000;
if (T1==9)PORTB = 0b11010000;

Clearly, this should be in a function, displayOnesValue(int val).

The bulk of the second sketch deals with splitting a two digit int, obtained from a function with the lousy name of serial_readdbl() into the tens value and the ones value, and displaying those digits on the hardware.

The first sketch gets the temperature from the thermometer, as a two digit int, most likely, and then uses am unnecessarily complex process to convert that integer value to a string that looks like a float value.

Once you have Temp, from the first sketch, call the functions from the second sketch to split the number into a ones value and a tens value, and display those values on the hardware.

When is our homework due?

thank you for replying and i have another week for i have to deliver it so there is some time left. but can you help me with writing the good code that i can use? i am sort of first time doing this. if you can help me i will be grateful

if you can help me i will be grateful

I'm sure you would. But, you would not have learned anything. I've given you enough clues for you to try something. Put some effort into piecing together a new sketch, and we'll help you over the rough spots.

We won't do it for you, unless you post in Gigs and Collaborations, with an enticing enough offer of money or ???