Programmable calculator on Pico DIY


Author Message
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 632
Posted: 12:07am 11 Feb 2024      

Programs are developed using a PC/serial connection,  a program is just a text file and loaded and run from the PC.  It is listed as the program runs.  To run "headless", the  SDcard has three files which are called and run  by the screen buttons.

The calculator and temperature example programs are lightweight enough. REAX is a temporary name of READ, it accepts user input from the display and stores it in a variable.
The calculator pgm reads a user line into a character array variable which is then evaluated by EVAL, which evaluates it and also writes the result to a result field.
The temperature pgm reads the user value into a floating point variable which is then used for the arithmetic. The result is written to a result field.
The solar position pgm is a lot bigger (goes on for pages)  but yada..

The "descs" routine just puts some description texts on the screen. Quite a bit to do yet !!


"Calc"
...

Running

     PROGRAM calcul8
     CHARACTER*20 eqn
     CALL descs ( )
     REAX eqn
     EVAL eqn
     END

     SUBROUTINE descs ( )
     QZFTXT QZFA  "Calculator"
     QZFTXT QZFB  ">>"
     QZFTXT QZFD  " ="
     RETURN
     END


"Pg1"

...
Running

     PROGRAM tempconv
     DOUBLE fahr, celsius
     FORMAT (F9.3)
     CALL descs ( )
     REAX fahr
     celsius = 5.0 * ( fahr - 32.0 ) / 9.0
     WRITE (*,0) celsius
     END

     SUBROUTINE descs ( )
     QZFTXT QZFA  "Temp conv"
     QZFTXT QZFB  "Input Fahrenheit"
     QZFTXT QZFD  "Celsius ="
     RETURN
     END

Edited 2024-02-11 10:19 by zeitfest