G'day, If any of you aim for perfection in the reduction of static file register usage, I have some more code for you, adding to my data stack architecture that I introduced previously. The data stack is built using the PIC's FSR register as a pointer to a downward-growing stack of bytes. By expressing the interface of all important functions in stack semantics, it becomes easier to write more code. Programmers who have used the FORTH language will find some of this work familiar. The new code is a simple uptimer, counting days, hours, minutes and seconds since the microcontroller was turned on, and displaying the data on an LCD panel. New stack architecture functions introduced are: - LCD display access, put a data byte or a command on stack and call the function, - vectored execution, put a pointer to a function on the stack and call the function, - data table handler, give it a pointer to the table function, a pointer to a function to be called for each table entry, and call the function, - binary coded decimal conversion, nice wasteful code that takes a high and a low byte of a 16-bit word on the stack, and returns three bytes of binary coded decimal, - hexadecimal conversion, takes a byte and returns two ASCII characters on the stack. The code is licensed under the GNU Public License. Duplication to www.piclist.com welcome. http://quozl.netrek.org/uptime/ is the new code, http://quozl.netrek.org/stack-math.asm is my prior work. P.S. One 16F877 died during testing; I slipped and delivered 26V DC to somewhere on the PCB, without much current limit. Now when powered up the PIC pulls about 200mA. Took out an LCD display and a MAX232 at the same time. The PIC is dead, isn't it? Root cause ... I bought some of Don's DT106 known-faulty boards without the SIMM edge connector exposed, and used it as a floating board on top of a DT001 programmer, with header pins instead of using the edge connector. Used the five-wide programming jumpers. I didn't insulate under the board. One of the SIMM pins has the unregulated supply. Ouch. Sigh. -- James Cameron mailto:quozl@us.netrek.org http://quozl.netrek.org/ -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.