The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

WP 34S: IR plotting (revised)
Message #1 Posted by Marcus von Cube, Germany on 8 June 2012, 11:10 a.m.

I've added some commands to allow graphic output to the HP infrared printer. This is work in progress but a first implementation is available in SVN.

Plotting is done in stripes of 8 pixels height and up to 166 pixels wide, exactly what the printer supports natively. The most recent update allows for rectangular graphic objects. A block of registers is used to store the bit patterns. Building the block and printing it are independent operations which implies that you can build more than one block at a time if you reserve enough registers.

Here are the commands (revised list):

  1. gDIM n - takes the number of columns for this plot block from X and the number of rows from Y. It clears the register block starting at register n (global or local). X and Y are left untouched on the stack. The first byte is reserved to store the configured width, the next byte stores rows=floor((height+7)/8). The number of registers needed is floor((width*rows+9)/8) in single precision (floor((width*rows+17)/16) in DP). A value of zero or a negative value in X sets the width to 166, the paper width. The default height is 8. The command can be exactly emulated in integer mode by storing rows*256+width in the first register and clearing the rest.

  2. gDIM? returns the width to X and the height to Y.

  3. gSET, gCLR, gFLP n - Set, clear or toggle a bit. The row coordinate (0..height-1) is in Y, the column coordinate (0..width-1) is in X. n denotes the register block. X and Y are left untouched. Coordinate (0,0) is top left.

  4. gPIX? n - Same syntax as above. Tests if a pixel is on. It's a standard conditional test, skipping the next instruction if the test fails.

  5. [print]PLOT n - Plots the block in the configured width. If the width is the paper width (166), a LF is printed, otherwise this is left to the user. This makes it possible to mix graphic and any other output. Setting pMODE to 1 (or 2) before printing may increase the printing accuracy because these modes use the alternate LF character 0x04.

If you want the full width of 166 columns, the block needs 21 registers per row (in single precision). The highest possible value for n is 79 in this case as long as you don't use local registers. After a LocR 021 command you can plot with .00 as the register argument. Of course it makes sense to reserve some more local registers for working storage and relocate the plot block just above these. The global registers can take a block of 79x80 (99 registers) or 166x32 (84 registers).

You can define a custom character in a single register by either plotting it (after doing pINIT n with the width in X and 8 in Y), or by simply storing the pattern in a register, with the width in the LSB and 1 in the next byte. This must be done in integer mode, of course. pPLOT n then prints the custom character in n. The width needs to be <= 6 in single precision. Wider characters need more registers (or double precision).

Edited: 10 June 2012, 3:58 a.m. after one or more responses were posted

      
One word
Message #2 Posted by Gene wright on 8 June 2012, 11:19 a.m.,
in response to message #1 by Marcus von Cube, Germany

Incredible

            
Re: One word
Message #3 Posted by Marcus von Cube, Germany on 8 June 2012, 11:37 a.m.,
in response to message #2 by Gene wright

Does it help if I tell you that I did the implementation in a few hours? (I must admit that I had some discussions with Pauli beforehand.)

                  
Re: One word
Message #4 Posted by W. Bruce Maguire II on 8 June 2012, 11:43 a.m.,
in response to message #3 by Marcus von Cube, Germany

You're the man, Marcus!

Thanks,
Bruce.

                  
Re: One word
Message #5 Posted by Paul Dale on 8 June 2012, 6:10 p.m.,
in response to message #3 by Marcus von Cube, Germany

Even then I was surprised by the width field.

- Pauli

      
WOW
Message #6 Posted by Harald on 8 June 2012, 3:55 p.m.,
in response to message #1 by Marcus von Cube, Germany

How do you do this?!? You are adding new features faster then I can try them out! You either don't have to work in your day job, or you have a lot more energy then I do ;)

Thanks for all the work you guys put into the WP34S!!!

Cheers, Harald

            
Re: WOW
Message #7 Posted by Marcus von Cube, Germany on 8 June 2012, 4:18 p.m.,
in response to message #6 by Harald

Just a day (almost) off. I needed a break from ABAP programming. :-)

Now I'd like to see someone using the feature for fun or serious work like chart plotting.

                  
Re: WOW
Message #8 Posted by Chris Tvergard on 8 June 2012, 5:36 p.m.,
in response to message #7 by Marcus von Cube, Germany

Marcus,

I am in dire need of printing/plotting functions like the log-normal, scatter plots with linear regression lines, as well as the underlying equations like y=ax+b. My problem being that I can't find someone to fix me an IR/USB capable WP-34S as I am too fumble fingered and impatient myself. In fact, this morning I got so frustrated that I went back to my 50G just so see how that would work out.

Please continue your developments. IR plotting is especially important to me and others due to the small screen on the 30b.

I need this for serious daily work!

Chris

PS: It would be beneficial if we could I/O Excel data.

                        
Re: WOW
Message #9 Posted by fhub on 8 June 2012, 5:44 p.m.,
in response to message #8 by Chris Tvergard

Quote:
PS: It would be beneficial if we could I/O Excel data.
Yes, and please an internet connection to Mathematica! :-)

Franz

                              
Re: WOW
Message #10 Posted by Chris Tvergard on 8 June 2012, 6:17 p.m.,
in response to message #9 by fhub

Franz,

I second that.

Chris

PS: Unfortunately both of these I/O isues have already been exposed here with little progress in sight -:(

                  
Re: WOW
Message #11 Posted by Paul Dale on 8 June 2012, 6:32 p.m.,
in response to message #7 by Marcus von Cube, Germany

Quote:
Now I'd like to see someone using the feature for fun or serious work like chart plotting.

Chess pieces? Reversi?

A function graphing routine is what kind of kicked this all off -- I was looking to do something akin to PRPLOTP for the library (or maybe even as a built in).

- Pauli

                        
Re: WOW
Message #12 Posted by Chris Tvergard on 8 June 2012, 7:09 p.m.,
in response to message #11 by Paul Dale

Pauli,

I can only speak for myself naturally but a built-in routine which takes say all 100 data regs and plots them in scatter format and superimposes a linear or exponential curve fit on top sounds like magic. (A la Excel.)

Also, if you guys feel bored one day, some form of weigthting functions applied to the 100 data regs so that each point gets less and less weight as time goes back (to R00) would be great; especially if the weights all add up to one, although not required as I can normalize later.

Subsequently I can use the already built-in weighted data standard deviation calculations in the Sigma/Stat registers.

Some avant garde people (hmmm) already use the WP-34S for real job applications although the keys get a little clicky and the LCD loses contrast when used at -30 C (as I was doing pre-flight calculations in an ice brrrr... cold airplane. There are only local dirt roads here so you fly or sit).

Brisbaine sounds nice and warm.

Chris

                              
Re: WOW
Message #13 Posted by Paul Dale on 8 June 2012, 7:48 p.m.,
in response to message #12 by Chris Tvergard

Quote:
I can only speak for myself naturally but a built-in routine which takes say all 100 data regs and plots them in scatter format and superimposes a linear or exponential curve fit on top sounds like magic. (A la Excel.)

Sounds like a perfect application for a keystroke program rather than a built in command :-)

Quote:
Brisbane sounds nice and warm.

It is all relative. We've got a cold wet winter's weekend ahead of us here. Still over forty degrees C warmer than what you mention but it is all what you're used to.

- Pauli

      
B777-300 interfacing
Message #14 Posted by geoff quickfall on 8 June 2012, 7:12 p.m.,
in response to message #1 by Marcus von Cube, Germany

I was wondering if we could interface via the cannon plug on the FMC by Honeywell...

just kidding,

you guys are incredible!!!

            
Re: B777-300 interfacing
Message #15 Posted by BobVA on 9 June 2012, 5:06 p.m.,
in response to message #14 by geoff quickfall

Maybe a draft a change to the HP-67 Bendix TSO ? :-)

