EETimes

Embedded Systems November 2000 Vol13_12

Issue link: http://dc.ee.ubm-us.com/i/71849

Contents of this Issue

Navigation

Page 107 of 189

The smallest possible data value, zero for the present case of unsigned integer data, is usurped as a chain stopper. of the linked list, not necessarily the end of the buffer. That will always leave median poin ting to th e median of the data whether the array is full or not. We can do al l three tasks on one pass down th e list. Of course, the median pointer is j ust right only when there is an odd A MORE POWERFUL ALTERNATIVE TO ~OLLERS Design your custom microprocessor-based board around the RabbitCore 2000"'· The module is based on the new Rabbit 20001M microprocessor, includes flash and SRAM, and can handle programs of up to 50,000 C statements. Benefit f rom easy and rapid development with this low-cost solution. 1 .90" x 2.30" RabbitCore 2000,. Features • 40 1/0 pins • 4 serial ports • 7 timers • Battery-backed time/date clock • 128K-512K SRAM • 256K flash • Clock up to 25.8MHz • Slave port • Remote cold boot • Excellent math processing Make the RabbitCore 2000TM the heart of your custom board design. A low-cost manufacturing license is also available. number of data elements in the list. For an even number of elements there are two middle elements, not one, and the median is defined to be the math- ematical average of those two ele- ments. In that case, the pointer ends up pointing to the earlier (larger) of those two and does not quite return the true median. So long as you choo e an odd number fo r the buffe r size, this situation will only occur dur- ing array filling. Figure 3a shows the pointers as they are initialized before first entry to the filter code. To initialize the empty list, we need only link the two end su·uctures together as shown. As suc- cessive values arrive, they are linked in . When the array fin ally fills up, a pre-existing link to the element just being replaced will begin to be found in the chai n each time, and must be removed . Figure 3b shows, in green, the addi- tional pointers needed for our scan down the list, initialized as they are at the beginning of the scan. They include datpoi nt (already discussed ), successor (which poin ts to the old datum's successor in the list), scan (which begins equal to big.point and which we then chase down the list), scanold (which holds the previous value of scan), and median (which ends up pointing to the median ). The only one of these needing special mention is successor. The new datum might lie either complete Dynamic c• software development system (not a trial version), PC serial cable lor real· time Development Kit only 169 Includes core, prototyping board, debugging, and documentation on CD·ROM Order the RabbitCore 2000™ Development Kit online at www.rabbitsemicondudor.com or call 530.757.8400 2932 Spafford Street Davis, CA 95616 • Fax 530.757.8402 • rabbit@rabbitsemiconductor.com 106 NOVEMBER 2ooo Embedded Systems Programming earlier or later in the list than the old datum did, and in particular we may need to link in the new value before we encounter a poin ter to the old value and get a chance to lin k it out. Since both old and new data are asso- ciated with the same array element, we need to save a copy of the old datum's su ccessor poin ter datpoi nt->poi nt before we begin the scan and risk writ- ing over it. successor is th e place where we save it. C code for the fi lter is found in Listing 1 and is available fo r download at www.embedded.com/code.htm. The code was compiled and tested on a PC

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems November 2000 Vol13_12