Interactive Programming. WP WP-34S
Anúncio
Anúncio
INTERACTIVE PROGRAMMING
This chapter deals with writing programs that interact with the user. Topics covered are the display of messages, getting input from the user, hot keys and truly interactive "real time" programs.
Interrupting a Program for Display of Information
When a program is started, the display contents are replaced by the "Running Program" message. To display a number while a program is executing, use VIEW in programming and specify a register to display. Here, X is a valid parameter so you can present the standard top stack level contents to the user. The command formats the number to the present settings and updates the LCD to display it. This causes a small overhead so expect that your program slows down a bit with each update. This is especially true if the displays follow each other in a tight loop because the flicker avoidance logic needs to wait for a complete display refresh cycle before the next update is allowed.
Another way to show what would normally appear on the display without a program running is to use the PSE instruction specifying the time in 10ths of seconds to suspend execution. A time of zero will have the same effect as a VIEW X instruction. PSE following VIEW s works as expected: it will display the contents of address s . The display will then stay unchanged until the next VIEW or PSE instruction is executed, not only for the time specified with PSE. The next PSE or STOP will switch back to the normal display of x . VIEW s followed by STOP will display the contents of address s until the user presses .
To make things clearer: VIEW immediately displays the register when encountered in program execution. When followed by PSE or STOP, the display persists. Only the next
PSE or STOP (or keyboard entry after the program has halted) will revert to the normal x display. To make sure that STOP or PSE always display a specific information it is best to directly precede it by the respective VIEW instruction. There is no way to get the
"Running Program" message back once it has been replaced by a programmed display.
Generally speaking, a message is a string of characters that is shown in the upper region of the display. The program interface to this area is via the alpha register. You need to switch to alpha mode to access most of the commands that deal with this register.
The annunciator INPUT lights if alpha mode is active. The X.FCN catalogue changes in alpha mode to contain alpha commands. Displaying a message will normally start with a
CL[alpha] instruction because most commands append their output to what is already stored. To save space, characters in program mode may be entered in groups of three by typing while already in alpha mode. This saves one program step per three characters but does not allow all special symbols to be entered because the catalogues are not available in this mode. Single characters and grouped characters can be freely mixed. The register is 31 characters wide. The display capacity is considerably smaller and depends on the width of each symbol. The display switches to a smaller font if necessary. The contents can be scrolled in interactive alpha mode with the up and down arrow keys (as described above).
If you just want to display a text message and no number with it, use αVIEW. To get to this command you must be out of alpha mode and open the P.FCN catalogue.
brings you to the alpha commands. The αVIEW display starts at the first character of the string. The numeric portion of the LCD is replaced by three dashes. You can of course display a message together with a chosen register. Go to alpha mode and press
WP 34S Owner‘s Manual
Edition 2.2 Page 90 of 103
Download
Anúncio