
#include<reg52.h>
#include<stdio.h>

void InitSerial(void);
float getHighest(unsigned char, int size);

//---------------------------------------
// Main program
//---------------------------------------
void main(void)
{
	InitSerial();  		// Initialize serial port
	while(1)
	{	
		unsigned char temp_array[3]={10.5, 40.5, 30.6};
		printf("%5.2f \n",getHighest(temp_array,3) );
	}
}

//---------------------------------------
// Initialize serial port
//---------------------------------------
void InitSerial(void)
{
  	SCON = 0x52;    // setup serial port control 
  	TMOD = 0x20;    // hardware (9600 BAUD @11.05592MHZ) 
  	TH1  = 0xFD;    // TH1
	TR1	 = 1;  		// Timer 1 on
}

float getHighest(unsigned char array[], int size)
{
       float highest;
       int count;
       highest = array[0];
       for (count = 1; count < size; count++)
       {
           if (array[count] > highest)
              highest = array[count];
       }
       return highest;
}
