I agree, RPN would be the most compact and efficient solution. But I think if the users need to learn RPN for using his product then it may reduce the number of potential clients. If the OP plans to have some front-end application in a PC, then it is easy to let the application convert the algebraic to RPN, but if the device is stand alone then it is better if the device handle the algebraic expression by itself. Once (over 20 years ago) I wrote an expression parser in Z80 assembly. I implemented operator precedence by storing a 4-bit operator ID and a 4-bit operator precedence together. It used two stacks, one for the values and other for the operators. When the current operator had a higher precedence than the one in the stack, it was pushed into the stack, otherwise the operator already in the stack was evaluated along with its two arguments and the result pushed into the stack again. This was repeated until the current operator was pushed into the stack and a new value and operator was obtained. The end-of-string was considered as the lowest precedence operator. Unfortunately the original code is lost. Regards, Isaac Tamas Rudnai escreveu: > I my opinion it is much easier to implement a sort of RPN calc for that. > Also if you have a PC connected to the circuit you may want to do that on > the PC side generating a pcode (with converting the normal form to RPN and > do all possible pre-calculations) so then the PIC needs only a much light= er > pcode engine rather than a more complex parser. > > Tamas > = __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist