Molecular calculations for microanalysis on a programmable calculator

Molecular calculations for microanalysis on a programmable calculator

MICROCHEMICAL JOURNAL Molecular 21,458-465 (1976) Calculations Programmable (Microlab for Microanalysis Calculator Calculator JOHN M. on a P...

447KB Sizes 0 Downloads 39 Views

MICROCHEMICAL

JOURNAL

Molecular

21,458-465

(1976)

Calculations Programmable (Microlab

for Microanalysis Calculator

Calculator JOHN

M.

on a

Programming) CORLISS

Analytical Chemistry Branch, Chemical Research Division, Chemical Laboratory, Edgewood Arsenal, Aberdeen Proving Ground, Maryland 21010 Received

June 24, 1976

INTRODUCTION

In an enlightened community a sample is submitted for microanalysis and the analyst is given full information which allows an optimum selection of conditions for constituent determination. A basic requirement is a structural formula from an organic chemist. Conversion to the empirical formula and percentage composition guide the microanalytical staff through sampling, constituent determination, and the reporting of results. At several points in this process, the analyst will be at the calculator or, perhaps, the computer terminal. If the terminal is in any way inconvenient, he would opt for the calculator. The necessary calculations are not difficult but are tedious with repetitive key-stroking of atomic and molecular weights. The card-programmable calculator, on the other hand, is just the proper-sized instrument to handle these computations and to minimize this key-stroking. In our microanalytical laboratory, a survey of the most recent 15,000 samples showed that 6000 empirical formulae were represented. Many of these formulae represented multiple structural formulae. On this basis, every other sample is a compound new to our microanalytical staff, making the analyst’s compositional computations a never-ending chore. When the submitting chemist is open with information, the analyst is expected to be equally as open. At times, this openness requires the analyst to usefully justify results which differ from expectations. This justification may suggest the presence of unexpected materials in a sample. The calculations for this justification often resemble a conversion from experimental percentage composition to empirical formula and again require a return to the calculator. In this paper, two representative programs are presented which were written for the Hewlett-Packard HP-65 calculator. This particular calculator model was chosen for its portability, programmability from prerecorded cards, and the strong support that the manufacturer gives its 458 Copyright All rights

@ 1976 by Academic Press, Inc. of reproduction m any form reserved.

MICROLAB

CALCULATOR

459

PROGRAMMING

software library. From this last fact, it may be assumed that a program written for an HP-65 calculator a year ago will work on an HP-65 built today (3). Complete programs are presented which may be keyed into the memory of an HP-65 calculator and used immediately. The tables give the order of key entry for programming an HP-65. The calculator retains each keyed step as a numerical code. For example, machine code for key “REG” is 43. Both keys and codes are given in the tables to facilitate programming. The first program presented involves probably the most used calculation in an elemental microanalytical laboratory. It calculates, from an empirical formula, the molecular weight and the percentage composition. The second program converts water of hydration expressed as the ratio of water per mole of dry compound to percentage water, and also makes the reverse calculation. PROGRAM

I: ELEMENTAL

PERCENTAGE

COMPOSITION

With the first program, the calculator converts a given empirical formula, usually organic, into its molecular weight and elemental percentage composition. After the program has been stored in memory, pressing “RTN” guarantees operation from the “top of memory,” the beginning of the program. This is followed by pressing “R/S” which starts the program. The program stops, displaying the atomic weight of carbon, suggesting that the operator keys in the number of atoms of carbon present. Successively pressing the “R/S” key suggests entry of the number of atoms of hydrogen, chlorine, fluorine, nitrogen, oxygen, phosphorus, and sulfur. Note that the order is the normal order of writing empirical formulae of organic compounds. If the element is not present, zero is pressed. Two tinal additional stops are made with the calculator displaying zero. These stops allow the operator to enter, one element at a time, the atomic weight of less frequently seen elements. Again, with the atomic weight on display, the operator keys in the number of atoms of the element. Similiar entry of these less frequently seen elements could have been made at earlier program stops where zero had been entered to denote the absence of suggested elements. Thus, the normal order of elements in the empirical formula may be approximated. The program can handle up to six different elements per empirical formula. Immediately following the second additional program stop, the program completes its calculation and results may be recalled from storage. The molecular weight is found in storage register 8. The elemental percentages will be found in register 1 through 6, or, more logically, 6 through 1, with the percentage of carbon in the highest numbered, occupied register through hydrogen, etc., to register 1. Thus, for example, percentage com-

460

JOHN

M.

CORLISS

position for C,H,O, will be found in this order: carbon in register 3, hydrogen in 2, and oxygen in 1; for CGH4C1N02, carbon will be in register 5, hydrogen in 4, chlorine in 3, nitrogen in 2, and oxygen in 1. The complete program is given in Table 1 with clarifying notes. Commencing from the top of the program, the main routine suggests carbon by displaying 12.01 and then refers the calculator to the storage routine A. Here the first arithmetic is handled and then either the program immediately returns to the main routine for elements absent; or, for elements present, the program stores preliminary results and then returns to the main routine. This program may be additionally used to calculate percentages of functional groups present by entering the group weight in unused storage

TABLE ELEMENTAL Key

entry f REG 1 2 0 1 1 A 1

Code shown 31 43 01 02 83 00 01 01 11 01

PERCENTAGE

Comments Storage registers are cleared. Program suggests elements likely to be present through their atomic weights. Number of atoms present are keyed in. If none, key zero

1 COMPOSITION”

Key entry

Code shown

5

05

A 3 2

11 03 02 83 00 06 06 11 11

0 6 6 A A

4 5

83 00 00 08 11 03 OS 83 04 05

A RCL 8 EEX 2 i ST0 A 1 ST0 +

7 A 1 9 A I

07 11 01 09 11 01

2 ST0 2. 3 ST0 A

0 0 8 A 3 5

continued

on next page

Comments

Additional atomic weights are entered.

11 Number of atoms 34 08 keyed in. Routine for final step of 43 02 calculating percentage 81 33 composition. 81 01 33 81 02 33 81 03 33 81

MICROLAB

CALCULATOR

TABLE

Key entrv 4 0 0 8 A 1 6 A 3 0 9 7

461

PROGRAMMING

1 continued Key entry

Code shown

04 83 00 00

4 ST0 + 5

04 33 81 05

08 11 01 06 11 03 00 83 09 07

ST0 L 6 R/s LBL A R/s X 0 gxsY

33 81 06 84 23 Storage routine 11 84 Total weight of element 71 in moles calculated. 00 35 07 Absent elements are

gx=y RTN g NOP ST0 + 8 ST0 I RCL 5 RCL 6 RCL 4

35 23 discarded. 24 35 01 33 Molecular weight is 61 accumulated. 08 33 07 Heart of the storage 34 05 routine. Stored in this order: Earliest 33 06 34 04 entries occupy

ST0 5 RCL 3 ST0 4 RCL 2 ST0 3 RCL 1 ST0 2 RCL 7 ST0 1 RTN

33 05 34 03 33 04 34 02 33 03 3401 33 02 34 07 33 01 24

Code shown

Comments

N.B.: key entry continued top next column.

Comments

highest-numbered registers. Data arranged at lower end of register number scale.

a Registers RI-&: At end of run, contains elemental percentages in reverse order of entry in lowernumbered registers. R,: Used. R,: Molecular weight accumulator. &: Used. Routines A: Storage.

462

JOHN

M.

CORLISS

registers following entry of all elements present and prior to pressing the final “R/S” for the calculation. PROGRAM

II: WATER

CONVERSION

This program converts the moles of hydration per mole of dry compound to percentage water present or makes the reverse calculation. Created for a special purpose, this program will not be in use as frequently as the first. However, it is presented here, as complementary to the first program, to give a better overview of the programming power and possibilities with the calculator for use in microanalytical calculations. While the first program was controlled exclusively through use of the run/stop (R/S) key, this program is controlled through use of the set of user-defined keys across the top of the keyboard. With the program in memory, the molecular weight of the dry compound is keyed in, then key “A” is pressed. This prepares the calculator for reception of either moles of hydration or the percentage water present. After keying in one of these values, the “B” key is pressed signifying that the number entered represents the percentage of water present, or the “C” key is pressed signifying entry of the moles of water present. At this point, the key remaining unused of the two, “B” or “C.“ is pressed and the correct result is displayed. The conversion of molar water to percentage water could have been made using the percentage composition program as noted earlier; however, this program has much greater convenience for this particular task. The algorithm for this program is based on straightforward algebra and is shown in Table 2 in the clarifying comments. After experimentally determining quantitatively the presence of moisture in a material, this presence is reported initially as a percentage in order to be consistent with other microanalytical results. However, it is frequently advantageous to consider the water present as a molar ratio entity (I). For example, the material under microanalytical consideration may consist of a single compound approaching high purity with the inclusion of a quantity of water. If the molar ratio of the experimentally determined water to the dry compound can be simply stated, the material would be accepted as a high purity hydrated compound and, with this knowledge, useful for further purposes. Furthermore, comparisons could be made with possible references to the compound in the literature and statements could be made regarding the state of hydration versus the method of preparation. As may be noted from the comments on Table 2, routine A is used simply to store molecular weight and a constant. If repeated use of the program is made with the same molecular weight, it is unnecessary to repeat routine A for each calculation since the initialization steps would be re-

MICROLAB

CALCULATOR

TABLE

2

WATER CONVERSION

Key

Code shown

LBL A ST0 1 1 8 0 1 6 ST0 2

23 11 33 01 01 08 83 00 01 06 33 02

0 RTN LBL B 0 g XGY gxiy GTO 4 RCL 5

00 24 23 Calculate %: 12 nl801.6 00 W+nl8.016 35 07 35 21 (or) 22 Go to subroutine 4. 04 34 05

RCL X ST0 EEX 2 X RCL RCL + i

34 02 71 33 03 43 02 71 34 03 34 01 61 81

entry

2 3

3 1

Comments Initialize. Enter dry molecular weight in register 1. Enter molecular weight of water in register 2.

463

PROGRAMMING

a

Key entry

Code shown

RTN LBL 4 ST0 4 gRV RTN LBL C 0 g xsy

24 23 Subroutine 4: Store %, 04 often an experimental 33 04 value. 35 08 24 23 Calculate n: 13 % xw 00 18.016(100-%) 35 07

gx#y

35 21 (or) 22 Go to subroutine 5. 05 34 04 3401 71 34 02 43 02 34 04

GTO 5 RCL 4 RCL 1 X RCL 2 EEX 2 RCL 4 X 2

RTN LBL 5 ST0 5 gRV RTN

51 71 81 24 23 05 33 05 35 08 24

Comments

Subroutine 5: store n.

u Registers RI: Dry molecular weight of compound (W) under study. R,: Molecular weight of water. R,: 18.016 times given n. R,: Given percentage of water (%). R+ Given moles water per mole dry compound (n). Rg: Used. Routines A: Enter dry molecular weight of compound (W) under study. B: Enter percentage of water (%), or calculate this value. C: Enter moles water per mole dry compound (n), or calculate this value. 4: Store percentage of water. 5: Store moles water per mole dry compound.

464

JOHN

M.

CORLISS

dundant. Thus, entering a new percentage or molar ratio primes the calculator for the next calculation. The program first executes information storage by use of key A and one of the other two keys in use. Immediately following this and with the zero on display, that is, in the X register, the calculation is made. If program usage is interrupted between these steps by other calculations, the display should show zero entered in the X register before continuing. Otherwise, the key for the calculation must be pressed twice to produce the final result. DISCUSSION

The two programs offered here differ in use of program control keys and also in format. The percentage composition program may be considered as a continuously running program, starting at the top of memory, stopping only to devour more data or to disgorge results. If the program is not started at the top of memory initially, certain necessary clearing and storage steps would be surpressed. However, with the program in use from one calculation to the next and by repeated pressing of the “R/S” key, the program will be returned to the top of memory and the next calculation may be made. On pressing the “R/S” key after data entry, the program starts where it had stopped and continues along an established path. The path through the water conversion program is not so rigidly defined. This program can be considered as three programs, A, B, and C, in memory simultaneously. In introducing this program, it was said that, first, routine A enters dry molecular weight in storage. Then B or C adds to storage. Finally, a calculation is made by pressing the third programcontrol key. A logical order of use of control keys would be A, B. C. However, since the three routines A, B, C are independent, they could be used correctly in the order B, A, C to calculate moles of water. In other words, any order would do which would place the calculation last. The programs make full use of relational tests in which true decisions are made. For example, in the first program, step 81 decides on a return to the main routine if an element is not present in order to save valuable storage space; in the second program, both routines B and C decide either on the acceptance of data as entered or on the calculation of results as required. In Table 3, microanalytical results are presented on two preparations of tetraethylammonium fluoride. This material is hygroscopic and is usually prepared as the dihydrate. The first of the two was freshly prepared in the laboratory and analyzed immediately; the second was purchased from sources outside the laboratory. The second material shows a noninteger molar ratio which is readily written in an all-integer formula with good compositional comparisons. The first line for each preparation is a compositional calculation made with the first program from the formula given

MICROLAB

CALCULATOR

TABLE ANALYSIS

C,H,,FN.2H,O Found Calculated 3C,H,,FN.8Hz0 Found Calculated

465

PROGRAMMING

3

OF TETRAETHYLAMMONKJM

FLUORIDE

Percentage

Molecular weight

n

C

H

F

N

0

H,O

185.29

2.00

185.83 591.90

2.03 2.67

197.00

2.65

51.86 51.9 51.71 48.70 48.9 48.78

13.06 12.8 13.05 12.94 12.9 12.95

10.25 10.4 10.22 9.63 9.9 9.64

7.56 7.5 7.54 7.10 7.0 7.11

17.27 17.1 17.48 21.63 21.5 21.52

19.45 19.7 19.70 24.35 24.2 24.17

on that line. The hydration 12on the first line is the moles of water per mole of dry material of that same formula. The third line is a calculation based on the percentage of water found plus the remainder as pure, dry material. The hydration here was obtained using the second program. The dry molecular weight is 149.256. The percentage composition on the third line was obtained using the first program. For example, the noninteger formula C,H,,FN 2.03H,O was used. Besides being an exercise in using the programs, this particular example was included to show the application of the programs in the development of a rationale for the acceptance of the purity of the second preparation. After comparing results using these programs to the experimental values, it is seen that acceptance of the usefulness of the second material is only impaired by the presence of additional moisture. The atomic weights used in these programs were proper for our purposes. Changes in these atomic weights more suitable for other purposes can be made by keying into memory different values, provided the capacity of the memory is not exceeded (2). l

SUMMARY For the microanalytical staff that serves a strongly research-oriented laboratory, calculations are continuously being made which are to an extent repetitious in nature. The calculator has not always been superseded by the computer for this work. On the other hand, the card-programmable calculator offers convenience in accessibility and relief from tedious repetitive key-stroking. Two programs, ready for use in the Hewlett-Packard HP-65 calculator, are presented and discussed. These particular programs were chosen for their differences in operation, for their complementary format, and for their utility in microanalytical determinations. In a word, they were chosen to show the broad attack on microanalytical calculations offered by the card-programmable calculators with limited memory.

REFERENCES Corliss, J. M., and Buckles, M. F., A flexible procedure for Karl Fischer microtitrations. Microchem. J. 10, 218-230 (1966). 2. Hewlett-Packard, HP-65 Owner’s Manual. 1.

3.

Nelson,

R. J., Unsupported

features.

65 Notes

3 (Z),

3 (1976)