The Museum of HP Calculators

HP Forum Archive 08

[ Return to Index | Top of Index ]

HP49 Printing
Message #1 Posted by MIke on 17 July 2002, 8:23 p.m.

I have the good fortune to enjoy toying with an HP49. Fortunatly setting flag 117 returns soft keys similar to my old 48S. Problem Statement: We have developed a simple list program: « DEPTH ¨LIST SORT REVLIST DUP 'OFILE' STO LIST¨ DROP » The "DUP 'OFILE' STO" posts a textfile which is easy to transfer to my PC, but difficult to parse using excel (linebreaks do not equal record breaks). My goal is to collect data using the hp49, then analyse it on the spot. Later, back in the office, to load the records into a master list for further analysis. Is there a way to use the PRST command to generate a textfile to HOME on the 49? for simple transfer to my PC? I have use HPComm software, but can only create the link using the start server command.

      
Re: HP49 Printing
Message #2 Posted by James M. Prange on 17 July 2002, 9:27 p.m.,
in response to message #1 by MIke

I don't think that PRST is the command you're looking for. Maybe change your program to:

\<< DEPTH \->LIST SORT REVLIST DUP \->STR 'OFILE' STO LIST\-> DROP \>>

and use the character commands to work with the string?

But what type of objects are on the stack when you start? How many? How do you need it formatted for use on the PC?

Regards,
James

      
Re: HP49 Printing
Message #3 Posted by Vieira, Luiz C. (Brazil) on 18 July 2002, 12:14 a.m.,
in response to message #1 by MIke

Hi;

I agree with Mr. Prange, transfering a string object will parse "spell checking", so you will have no problem transfering. Anyway, your Linebreak characters can be easily found (POS) and replaced by the ones -record breaks- you need (REPL); put this in a loop that will end when POS returns zero, and your former string with linebreaks will contain record breaks in their places.

There is also the translation code issue. Have you tried changing it?

I'm not sure these are the problems, neither if my suggestions will (help) to solve them, but, as Mr. Prange mentioned, some more data will help us understanding.

Hope it helps a bit more.

Cheers.

(try the HP48G related material, mostly the AUR manual; a lot of good stuff in a better, concise text is there. And most of it "fits" on the 49's resources)

      
Re: HP49 Printing
Message #4 Posted by Mike Neu on 20 July 2002, 2:31 p.m.,
in response to message #1 by MIke

Fellows; Luiz, James Thanks for the feedback. To answer Mr. Vieira 's question. Input will be via unskilled hands. Two entries go onto the stack;

FI Last Name [ENTER] @Character string, including spaces {0.102 0.507 0.437 0.252 0.7654} [ENTER] @ a list, containing three to five measurements, measured to 10/10,000 inch.

[En1] @ stores this info as a list {average minimum FI LAST {RAW DATA} There may be from ten to twenty records during the day, once all measurements are completed.... At the end of the day,

[WINN2] @ sorts the records in descending order, and posts data to [OFILE2]. Now a string, thanks to Mr. Prange's advice.

At this point the field mission is complete and the HP49 returns to my skilled? hands. At my office, I will transfer [OFILE2] to my PC (and rename) for record retention. On request, I will import each data file into EXCEL, and prepare a pivot table to post results. I'm lazy, so most of this is presently done via macros. Presently? A fair question to ask. Presently, this is being done with an aged HP notebook, using a DOS application written in Alpha 4. "Unskilled hands" are intimidated by the notebook, unwilling to try or learn. Getting data entry has been problematic. Even in my skilled hands, the notebook can be unnerving. Three hours to generate the measurements, then entry, analysis, and reporting.... in one nanosecond or less, please. The mighty 49 is my Trojan horse. It is eminently more suitable to the task, and has eager operators to provide data entry. One calculator, several buttons, far less intimidating, much better suited to the task. Programs behind the softkeys: [En1] %%HP: T(1)A(D)F(.); « DUP DUP DUP SORT HEAD SWAP (sum)LIST 3. ROLL SIZE / 3. DROP 4. PICK 4. PICK SWAP 4. PICK 4. PICK 4. ->LIST REVLIST SWAP DROP SWAP DROP SWAP DROP SWAP DROP » [WINN2] %%HP: T(1)A(D)F(.); « DEPTH -> LIST SORT REVLIST DUP ->STR 'OFILE2' STO LIST -> DROP » [OFILE2] %%HP: T(1)A(D)F(.); "{ { 0.6123 0.3210 PTY { 0.3210 0.6540 0.8620 } } { 0.4560 0.1230 VQM { 0.7890 0.4560 0.1230 } } { 0.2580 0.1470 MQV { 0.2580 0.1470 0.3690 } } }"

PS: "your Linebreak characters can be easily found (POS) and replaced by the ones -record breaks- you need (REPL); put this in a loop that will end when POS returns zero" I understand this advice, and I know exactly what Mr. Vieira has in mind. The syntax in the 49 AUR manual also seems straightforward. Unfortunately, my 49 thinks otherwise. I'm sure that a sharp programmer, will quickly conclude from the instructions in [En1] that our 49 programming experience is in it's infancy. Any more advice?

            
Re: HP49 Printing
Message #5 Posted by mike on 20 July 2002, 2:49 p.m.,
in response to message #4 by Mike Neu

Long on talk, missed my question. How do I insert a carrige return (space up, line break, any name will do) on that text string? [right shift] [.] just adds a line break to the text for the program? I remember that this is an an asci chr 10. This agrees with the; symbol number and function given on the 49. How do I apply it to the string?

            
Re: HP49 Printing
Message #6 Posted by James M. Prange on 20 July 2002, 8:26 p.m.,
in response to message #4 by Mike Neu

Well, first off, I suggest that when you upload programs to your PC in ASCII mode, you use HP Kermit translation mode 3 instead of 1. You can set that by executing 3 TRANSIO, or in the "TRANSFER" input form you can choose "\->255" for the "Xlat:" field. I find it much easier to read or edit that way; pure ASCII text, and you can use copy and paste from a text editor to a Forum message (and vice versa) without having to mess around with non-ASCII characters. I don't believe the 49G guides include the Kermit translations, but they should be on page 27-16 of the HP 48G Series User's Guide; if you don't have it, you can download a scanned PDF copy from hpcalc.org; see http://www.hpcalc.org/details.php?id=3937. In the forum you can use the preformatted text option (see http://www.hpmuseum.org/artfmt.htm for details) to avoid things like unwanted newlines after a hyphen.

Personally, I like to add the information from the BYTES command so that anyone who copies a program can verify that he got it exactly right.

Note that there's a lot of information about these calculators at http://www.hpcalc.org/, and most of the information about the 48 series (and even the 28 series) also applies to the 49G.

Also note that the usenet newsgroup comp.sys.hp48 rather specializes in the 28 series, 48 series, 38G, 39G, 40G, and 49G calculators. You can search the newsgroup archive at http://groups.google.com/advanced_group_search?group=comp.sys.hp48, which can be customized to you preferences by using http://www.google.com/help/customize.html. But GOOGLE only updates a few times a day, so if you wish to participate it's better to use a different server. If your ISP doesn't provide a usenet server, then I recommend http://www.mailgate.org/index.html for a free web-based server, or after you've signed up at mailgate, you can use your own newsreader and the newsreader.mailgate.org server. This Forum is great, but the Museum seems to specialize in out-of-production models; I hope that not all of these calculators will "qualify" for the museum anytime soon.

For your EN1 program, note that DUP DUP DUP can be replaced by DUPDUP DUP, DUP DUPDUP, or (I believe very slightly faster) DUP DUP2. The sequence 3. DROP seems particularly pointless. The 49G command NIP can replace SWAP DROP. I haven't figure out why they named it NIP; maybe it makes sense in French. In general, don't put more copies of anything on the stack than you'll actually use, that way it will be easier to keep track of what's actually on the stack, the program will run faster, and you won't have to go to the trouble of discarding unneeded copies later.

If you want to do statistical analysis, the 49G has lots of commands for that, but they do require that the data is in the form of a matrix stored in '\GSDAT', so as long as you only want the minimum and average, it's probably just as easy to stick to using lists.

As a replacement for:

%%HP: T(3)A(R)F(.);
@ Checksum: # 7F0Eh
@ Bytes: 104.5
\<<
  DUP DUP DUP SORT HEAD SWAP \GSLIST
  3. ROLL SIZE / 3. DROP 4. PICK 4. PICK
  SWAP 4. PICK 4. PICK 4. \->LIST
  REVLIST SWAP DROP SWAP DROP SWAP DROP
  SWAP DROP
\>>
I'd suggest:
%%HP: T(3)A(R)F(.);
@ Checksum: # EF5Fh
@ Bytes: 54.
\<<
  DUP \GSLIST OVER SIZE / OVER SORT HEAD
  4. ROLL 4. ROLL 4. \->LIST
\>>
Much smaller, and I'd bet faster, although it's hard to get anything done in a nanosecond when using a 4MHz processor.

Regarding "carriage return" characters, yes, I think that you want character 10. I believe that the calculator manual refers to it as "newline", but in ASCII it's called "Line Feed" or "LF". I'll use the HP Kermit "backslash" translation "\010". The ASCII "Carriage Return" or "CR" is character 13. Note that when you transfer a string in HP Kermit ASCII translation mode 1, 2, or 3, "\010" is translated to "\010\013", which is expected as an "End-Of-Line" marker for text files in the MS DOS/Windows world.

Anyway, I'll guess that the best thing for you to do is replace every space character in your string with a "newline" character, even though that may give you a few more newlines than you really need. You could loop through the string looking for every occurrence of " " and using REPL to replace it with "\010", like this:

%%HP: T(3)A(R)F(.);
@ Checksum: # B40Bh
@ Bytes: 47.
\<<
  WHILE
    DUP " " POS DUP
  REPEAT
    "\010" REPL
  END
  DROP
\>>
but the 49G provides the faster, shorter, and easier SREPL command specifically for this task. Try:
%%HP: T(3)A(R)F(.);
@ Checksum: # 179Fh
@ Bytes: 30.
\<<
  " " "\010" SREPL DROP
\>>
If you also want to get rid of the "{ " and " }" delimiters, you can use:
%%HP: T(3)A(R)F(.);
@ Checksum: # A0B7h
@ Bytes: 70.
\<<
  "{ " "" SREPL DROP
  " }" "" SREPL DROP
  " " "\010" SREPL DROP
\>>
Regards,
James
                  
Re: HP49 Printing
Message #7 Posted by James M. Prange on 20 July 2002, 10:49 p.m.,
in response to message #6 by James M. Prange

PS:

If you're trying to key this stuff in directly on a calculator instead of downloading it, don't key in the "backslash translations" literally; translate them first. That is, for "\->" use ALPHA RightShift right-arrow (above the 0 key). For "\GS", if you're not already in program entry mode ("PRG" at the upper right of the display), then do RightShift ENTRY (above the ALPHA key), and when in program entry mode use RightShift SIGMA (above the S key), and then backspace to get rid of the extraneous space character. For "\010", use RightShift newline (above the . key).

Regarding Google, you can also just browse the newsgroup at http://groups.google.com/groups?q=comp.sys.hp48.

                        
Re: HP49 Printing
Message #8 Posted by Mike Neu on 21 July 2002, 6:31 a.m.,
in response to message #7 by James M. Prange

James Thank you for your help, and the hyperlink to Google. Mike


[ Return to Index | Top of Index ]

Go back to the main exhibit hall