I made it using a PIC 16F877, an 2x16 characters LCD display, and a telephone keyboard.
The schematics is quite straightforward
I used ExpressSCH to draw it.
For the programming I used the classic MPLAB 8.30 from microchip with the C compiler from Hi-tech software. This is a free C compiler that makes something I would think as nearly impossible for a C compiler: support the PIC 16 architecture.
The C compiler saved me from the mess of having to perform floating point operations in assembly language.
But to get the right accuracy, I had to set correctly the floating point size to 32bits
In the first time it did not work at all and I had to search to find why. In the end I found that I had incorrectly set the 16F877 chip options: I had forgotten to disable the "Low Voltage Programming". Since the Low Voltage programming interacts with Port B bit 3 which I use for keyboard this was preventing my software from working
by using:
__CONFIG(WDTDIS & HS & UNPROTECT & LVPDIS);
I did solve the problem.
And now my pocket calculator is ready.
No comments:
Post a Comment