WP 34S: IR plotting (revised)


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

  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




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.)


You're the man, Marcus!




Even then I was surprised by the width field.

- Pauli


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!!!



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.



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!


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


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

Yes, and please an internet connection to Mathematica! :-)




I second that.


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


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



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.



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 :-)

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


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

just kidding,

you guys are incredible!!!


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

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


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



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!




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



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



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

Only the full source code :-)

- Pauli





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



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".



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.



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!



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



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.


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


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.



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.



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



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.




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



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.


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


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. ...



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


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!? ;-)



I didn't obey. ;-)


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. ;-)


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 ;-)


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?


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


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 ;-)

Possibly Related Threads...
Thread Author Replies Views Last Post
  [WP-34S] Unfortunate key damage with update to V3 :( svisvanatha 5 1,341 12-10-2013, 11:37 PM
Last Post: Les Bell
  WP-34S (Emulator Program Load/Save) Barry Mead 1 747 12-09-2013, 05:29 PM
Last Post: Marcus von Cube, Germany
  DIY HP 30b WP 34s serial flash/programming cable Richard Wahl 2 1,088 12-04-2013, 11:14 AM
Last Post: Barry Mead
  Help: HP-41CX and IR module Marcel Samek 13 1,945 11-14-2013, 11:00 AM
Last Post: Marcel Samek
  WP 34S/43 ?'s Richard Berler 3 941 11-10-2013, 02:27 AM
Last Post: Walter B
  My FrankenCulator (wp-34s) FORTIN Pascal 4 986 11-09-2013, 06:18 PM
Last Post: FORTIN Pascal
  WP 34S Owner's Handbook Walter B 5 1,252 11-09-2013, 05:34 PM
Last Post: Harald
  wp 34s overlay and programming. FORTIN Pascal 6 1,351 11-08-2013, 01:28 PM
Last Post: Nick_S
  m.dy in display of WP-34S Harold A Climer 3 819 11-05-2013, 11:28 AM
Last Post: Andrew Nikitin
  IR printer failure Andrew Nikitin 7 1,229 11-05-2013, 11:25 AM
Last Post: Andrew Nikitin

Forum Jump: