The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

WP 34S adding own conversions
Message #1 Posted by Lourensk on 23 Mar 2012, 9:17 a.m.

Dear All,

Working in a electronics testlab i use a lot of conversions like: Log <-> Linear Voltage, Log<->Linear Power and RF related, Field Strength & Power Density conversions.

I examined the source code and tried to add a dBuv <-> Volts conversion to both compile_cats.c and compile_consts.c

This works fine but i only see the dB part dBuV in the display, is seems only two characters are permitted in the left part of the conversion.

Next challenge is to get a short calculation like: V=10^((dBuV-120)/20) called when executing this conversion..

I used to make short programs for each conversion, but it would be nice to have them under the conversions in the WP 34S.

To get more room in the upper graphical screen i removed at line 1395 of display.c "\177\006\006" now the up down arrows are gone..

Some ideas to get this realized ??

Best regards, Lourens.

      
Re: WP 34S adding own conversions
Message #2 Posted by Dominic Richens on 23 Mar 2012, 10:09 a.m.,
in response to message #1 by Lourensk

I pondered the same thing a month ago, but I found it didn't make sense to add the conversions I wanted for a couple of reasons:

  1. for quick conversions I don't want to press the extra keys so I preferred to write a set of routines and have them called from A,B,C,D so it's one key press. Plus it meant I could tailor it for my needs (e.g. print out 1530.33 instead of 1.53033E-7)
  2. for calling from other programs, it's just as convenient to have my own conversion program routines in the massive flash space.

Generally from a design perspective W&P avoid adding conversions that are just specializations or combinations of existing conversions.

      
Re: WP 34S adding own conversions
Message #3 Posted by Paul Dale on 23 Mar 2012, 6:06 p.m.,
in response to message #1 by Lourensk

Conversions that are simply a scale factor can be added to compile_cats.c and compile_consts.c You have to add the conversion twice to compile_cats.c (once for each direction) so you were close. These conversions have a two character limit on the left side in the definition and six (I think) on the right. This is hard coded but the arrow in the middle is free.

To add a conversion that isn't a simple multiplication or division, things get a lot more involved. You have to add a (presumably) monadic function or two. The new function IDs got in xeq.h, the function itself can live anywhere that seems sensible & the appropriate header file also needs a prototype line. Then you'll have to add the definitions to commands.c and finally put the extra catalogue entries in compile_cats.c. Not exactly for the faint of heart :-) Probably the easiest would be to follow one of the existing weird conversions e.g. one of the temperature conversion routines (OP_DEGC_F & convC2F). Oh, conversions done this way have a six character hard limit for their name (no free arrow).

As for that line in display.c, we added the up/down arrows on the left to make it completely clear you were in a catalogue and the extra pixels they consumed didn't seem to impact anything -- relatively few catalogue entries drop to the smaller font. Each to their own of course.

- Pauli

            
Re: WP 34S adding own conversions
Message #4 Posted by Lourensk on 24 Mar 2012, 2:37 p.m.,
in response to message #3 by Paul Dale

Hi Pauli,

Thanks for all the information.

I totaly overlooked excisting Ar to dB conversion now i understand how to add my own!

Thanks!

                  
Re: WP 34S adding own conversions
Message #5 Posted by Walter B on 24 Mar 2012, 2:45 p.m.,
in response to message #4 by Lourensk

And there also exists a power ratio to dB conversion :-) Just for your information ...


[ Return to Index | Top of Index ]

Go back to the main exhibit hall