Thomas, How the the bubble sort algorithm solve your problem. You still need to know which is the highest. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) ----- Original Message ----- From: "Thomas N" To: Sent: Thursday, April 12, 2001 3:12 PM Subject: Re: [PIC]: Compare 4 numbers method. Please help! > That's right! > > > >From: Bob Ammerman > >Reply-To: pic microcontroller discussion list > >To: PICLIST@MITVMA.MIT.EDU > >Subject: Re: [PIC]: Compare 4 numbers method. Please help! > >Date: Thu, 12 Apr 2001 14:49:08 -0400 > > > >So, what you really want is a memory location what tells you which of the > >ADCs has the highest value (ie: a number in the range 0..3) and another > >location that tells you which of the ADCs has the lowest value (another > >number in the range 0..3), right? > > > >here is simple C code: > > > > > >Bob Ammerman > >RAm Systems > >(contract development of high performance, high function, low-level > >software) > > > > > > > > > > > >----- Original Message ----- > >From: "Thomas N" > >To: > >Sent: Thursday, April 12, 2001 2:24 PM > >Subject: Re: [PIC]: Compare 4 numbers method. Please help! > > > > > > > Hi Bob, > > > > > > Thank you for your quick reply. The numbers are 8-bits from four ADC > >(so > > > they are unsigned). I would like to write the code in MPLAB assembly > > > language (35 instructions). The speed or memory is not very important. > > > > > > The memory location I called "RESULT" stores the information which tell > >me > > > which number is the biggest, big, small, and smallest. > > > > > > For your information, the inputs of the ADCs are from four CdS > >photoresistor > > > cells and basically I want to determine where the brightest or darkest > >spot > > > is. > > > > > > Sincerely, > > > Thomas > > > > > > >From: Bob Ammerman > > > >Reply-To: pic microcontroller discussion list > > > >To: PICLIST@MITVMA.MIT.EDU > > > >Subject: Re: [PIC]: Compare 4 numbers method. Please help! > > > >Date: Thu, 12 Apr 2001 12:30:02 -0400 > > > > > > > >ie: you need to sort these numbers. > > > > > > > >what language. > > > > > > > >how big can the numbers be? > > > > > > > >are they signed or unsigned? > > > > > > > >what is more important, speed or code space? > > > > > > > >Bob Ammerman > > > >RAm Systems > > > >(contract development of high performance, high function, low-level > > > >software) > > > > > > > >----- Original Message ----- > > > >From: "Thomas N" > > > >To: > > > >Sent: Thursday, April 12, 2001 12:27 PM > > > >Subject: [PIC]: Compare 4 numbers method. Please help! > > > > > > > > > > > > > Hi everyone, > > > > > > > > > > I need to compare 4 numbers stored in Number1, Number2, Number3, and > > > > > Number4. The result will be stored in the RESULT memory. > > > > > > > > > > I need to find out which one is the biggest, big, small, and > >smallest. > > > > > Please help me! > > > > > > > > > > Thank you in advance! > > > > > Thomas > > > > > > > >-- > > > >http://www.piclist.com hint: PICList Posts must start with ONE topic: > > > >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > > > > > > > > > > > > > >_________________________________________________________________________ > > > Get Your Private, Free E-mail from MSN Hotmail at > >http://www.hotmail.com. > > > > > > -- > > > http://www.piclist.com hint: PICList Posts must start with ONE topic: > > > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > > > > > > > >-- > >http://www.piclist.com hint: PICList Posts must start with ONE topic: > >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > > > > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads