James, First thoughts for the BINNING is that if you have enough of the 68 bytes of 16F84 ram spare (17 * 3 = 51 bytes?), I'd keep the count bins in RAM, then say every 5 mins (200 count) I'd dump the whole lot to the E2prom (can be done as 1 page in some (large) E2's If your bin limits are fixed at compile time, you could do without the conversion from ASCII to binary, then divide by 36, and just use sequential compares straight to the ASCII to decide the bin to put it in. Steve Lawther ______________________________ Reply Separator _________________________________ Subject: [Q] 16F84 Ultimeter 100 Wind Speed Recording Author: James Cameron [SMTP:james.cameron@DIGITAL.COM] at UKExchange Date: 11/06/98 10:51 I'm checking the feasibility of a task and I'd appreciate comments on how to implement it. I will shortly have a weather monitoring instrument, an Ultimeter 100, which will provide a 2400 baud data stream containing a wind speed value calibrated in 0.1kph notches. The specifications say that it will be in the form of four ASCII hex bytes; e.g. 30 30 31 30 should mean 1.0kph. The samples will arrive at 1.5Hz. I want to accumulate a histogram in a 16F84's 64 byte EEPROM that represents the number of samples received from the instrument at each of 17 notches calibrated in metres per second. Each notch should be three bytes wide, to allow 2^24 counts per notch. Looking at this from a software engineering standpoint, I'll need the following bits of code, which I haven't yet done in PIC, hence the question ... - receive those four bytes and hold them as a number that will range from 0 to about 700 (site isn't very windy), - divide that number by 36 to get metres per second, - increment a specific 24 bit counter in EEPROM. Hmm. Hold the number in BCD and do the division in BCD? Use a lookup table to do the division? Anyone done anything similar? Is fetching the EEPROM data via a programmer practical or do I code a dump-to-serial function too? ps; I'm new to this list, but not lists in general. -- James Cameron (james.cameron@digital.com) Digital Equipment Corporation (Australia) Pty. Ltd. A.C.N. 000 446 800