Edited: 9 June 2012, 5:11 p.m.

      
Re: WP 34S: IR plotting
Message #16 Posted by Paul Dale on 8 June 2012, 7:49 p.m.,
in response to message #1 by Marcus von Cube, Germany

Latest thought: the same kind of graphical support for the dot matrix portion of the screen :-)

Don't know if it will be workable yet...

- Pauli

            
Re: WP 34S: IR plotting
Message #17 Posted by Chris Tvergard on 8 June 2012, 10:05 p.m.,
in response to message #16 by Paul Dale

Pauli,

I plum forgot you guys are into winter. It's been years I was south of the line where the kitchen sink water exits the wrong (oops) way around. Was it Coriolis who described that Curl first?

Using the LCD for small plots would be great!

I do already have a 150 or so line program which does what I describe, but somehow I have the feeling that the built-ins run faster. And built-ins I don't lose!

Thanks.

Chris

                  
Re: WP 34S: IR plotting
Message #18 Posted by Paul Dale on 8 June 2012, 10:09 p.m.,
in response to message #17 by Chris Tvergard

Built ins don't run faster unless they are coded in C & that certainly wouldn't be the case for something like this.

Quite a bit of the internal 34S functionality is written using keystroke programs & they execute exactly the same as from RAM -- perhaps slower even due to flash wait states but I very much doubt that is noticeable given the other overheads.

- Pauli

                        
Re: WP 34S: IR plotting
Message #19 Posted by Chris Tvergard on 8 June 2012, 10:20 p.m.,
in response to message #18 by Paul Dale

Pauli,

Thanks for the explanation. Is there a publication by the team which describes these kind of details - (pre)compile?

Chris

                              
Re: WP 34S: IR plotting
Message #20 Posted by Paul Dale on 8 June 2012, 10:34 p.m.,
in response to message #19 by Chris Tvergard

Quote:
Is there a publication by the team which describes these kind of details - (pre)compile?

Only the full source code :-)

- Pauli

                                    
Re: WP 34S: IR plotting
Message #21 Posted by Chris Tvergard on 8 June 2012, 10:46 p.m.,
in response to message #20 by Paul Dale

Thanks.

Chris

                  
Re: WP 34S: IR plotting
Message #22 Posted by Paul Dale on 9 June 2012, 2:28 a.m.,
in response to message #17 by Chris Tvergard

Quote:
Using the LCD for small plots would be great!

43 by 6 pixel isn't going to produce plots of any merit. Even a plain sine wave would be borderline.

A progress bar would be possible, as would a very crude histogram. I'm sure someone will come up with something creative to use the capability for.

- Pauli

                        
Re: WP 34S: IR plotting
Message #23 Posted by Chris Tvergard on 9 June 2012, 2:57 a.m.,
in response to message #22 by Paul Dale

Pauli,

This is interesting. I am communicating with Walter by e-mail just now, and now you too - small world.

In my prior entry I did actually ask you about the resolution, but I erased it as I did not want any negative vibes to discourage any "nova" in its infancy.

Your point demonstrates exactly why we need advanced IR plotting functions in order to get the WP-34S out of "I/O jail".

Chris

      
Re: WP 34S: IR plotting (revised)
Message #24 Posted by Marcus von Cube, Germany on 9 June 2012, 4:26 p.m.,
in response to message #1 by Marcus von Cube, Germany

Here is an example for the newest set of commands (see revised first post):

/*
 *  Draw a circle
 */
0001 **LBL A
0002 # 64
0003 ENTER[^]
0004 gDIM 00
0005 2
0006 /
0007 STO J
0008 DEG
0009 0
0010 .
0011 3
0012 6
0013 0
0014 0
0015 1
0016 STO I
0017 **LBL 00
0018 RCL I
0019 IP
0020 RCL J
0021 [->]REC
0022 RCL+ J
0023 x[<->] Y
0024 RCL+ J
0025 x[<->] Y
0026 gSET 00
0027 ISG I
0028 GTO 00
0029 CL[alpha]
0030 [alpha]'Cir'
0031 [alpha]'cle'
0032 [print][alpha]+
0033 [print]PLOT 00
0034 [print]ADV
0035 END

Edited: 9 June 2012, 4:42 p.m.

            
Re: WP 34S: IR plotting (revised)
Message #25 Posted by Chris Tvergard on 9 June 2012, 8:41 p.m.,
in response to message #24 by Marcus von Cube, Germany

Marcus,

Can you do that with the normal density function and gray the area between s.dev = +-1 (i.e. the 68%)?

It's beginning to look real interesting!

Chris

                  
Re: WP 34S: IR plotting (revised)
Message #26 Posted by Marcus von Cube, Germany on 10 June 2012, 2:40 a.m.,
in response to message #25 by Chris Tvergard

YOU should be able to do that with the most recent release.

                        
Re: WP 34S: IR plotting (revised)
Message #27 Posted by Chris Tvergard on 10 June 2012, 3:06 a.m.,
in response to message #26 by Marcus von Cube, Germany

Marcus,

I would gladly do so, if it were not from the fact that I haven't been able to find anyone who wants to fix me a new 34S with IR & USB. Until then, my crystal - one month old or so but now antique - WP-34S remains suspended without flash animation in I/O isolation not getting any smarter by the day, unlike yours!

But I salivate at getting my hands on the plotting capabilities you are now developing with apparent ease thus promising more advanced functionality in the near future. You three guys et.al. are doing it again! Thanks.

Chris

PS: I think we need for someone highly capable like Eric to get out of the bush. I've tried to beam out Pink Floyd's "Is there anybody out there?" but no matter how high I do the decibels silencium is still king.

PS2: Just as the Australian-German window of world time sat. comm. is opening up it's time for we in the middle to recover from prolonged WP-34S induced sleep deprivation. Adios Amigas, Au-revour, Guten Aben, Nite-nite.

Edited: 10 June 2012, 1:37 p.m. after one or more responses were posted

                              
Re: WP 34S: IR plotting (revised)
Message #28 Posted by Marcus von Cube, Germany on 10 June 2012, 3:47 a.m.,
in response to message #27 by Chris Tvergard

Chris, I do all my development on the PC. My device has sent some data to the printer but more out of curiosity and debugging the hardware side of things. All higher level programming can be easily done on the emulator.

                                    
Re: WP 34S: IR plotting (revised)
Message #29 Posted by Chris Tvergard on 10 June 2012, 10:03 a.m.,
in response to message #28 by Marcus von Cube, Germany

Marcus,

I did download the serial port monitor program from the web, as indicated by you in an earlier thread. However, it seems to be built stronger than Fort Knox, as there is no way it will let me do anything due lack of credentials. I've done everything as admin, everywhere, so I gave up on communicating between the unit and the PC via my serial cable. As stated earlier, flashing works flawlessly, but I cannot establish two-way data comm.

Working on my PC is not as interesting as the real thing, although I should perhaps consider that. But with no IR and no serial comm. nothing moves thru my I/O for real. I do understand why you do your developments on your PC, but without the print roll actually moving so I can superimpose two paper strips over each other and hold them against the light, I have little use for it all in my work. I need to see how my scatter plots overlay the theoretical distributions.

Thanks for your response and for your exciting printing work.

Chris

                              
Re: WP 34S: IR plotting (revised)
Message #30 Posted by Harald on 10 June 2012, 4:46 p.m.,
in response to message #27 by Chris Tvergard

As I said, I could do the soldering for you. But shipping to Germany and back is not cheap nor fast.

                                    
Re: WP 34S: IR plotting (revised)
Message #31 Posted by Chris Tvergard on 10 June 2012, 5:33 p.m.,
in response to message #30 by Harald

Harald,

That is very kind of you to offer. But, as you say, sending stuff through customs two-way is costly. I do appreciate your concern very much.

Thanks.

