Showing posts with label HP 41CX. Show all posts
Showing posts with label HP 41CX. Show all posts

Sunday, April 2, 2023

Swiss Micros DM41X: Cash Register

Swiss Micros DM41X: Cash Register


Ready to Check Out? 


Download the program here (raw file):  https://drive.google.com/file/d/102ekvHr4c3shBY6RvAuAZzjj1g1ctD7L/view?usp=share_link


This program simulates a cash register.  If you have an HP infrared printer like the HP 82240B (from the 1980s and 1990s), the program is set to print the results. The printer is enabled by setting flag 21.   When a printer is present, flag 55 is set internally.   


When the printer flag is turned on (21):


AVIEW:   print what ever is in the alpha register

VIEW:  print the contents of a numeric register

ADV:  advances the paper


A printer is not required to run the program, unplug the Infrared Printer Module.  This way the program stops when an AVIEW, VIEW, and ADV instruction displays.  Press [ R/S ] to continue.


This program assumes every item entered is subject to a sales tax, which is set within the program, line 03.   



DM41X/HP41CX Program:  CASHREG


When you are done entering the costs for items checked out, enter zero.


01  LBL^T CASHREG

02  FIX 2

03  8.75    ← set your sales tax rate here 

04  STO 02

05  0

06  STO 01

07  SF 21   ← allows the calculator to print/display

08  ^T THE STORE

09  33

10  XTOA  ← ammends an exclamation point (!)

11  AVIEW

12  CLA

13  FIX 8

14  DATE

15  ADATE

16  AVIEW  ← prints the date

17  CLA

18  FIX 2

19  ADV

20  LBL 00   ← main loop

21  ^T COST?

22  PROMPT

23  X=0?

24  GTO 01

25  ARCL X

26  AVIEW

27  ST+ 01

28  GTO 00

29  LBL 01

30  ^T SUBTOTAL

31  ARCL 01

32  AVIEW

33  CLA

34  ARCL 02

35  ^T |- % TAX:

36  RCL 01

37  RCL 02

38  %

39  ARCL X

40  AVIEW

41  +

42  ^T TOTAL:

43  ARCL X

44  AVIEW

45  ^T PAID:

46  PROMPT

47  ARCL X

48  AVIEW

49  X<>Y

50  -

51  ^T CHANGE:

52  ARCL X

53  AVIEW

54  END



Example


Checkout:

$19.99

$27.95

$28.94

Sales Tax Rate:  8.75%

Paid: $100.00


XEQ CASHREG



THE STORE

01/29/2023   ←  the current date is shown here

COST?  19.99 R/S

COST?  27.95 R/S

COST?  28.94 R/S

COST?  0

SUBTOTAL: 76.88

8.75% TAX:  6.73

TOTAL:  83.61

PAID:  100 R/S

PAID:  100.00

CHANGE:  16.39



Eddie 



All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Sunday, October 2, 2022

Swiss Micros DM41X: Setting Up Keys Through a Program

Swiss Micros DM41X:  Setting Up Keys Through a Program


Assigning User Keys Through a Program


On the HP 41/DM 41 family, it is possible to store programs or commands in a program (see Caution below).


ASN vs PASN


Both ASN and PASN assigns a user key.  ASN is not a programmable command, but PASN is.  


ASN will prompt for a key with the program or command in the alpha register. 


PASN is a programmable command with the following syntax:


^T  (program or command name)

(key code)

PASN


The key codes start in the upper left hand corner of the classic HP 41C calculators.  If you are using a Swiss Micros version, please keep in mind that the keyboard is different from the classic HP 41C but the key codes are retained.


Some common user keyboard key codes are:

[ Σ+ ] 11

[ 1/x ] 12

[ √x ] 13

[ LOG ] 14

[ LN ] 15


[x<>y] 21

[ R↓ ] 22

[SIN] 23

[COS] 24

[TAN] 25


[ENTER↑] 41

[ - ] 51

[ + ] 61

[ × ] 71

[ ÷ ] 81


Shifted user keys have a negative value, for example:

[ (shift) ] [ Σ+ ] ( Σ- )  -12

[ (shift) ] [ 1/x ] (y^x)  -13

 and so on.


Clearing Assigned Keys


To clear a single user key, assign a blank alpha string to it.  This works for both ASN and PSAN.  


