Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/07/07 20:06
Read: times


 
#142898 - just having formatted
Responding to: ???'s previous message
Tomas Dabasinskas said:
char DS1620_Temperature_Array(){
char temperature_array [20];
	int i;
	for (i = 0; i < 21; i++){
		int get_temp, MSB; 
		float temperature;
		get_temp = DS1620_Read(0xAA, 9);
		temperature = (float) get_temp * 0.5;	
		MSB = get_temp >>7;
		if ( MSB > 0 ) temperature = temperature - 256;
		temperature_array [i] = temperature;
		HW_DELAY_50ms();
		}
return (temperature_array);
}

This post, as not directly related to 8051, belongs to the General Chat.

Also, please read the FAQ on how to post formatted code.

The questions you presented are rather trivial and you should perhaps go through some general programming textbook first. Just conceptually:

Q1: add up all members of the array and divide by their number

Q2: assume max is the first member of the array; then go through rest of the array and if some of the member is higher, replace max by this member.

JW


List of 13 messages in thread
TopicAuthorDate
help required with array manipulation in c#            01/01/70 00:00      
   just having formatted            01/01/70 00:00      
   array not float?            01/01/70 00:00      
      Try This            01/01/70 00:00      
         but be sure to comment it carefully!            01/01/70 00:00      
   Why do you keep saying C# ??            01/01/70 00:00      
   Two things that are definitly wrong            01/01/70 00:00      
      Two things wrong with thing 1            01/01/70 00:00      
         Sorry and Thanks            01/01/70 00:00      
   Also..            01/01/70 00:00      
      ...and, 8051 specifically            01/01/70 00:00      
         8051 in C programming            01/01/70 00:00      
            first and second            01/01/70 00:00      

Back to Subject List