Chris

                                          
Re: WP 34S: IR plotting (revised)
Message #32 Posted by Walter B on 10 June 2012, 10:05 p.m.,
in response to message #31 by Chris Tvergard

Chris, the value of these items is quite low, so customs will not bother probably. Postages and transport times may be more important.

                                                
Re: WP 34S: IR plotting (revised)
Message #33 Posted by Chris Tvergard on 10 June 2012, 11:32 p.m.,
in response to message #32 by Walter B

Walter,

It certainly is a possibility. But Harald's most generous offer may quickly lead to a situation where many others would like the same. Hundreds perhaps. From what I understand quite a number of serial cables have been sold.

Chris

Edited: 11 June 2012, 1:36 a.m.

      
Re: WP 34S: IR plotting (revised)
Message #34 Posted by fhub on 12 June 2012, 12:05 p.m.,
in response to message #1 by Marcus von Cube, Germany

A short remark for Walter:

On the last page of the manual (in the history of changes) there are still wrong names for the new plot functions: CPIX, SPIX, FPIX, etc. ...

Franz

            
Re: WP 34S: IR plotting (revised)
Message #35 Posted by Walter B on 12 June 2012, 2:53 p.m.,
in response to message #34 by fhub

Thanks, Franz, for crosschecking :-) Will be corrected in next update.

                  
Re: WP 34S: IR plotting (revised)
Message #36 Posted by fhub on 12 June 2012, 4:08 p.m.,
in response to message #35 by Walter B

Quote:
Thanks, Franz, for crosschecking :-) Will be corrected in next update.
Yes, not necessary to update it for just such a tiny mistake.

More important is that these names haven't made it into the builds, the current tokens with gXXX are much better (for a few reasons)!

I guess _you_ would have preferred SPIX/CPIX/FPIX/etc., right?
How else should these 'strange' names have appeared in the manual, when they never were in any build!? ;-)

Franz

                        
Re: WP 34S: IR plotting (revised)
Message #37 Posted by Marcus von Cube, Germany on 12 June 2012, 4:39 p.m.,
in response to message #36 by fhub

I didn't obey. ;-)

                              
Re: WP 34S: IR plotting (revised)
Message #38 Posted by fhub on 12 June 2012, 4:51 p.m.,
in response to message #37 by Marcus von Cube, Germany

Quote:
I didn't obey. ;-)
And that was good so! :-)

I was already afraid that Walter would use his usual method (as he did it with moving many commands to the 'experts' catalog): strictly writing _his_ preferences in the manual until you and Pauli finally give up your resistance. ;-)

                                    
Re: WP 34S: IR plotting (revised)
Message #39 Posted by Walter B on 12 June 2012, 5:17 p.m.,
in response to message #38 by fhub

I'm afraid your picture of our internal collaboration is far off the truth. But I don't want to destroy your "Feindbild" if it makes you happy ;-)

                                          
Re: WP 34S: IR plotting (revised)
Message #40 Posted by fhub on 12 June 2012, 5:36 p.m.,
in response to message #39 by Walter B

Quote:
But I don't want to destroy your "Feindbild" if it makes you happy ;-)
That has nothing to do with a "Feindbild", what I described are just facts.
You do remember the situation with BACK/SKIP, don't you?
                                                
Re: WP 34S: IR plotting (revised)
Message #41 Posted by Walter B on 13 June 2012, 1:34 a.m.,
in response to message #40 by fhub

Don't confuse facts and opinions. Sometimes, even better ideas win in discussions ;-)

                        
Re: WP 34S: IR plotting (revised)
Message #42 Posted by Walter B on 12 June 2012, 5:13 p.m.,
in response to message #36 by fhub

Quote:
I guess _you_ would have preferred SPIX/CPIX/FPIX/etc., right? How else should these 'strange' names have appeared in the manual, when they never were in any build!?
I'm afraid you're wrong. I could show you the respective mails - but I don't like to. Internal stuff is not communicated to Austria. Bad luck ;-)


[ Return to Index | Top of Index ]

Go back to the main exhibit hall