You can clear all the keys by the CLKEYS command. (see Caution below).


Caution:  Unless modifications or additional ROMs are added, the commands PASN and CLKEYS are not available on the HP 41C and the HP 41CV.  The commands are available on the HP 41CX, DM41X,  DM 41, and DM 41L.  



Template



Give the user a choice to clear or load the user keys: 


LBL ^T  (main name of the program)

^T 0 CLR 1 LOAD

PROMPT

STO 00

GTO IND 00


Fortunately we can use indirect addressing with the GTO command. 


This section clears all the keys.  I put a DONE message to tell the user that the process is done.  


LBL 00

CLRKEYS

^T DONE

AVIEW

RTN          


This section loads the commands and programs to user keys.  Detailed programs will follow. 


LBL 01 

^T  (program or command name)

(key code)

PASN

...

RTN


Now for the programs and calculations created:


LBL ^T (program or command name)

(contents)

RTN

...


END 


Add an END command after the last RTN.  


The Program UFX


The program UFX presents the user with two options:  enter 0 to clear all the user keys.  Entering 1 loads the following functions:


SSPH:  Surface area of a sphere.  Assigned to the user key [ Σ+ ], key code 11.

Surface area of a sphere = 4 * π * x^2


VSPH:  Volume of a sphere.  Assigned to the user key [ x<>y ], key code 21.

Volume of a sphere = 4/3 * π * x^3


STOR:  Surface area of a torus.  Assigned to the user key [ 1/x ], key code 12. 

Surface area of a torus = 4 * π * y * x 

y = larger radius, x = smaller radius


VTOR:  Volume of a torus.  Assigned to the user key [ R↓ ], key code 22.

Volume of a torus = 2 * π^2 * y * x^2

y = larger radius, x = smaller radius


Swiss Micros DM41X Program UFX


(^T:  alpha string indicator)


01 LBL ^T UFX

02 ^T 0 CLR 1 LOAD

03 PROMPT

04 STO 00

05 GTO IND 00

06 LBL 00

07 CLRKEYS

08 ^T DONE

09 AVIEW

10 RTN          \\ RTN outside a subroutine stops the program

11 LBL 01      \\  assign the keys first, add the programs later

12 ^T SSPH

13 11

14 PASN

15 ^T VSPH

16 21

17 PASN

18 ^T STOR

19 12

20 PASN

21 ^T VTOR

22 22

23 PASN

24 ^T DONE    

25 AVIEW

26 RTN              \\ this ends the loading processing, the detialed subroutines follow 

27 LBL ^T SSPH

28 X↑2

29 PI

30 *

31 4

32 *

33 RTN

34 LBL ^T VSPH

35 3

36 Y↑X

37 4

38  *

39  3

40  /

41 PI

42  *

43 RTN

44 LBL ^T STOR

45 *

46 PI

47 X↑2

48  *

49  4

50  * 

51  RTN

52 LBL ^T VTOR

53 X↑2

54  *

55  PI

56 X↑2

57  *

58  2

59  *

60  RTN

61  END     \\ we want to end the program with END


Source (for the Torus formulas):


Mathematics Program Library:  Sinclair Enterprise Programmable  Sinclair Radionics Inc.  New York; Cambridgeshire, London.  1975


That is all this time, see you next time!


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 



Saturday, October 30, 2021

Swiss Micros DM41X and HP 41CX: Advanced String Programs

Swiss Micros DM41X and HP 41CX:  Advanced String Programs





Introduction and Generating Random Integers


This blog entry features three programs for the Swiss Micros DM41X and HP 41CX (or a HP 41C with an extended module):


ACODE:  generate a code of random letters


ASAMP:  generate a sample of numbers of digits 0 to 9, where no numbers repeat.  ASAMP accepts up to 9 numbers.   


CRYPT:  allows the user to "add" or "subtract" a code to a word to encrypt it.   CRYPT is a basic form of encryption.   


Both ACODE and ASAMP use a random number generator.  Unfortunately, the HP 41C does not have a random number generator and one must be programmed.  I wanted to avoid reinventing the wheel.   The following formula, obtained from the book An Atlas of Functions (see source), generates random numbers of value 0 ≤ r < 1:


