Post Reply 
RPN-duino
11-18-2015, 05:14 PM (This post was last modified: 12-08-2015 06:22 PM by Chasfield.)
Post: #21
RE: RPN-duino
Attached is the Arduino Nano beta source code for the two line calculator at the top of this thread. It wouldn't upload with the .ino filename extension, hence .txt.

It has not been heavily tested but seems to function ok. Much tidying up to do yet.

The core of the calculator program is composed of four keyboard polling loops:

loop():
standard Arduino declaration - reads the keyboard and decides what to do next.

shifted_function():
called by loop() when the 2nd function key is pressed. Executes SIN, COS, SQR etc. following the next key press.

numeric_key():
Called by loop() when a numeric key or the decimal point key is pressed. Loops around accepting key presses until an X register value has been input.

ee_key():
Called by shifted_function() when exponent input is required. Loops around until an exponent value and sign have been input.


Key presses that implicitly terminate ee_key() and numeric_key() (eg. roll down or X<>Y) are buffered and passed back to loop() for processing as if they had come straight off the keyboard.

My first attempt at this program polled the keyboard in only one place and relied upon mode flags for differentiating between numeric input and 2nd function key processing. I abandoned this strategy after I had worked out how to display numbers in standard form. This called for another mode flag for processing exponent input. A flag too far!

As regards schematics: I haven't produced anything yet but you can work out the Arduino and LCD module pin connections from the LCD and Keyboard data declarations.

