Post Reply 
(HP50g) HpPascal and contrast of the screen
10-28-2017, 02:34 PM (This post was last modified: 10-28-2017 11:39 PM by DavidM.)
Post: #16
RE: (HP50g) HpPascal and contrast of the screen
(10-28-2017 01:32 PM)Gilles59 Wrote:  Hummmm, No... Value >15 give a very low contrast ... It looks to works fine only with values between 10-15. Perhaps a difference between the 49-50g and 48 ? Or a problem with the initial Contrast program wich don't works fine ?

As I mentioned before, it appears that the Constraste routine ignores the hi-order bit of the byte you give it, thus only setting the contrast properly for values 0-15. You could easily test this in HP-Pascal by following

Contraste(17);

with:

x := GetContrast;

...and then outputting x in whatever way makes sense. My suspicion is that x will be 1 if you do (contrast MOD 16), which would clearly indicate the problem. To make it easier, you may want to include a Contraste(14) step after the GetContrast call so that you don't have to manually reset it after running the code.

The following may work better for setting the contrast:

Code:
procedure SetContrast(newValue: byte);
begin
   asm
      A=R1 A
      D1=A
      A=DAT1 B
      LC(2) #1F
      A=C&A B
      B=A B
      LC(5) #101
      D1=C
      A=DAT1 B
      LC(2) #E0
      A=C&A B
      A=A+B B
      DAT1=A B
   end;
end;

It masks out the high-order 3 bits of the byte you give it (effectively doing x MOD 32), then adds back in the display bits from i/o location 102 before setting the new contrast value. If I've coded it properly (I can't test it myself Smile), you should also be able to do the previous test successfully with SetContrast/GetContrast to verify it.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (HP50g) HpPascal and contrast of the screen - DavidM - 10-28-2017 02:34 PM



User(s) browsing this thread: 1 Guest(s)