Docsity
Docsity

Prepare-se para as provas
Prepare-se para as provas

Estude fácil! Tem muito documento disponível na Docsity


Ganhe pontos para baixar
Ganhe pontos para baixar

Ganhe pontos ajudando outros esrudantes ou compre um plano Premium


Guias e Dicas
Guias e Dicas


HP 12C Calculator: Writing and Running Custom Programs, Notas de estudo de Engenharia Mecânica

Learn how to write and run custom programs on the hp 12c calculator to enhance productivity and reduce errors. Understand the concept of keycodes, converting keystrokes into programs, and see examples of calculating final costs and effective rates. This document also covers advanced programming features.

Tipologia: Notas de estudo

Antes de 2010

Compartilhado em 14/11/2010

alan-souza-7
alan-souza-7 🇧🇷

4.5

(2)

35 documentos

1 / 6

Toggle sidebar

Esta página não é visível na pré-visualização

Não perca as partes importantes!

bg1
hp calculators
HP 12C Writing a small program
Why write programs?
What are keycodes?
Converting keystrokes into programs
Practice writing a small program
Going further and additional information
pf3
pf4
pf5

Pré-visualização parcial do texto

Baixe HP 12C Calculator: Writing and Running Custom Programs e outras Notas de estudo em PDF para Engenharia Mecânica, somente na Docsity!

HP 12C Writing a small program

Why write programs?

What are keycodes?

Converting keystrokes into programs

Practice writing a small program

Going further and additional information

HP 12C Writing a small program

Why write programs?

The HP12C resources are complete and powerful enough to solve almost any financial and business related problem. In some situations, a small, predefined sequence of custom-selected functions (called a program) becomes a handy tool to enhance productivity and to reduce the number of errors due to repeated keystroke usage. In general, creating a program is grouping a set of selected functions from the keyboard in a predefined sequence and storing this set in the calculator memory. This sequence can be easily executed later, as many times as needed and whenever needed.

What are keycodes?

Each key in the calculator keyboard is given an internal code. When a key is pressed and its code is identified by the calculator’s internal circuits, many operations are performed and the result from these operations is usually returned to the display (1)^. As a program is essentially a sequence of keycodes recorded for later execution. When a program is executed, the calculator reacts as if a keystroke sequence is performed. Each keycode is composed of a pair of single digits, where the first one refers to a row and the second one refers to a column on the keyboard. These row and column references define the position of the corresponding key on the keyboard(2)^. In most cases, one program line holds more than one keycode.

Figure 1

This is a typical program line. The leftmost code ( 02- ) is the program step number and the other number is the keycode. 22 means second row (up to down) and second column (left to right): this is the y key. This means that line 02- contains the code for y, and when the program is executed, y is the operation performed.

Figure 2

This is another program line showing more than one keycode. This is the program step number 03-, and 43 means fourth row (up to down) and third column (left to right): the g (blue prefix) key. 22 means second row and second column, or the y key. This means that line 03- contains the codes for the keystroke gy, which is the > function.

Figure 3

Figure 3 illustrates the reference to a program line numbered 03- with the keycode 43 2 , which means gR.

Converting keystrokes into programs

Each complete keycode in a program composes a program line , and each program line is automatically given a number, or a label. A program will hold as many lines (up to 99 in the HP12C) as are keyed in to perform the calculation it is meant for. A program must also end with a specific code that stops its execution. In most cases, a known sequence of keystrokes that are used to manually solve a problem is enough to generate a program. Simply put the calculator in

(^1) Some operations do not return numbers to the display, like setting a particular operation mode, checking for available memory or pressing keys

while writing a program. (^2) Except for the ; key (no keycode) and the number keys 0 to 9 that have a one-digit code matching the number printed on them.

HP 12C Writing a small program

. Figure 11

2 Figure 12

2 Figure 13

  • Figure 14

Now put the calculator back in normal mode and set program counter to step 00.

fs g(

The display shows previous contents. Now compute the first final price:

33 t Figure 15

The same keystroke sequence with the next data applies to the others:

37 t Figure 16

To check for the other values:

Keystroke Display 42.50 t 50. 48.00 t 56. 51.25 t 60. Figure 17

HP 12C Writing a small program

Answer: One of the programs that performs these calculations is listed below:

Keystroke Display fs fÎ 00- \ 01-^36 1 02-^1 5 03-^5 b 04-^25

  • 05-^40 1 06-^1

. 07-^48 2 08-^2 2 09-^2

  • 10-^40 fs g( 00 60. Figure 18

Example 2: There are many investments to be calculated in your office, and one of the calculations to be done several times is converting continuous nominal rate to effective rate. Write a small program that given a continuous nominal rate returns the effective rate only by hitting t key. Then use the program to find the effective rates for these continuous nominal rates: 10.5%, 17.2%, 11.8%, 10.24% and 11.5%.

Solution: The keystroke sequence that calculates effective nominal rate given a continuous nominal rate is:

\1 ~ b g> à

To write the program that performs the same operations, press:

Keystroke Display fs fÎ 00- \ 01-^36 1 02-^1 ~ 03-^34 b 04-^25 g> 05-^43 à 06-^24 fs g( 00 60. Figure 19

PRGM PRGM PRGM PRGM PRGM

PRGM PRGM PRGM PRGM

PRGM PRGM

PRGM

PRGM PRGM PRGM

PRGM

PRGM

PRGM