“I Reverse Polish Notation ♥”


In figuring out how to simulate a UART on the TI Launchpad, I somehow ended up writing a reverse polish calculator. It’s a good example of how to use the UART and present a command interpreter, though I can’t imagine it being much use in the “real world”. Download source and Makefile.
A reverse polish serial port calculator for msp430×2013 on TI Launchpad. Featuring an editable command buffer and support for binary, hex and decimal input.
(see http://en.wikipedia.org/wiki/Reverse_Polish_notation#Example)
Example
> 0×5 1 2 + b100 * + 3 - 14
14
Formatting
All output is given in decimal. Though, this is easy to change.
The input base is autodetected:
Hex - prefixed “0x” or “h”
Binary - prefixed “0b” or “b”
Decimal - no prefix
Serial port
TX on P1.1
RX on P1.2
9600bps 8-N-1
thanks for sharing your project.
i’ve been trying to adopt it in my projects and found that on a 8Mhz internal osc clock doing 9600 baud, i will loss the 6 and 7 bits (become zeros) for each byte sent.
it appears that in the timer_a interrupt handler, the adding of BIT_TIME to CCR0 (”time to do next bit”) is a bit off.
Looks like the “if (isReceiving)” condition check had taken up a few cycles and caused this. i moved the BIT_TIME adding up to be the 1st statement inside the interrupt handler and my project is running fine now.
Please see my post in http://www.43oh.com/forum/viewtopic.php?p=956#p956
again thanks for sharing your code.
Interesting project dude, I’ll try it.