Thanks! It works! Thomas >From: Drew Vassallo >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 17:39:18 -0400 > >>I suggest a simple bubble sort. >>put the numbers in 4 registers say num1-num4 >>compare num4 to num3. >>if num3 is higher, swap the 2 registers. >>if num 4 is higher, do nothing. >>compare num4 and num3, num3 and num2, num2 and num1. >>do this for three passes and your numbers are sorted, with the highest in >>num4 and the lowest in num1. > >Wow, I almost forgot about this from 1st year Numerical Methods in >Computing >:) > >Nice application of this technique... I really never encountered a >practical >application for it before. Seems like a nice short code bit would take >care >of this, since there are only 4 numbers to work with. And since time isn't >a factor, this would be easy to program and get working quickly. > >--Andrew >_________________________________________________________________ >Get your FREE download of MSN Explorer at http://explorer.msn.com > >-- >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