r_n+1 = [ ( (4561 * int(243000 * r_n) + 51349 ) mod 243000 ] ÷ 243000


To convert this into a random integer from a to b: 


randint = int( (b - a + 1) * r) + a


int is the integer function.   The second formula is useful because we don't have to change display modes to execute the calculation.  


Note:


XTOA takes an integer from the stack and appends the associated code to the alpha string.


ATOX takes the left most character, converts it to code, and deposits it on the X stack.  The length of the alpha string is reduced by one.


Codes:

Alphabet:  65 is code for A, 90 is code for Z (all letters inclusive)

Numbers:  48 is code for 0, 57 is code for 57 (all letters inclusive)

# 35

$  36

%  37

&  38

:  58

@  64

[  91

]  93

Σ 126


The system's DATE and TIME are used to generate an initial seed


Swiss Micros DM41X Program:  ACODE


Instructions:

Enter the length, execute ACODE


Example (results will vary):

10 ACODE (may) return CDSJHPNWLD  (10 letters)

11 ACODE -> NVJZJMVVBSV


01 LBL^T ACODE

02 CLA

03 STO 01

04 DATE

05 TIME

06 +

07 2

08 /

09 FRC

10 STO 02

11 LBL 00

12 RCL 02

13 XEQ 01

14 XEQ 02

15 XTOA

16 DSE 01

17 GTO 00

18 AVIEW

19 RTN

20 LBL 01

21 RCL 02

22 243 E3

23 *

24 LASTX

25 X<>Y

26 INT

27 4561

28 *

29 51349

30 +

31 X<>Y

32 MOD

33 LASTX

34 /

35 STO 02

36 RTN

37 LBL 02

38 26

39 *

40 INT

41 65

42 +

43 RTN

44 END


Swiss Micros DM41X Program: ASAMP


Instructions:

Enter the length, execute ASAMP


If the length is greater than 9, an error is generated.  


Example (results will vary):

4 ASAMP can generate results such as 4381, 0361, 4920

7 ASAMP can generate results such as 6732145, 9852067, 1963542

 

Results are returned as an alpha string


01 LBL^T ASAMP

02 CLA

03 STO 01

04 9

05 X<Y?

06 GTO 03

07 DATE

08 TIME

09 *

10 FRC

11 STO 02

12 LBL 00

13 XEQ 01

14 STO 03

15 POSA

16 -1

17 X=Y?

18 GTO 02

19 GTO 00

20 LBL 02

21 RCL 03

22 XTOA 

23 DSE 01

24 GTO 00

25 AVIEW

26 RTN

27 LBL 01

28 RCL 02

29 243 E3

30 *

31 LASTX

32 X<>Y

33 INT

34 4561

35 *

36 51349

37 +

38 X<>Y

39 MOD

40 LASTX

41 / 

42 STO 02

43 10

44 *

45 INT

46 48

47 +

48 RTN

49 LBL 03

50 0

51 1/X

52 RTN

53 END


Swiss Micros DM41X Program:  CRYPT


Syntax:

Store your word in the Alpha register

Give a key (integer), can be positive or negative

XEQ CRYPT


Example:

Starting alpha string:  MATHS

10 CRYPT returns WKDRC

-10 CRYPT returns MATHS (where you started from)

This allows for two people to have short encoded messages and a secret key.


01 LBL^T CRYPT

02 STO 01

03 ALENG

04 STO 02

05 LBL 00

06 ATOX

07 65

08 - 

09 RCL 01

10 +

11 26

12 MOD

13 65

14 + 

15 XTOA

16 DSE 02

17 GTO 00

18 AVIEW

19 RTN 


You can download all three files (in .raw format) here:  

https://drive.google.com/file/d/1UD8CAILnfe4l2ID_UdoHfFGvaYiWni8J/view?usp=sharing


Thanks to Albert Chan (MoHPC) for feedback on the the programs.  



Source for the Random Number Formula:


Keith Oldham, Jan Mayland,  Jerome Spainer  An Atlas of Functions 2nd Edition Springer:  New York, NY.  2009.  ISBN 9780387488066


Eddie


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Friday, February 23, 2018

Review: SwissMicros DM41L

Review: SwissMicros DM41L





General Information

Company:  SwissMicros, https://www.swissmicros.com/
Type:  Programmable Scientific
Memory:  319 registers (2,233 steps),
(Firmware V 25 gives additional archive storage)
Battery:  CR 2032
Years:  Current (2015-)
Cost: $138 U.S. dollars (February 2018), 129 CHF

There are two models: the DM 41L and the DM41.  The DM41 is a credit card sized version of the DM 41L (99 CHF).  For me, I prefer the larger sized DM 41L as I do have large hands.  Both offer the same functionality. 

The size of the DM 41L is about the size of the Hewlett Packard HP 12C and HP 15C.

Note:  When I mention the DM 41L, this applies to both the DM 41L and the credit-card sized DM 41. 

The delivery for me (from Switzerland to the United States) was really fast, much faster than I expected.  I was motivated to purchase a DM 41L because I will turn 41 years old in March.  This is my first calculator from SwissMicros. 

The HP 41C Comes to the 21st Century

The DM 41L is a clone of the very popular HP 41CX calculator, but in a landscape form.  The HP 41CX was the final version of Hewlett Packard’s HP 41C series produced for most of the 1980s.  The HP 41CX included a time module, which gives the calculator a timer, stopwatch, and calendar operations.  Also the HP41CX included an extended functions and memory module.  The base HP 41C had 63 registers, while the HP41CX, and the DM 41L start you off with 319 registers.

Each register could either hold a number or seven program steps.  At any time you can designate how many registers to dedicate to holding numeric constants by executing the SIZE command.

The DM41L and DM 41 come with the following modules installed:

* Extended Memory and Functions (EX FCN 2D)
* Time Module (CX TIME)

I am so happy that the Time Module is included, because the DM41L has the days between dates function, so I don’t need to program the convert date to the Julian Date algorithm.  (I love the days between dates function, and I do feel that, and the date add functions should be standard on all calculators – OK, rant over).

Keyboard

The keyboard is a pleasure to use.  The colors of the fonts are beautiful, with the labels having great contrast between text and keyboard background.  The keys are very responsive and provide great feel for each press.  I have seen some reviewers comment that the keys are at first hard and need some breaking in, however, this is not the case for me. 

The only thing is that, I wish the ON button was the same height as the other keys, as the ON key is sunken a bit.  This could be personal preference as the ON key works just as well the rest of the keys.

Connectivity

The DM 41L can the connected to the computer where you can back up your memory, restore memory, load programs, and update the software.  The current version at the time of this review is Firmware 25.  Firmware 25 adds the X-Memory module, which allows for additional achieve memory. 

The cord used is a mini USB-RS232 cord, which is the same one used to connect the TI-84 Plus CE.

The Swiss Micros will have links to the required connectivity software and detailed instructions. It took me a little time to get the hang of it, it gets easier after I get the procedure. 

Get the DM 41L ready for connectivity use by having the calculator off, then holding the [ √x ] (C) button and the [ ON ] button.

What Time Is It?

You can have the DM 41L tell you time and date by first having the calculator off, then holding the [ Σ+ ] (A) key, then the [ ON ]. 

In a similar fashion, you check the revision software by holding [ LN ] (E) then [ ON ].

SwissMicros’ other [ ON ] + key combos are listed here:  https://www.swissmicros.com/instructions.php

Programming

The DM 41L’s programming module is RPN keystroke, like the HP 41C.  If you know how to program the HP 41C, you can program the DM 41L.  Due to the popularity of the HP 41C, there is of ton of programming information online.  The Museum of HP Calculators has an entire software library thread dedicated to the HP 41C (http://www.hpmuseum.org/forum/forum-11.html ), which should work on the DM 41L with no problems.

A great online source to the programming and operating the HP 41C and the DM 41L can be found here:  http://www.greendyk.nl/hp41c-manual/index.php?s=J&p=7  Special thanks to Greendyk!   ( www.greendyk.nl )

Verdict

Do I recommend the DM 41L to purchase? 

That would be a 100% YES!

SwissMicros deserves all the praise from their customers, high quality calculator and high quality work.  I have very happy with my purchase. 

SwissMicros has several other calculators, including the DM 42 which was just released.  Please feel to check it out.

Eddie


This blog is property of Edward Shore, 2018.

Python: Drawing a Ring of Circles

Python: Drawing a Ring of Circles The goal: Draw a number of circles that revolve around the origin (0,0). The center of each circle i...