<<beta code attachment removed - update posted further down the thread with connections schematic>>
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RPN-duino - Chasfield - 10-16-2015, 03:55 PM
RE: RPN-duino - eried - 10-16-2015, 07:03 PM
RE: RPN-duino - David Hayden - 10-16-2015, 07:22 PM
RE: RPN-duino - Chasfield - 10-16-2015, 07:23 PM
RE: RPN-duino - Dwight Sturrock - 10-16-2015, 11:40 PM
RE: RPN-duino - eried - 10-16-2015, 08:50 PM
RE: RPN-duino - rprosperi - 10-16-2015, 09:23 PM
RE: RPN-duino - Chasfield - 10-17-2015, 04:38 AM
RE: RPN-duino - Thomas Klemm - 10-17-2015, 07:48 AM
RE: RPN-duino - rprosperi - 10-17-2015, 12:56 PM
RE: RPN-duino - Dwight Sturrock - 10-17-2015, 04:41 PM
RE: RPN-duino - Dave Frederickson - 10-17-2015, 05:02 PM
RE: RPN-duino - Vtile - 11-14-2015, 08:25 PM
RE: RPN-duino - walter b - 11-14-2015, 09:11 PM
RE: RPN-duino - Chasfield - 10-24-2015, 10:45 AM
RE: RPN-duino - ggauny@live.fr - 10-29-2015, 08:26 AM
RE: RPN-duino - vido - 09-18-2016, 06:50 PM
RE: RPN-duino - Chasfield - 11-14-2015, 05:27 PM
RE: RPN-duino - Thomas Klemm - 11-14-2015, 05:48 PM
RE: RPN-duino - Chasfield - 11-15-2015, 10:28 AM
RE: RPN-duino - compsystems - 11-17-2015, 07:51 PM
RE: RPN-duino - Chasfield - 11-18-2015 05:14 PM
RE: RPN-duino - Chasfield - 11-18-2015, 07:25 PM
RE: RPN-duino - Chasfield - 11-22-2015, 10:21 AM
RE: RPN-duino - Chasfield - 02-13-2016, 12:28 PM
RE: RPN-duino - Chasfield - 08-24-2016, 01:23 PM
RE: RPN-duino - Chasfield - 09-17-2016, 02:49 PM
RE: RPN-duino - larthurl - 04-06-2018, 02:29 PM
RE: RPN-duino - Luigi Vampa - 09-17-2016, 03:33 PM
RE: RPN-duino - Nigel (UK) - 09-17-2016, 06:57 PM
RE: RPN-duino - Chasfield - 09-18-2016, 01:52 PM
RE: RPN-duino - Nigel (UK) - 09-19-2016, 08:48 AM
RE: RPN-duino - Maximilian Hohmann - 09-19-2016, 09:44 AM
RE: RPN-duino - Chasfield - 09-19-2016, 02:35 PM
RE: RPN-duino - Luigi Vampa - 09-19-2016, 04:05 PM
RE: RPN-duino - jch - 09-19-2016, 07:08 PM
RE: RPN-duino - Chasfield - 09-28-2016, 03:24 PM
RE: RPN-duino - Chasfield - 09-28-2016, 05:01 PM
RE: RPN-duino - Luigi Vampa - 09-28-2016, 07:23 PM
RE: RPN-duino - Chasfield - 09-29-2016, 06:51 AM
RE: RPN-duino - Chasfield - 09-30-2016, 06:50 PM
RE: RPN-duino - Chasfield - 10-01-2016, 01:18 PM
RE: RPN-duino - Luigi Vampa - 10-01-2016, 03:20 PM
RE: RPN-duino - Chasfield - 10-01-2016, 03:31 PM
RE: RPN-duino - Chasfield - 10-01-2016, 05:39 PM
RE: RPN-duino - Luigi Vampa - 10-01-2016, 06:38 PM
RE: RPN-duino - Chasfield - 10-01-2016, 07:00 PM
RE: RPN-duino - Luigi Vampa - 10-02-2016, 09:14 AM
RE: RPN-duino - Luigi Vampa - 10-02-2016, 12:43 PM
RE: RPN-duino - Chasfield - 10-02-2016, 01:54 PM
RE: RPN-duino - Chasfield - 10-16-2016, 03:41 PM
RE: RPN-duino - Luigi Vampa - 10-16-2016, 07:49 PM
RE: RPN-duino - larthurl - 04-06-2018, 02:38 PM
RE: RPN-duino - Chasfield - 10-17-2016, 05:31 AM
RE: RPN-duino - Chasfield - 10-27-2016, 02:13 PM
RE: RPN-duino - Luigi Vampa - 10-27-2016, 08:27 PM
RE: RPN-duino - Chasfield - 10-28-2016, 01:20 PM
RE: RPN-duino - Chasfield - 03-25-2017, 03:02 PM
RE: RPN-duino - Luigi Vampa - 03-25-2017, 09:52 PM
RE: RPN-duino - Chasfield - 03-26-2017, 08:32 AM
RE: RPN-duino - Chasfield - 03-27-2017, 03:19 PM
RE: RPN-duino - Maximilian Hohmann - 03-27-2017, 03:58 PM
RE: RPN-duino - BobVA - 03-27-2017, 05:00 PM
RE: RPN-duino - Chasfield - 03-27-2017, 04:42 PM
RE: RPN-duino - Chasfield - 07-19-2017, 04:51 PM
RE: RPN-duino - Luigi Vampa - 07-19-2017, 05:26 PM
RE: RPN-duino - EugeneNine - 07-19-2017, 06:12 PM
RE: RPN-duino - Chasfield - 07-24-2017, 01:50 PM
RE: RPN-duino - Dan - 07-27-2017, 03:44 AM
RE: RPN-duino - larthurl - 11-28-2017, 09:11 PM
RE: RPN-duino - Luigi Vampa - 11-28-2017, 09:40 PM
RE: RPN-duino - Chasfield - 04-05-2018, 04:41 PM
RE: RPN-duino - Luigi Vampa - 04-05-2018, 04:44 PM
RE: RPN-duino - Luigi Vampa - 04-06-2018, 02:41 PM
RE: RPN-duino - Chasfield - 04-06-2018, 06:14 PM
RE: RPN-duino - Chasfield - 04-08-2018, 10:34 AM



User(s) browsing this thread: 28 Guest(s)