Hi Joep,

Print procedures with variable length (3 or 5 digits) are not formated with
leader.
Once the procedure is used with LCD for example, where the LCD position of
the first digit is fixed by program,
 when jumps from 3 to 2 digit, it change the digit position, changing also
the meaning of the displayed value.

I know this is fixed somehow in format library, but...the format procedures
have more parameters to write
(and some weak beahaviour like printing an sword of 5 chars from which 1 is
after the decimal point and if
the first one is never used is still allocate as a blank on the LCD).
Maybe merging the old jprint procedures from jal04 with V2 print library
will be a good ideea.

Vasile

Example:

 adc_low_res_AN5 (encoder_val) ; read encoder as 8 bit
  lcd_cursor_blink_display (0,0,1) ; turn off cursor
  lcd_cursor_position(1,16)  -- line2 poz16
  print_byte_dec ( LCD, encoder_val)


when ADC measurement is below 100, will display
990 instead of 099


The old print_decimal_3 is better from this perspective:

adc_low_res_AN5 (encoder_val) ; read encoder as 8 bit
 lcd_cursor_blink_display (0,0,1) ; turn off cursor
 lcd_cursor_position(1,16)  -- line2 poz16
print_decimal_3 (lcd, encoder_val, "0" )


-- print a value as in 3 decimal positions
procedure print_decimal_3(
   byte volatile out target,
   byte in x,
   byte in leader = "0"
) is
   _print_base( target, x / 100 , leader )
   x = x % 100
   _print_base( target, x / 10, leader )
   leader = "0" ; without this line printing a 0 will be " " instead of "0"
   x = x % 10
   _print_base( target, x , leader )
end procedure

-- print a value as in 3 decimal positions with comma xx.x
procedure print_decimal_xx_x(
   byte volatile out target,
   byte in x,
   byte in leader = "0"
) is
   _print_base( target, x/100 , leader )
   x = x % 100
   _print_base( target, x / 10, leader )
   leader = "."
   _print_base( target, 0 , leader )
   leader = "0"
   x = x % 10
   _print_base( target, x , leader )
end procedure

-- print a value as in 3 decimal positions with comma x.xx
procedure print_decimal_x_xx(
   byte volatile out target,
   byte in x,
   byte in leader = "0"
) is
   _print_base( target, x/100 , leader )
   leader = "."
   _print_base( target, 0 , leader )
   leader = "0"
   x = x % 100
   _print_base( target, x / 10, leader )
   x = x % 10
   _print_base( target, x , leader )
end procedure

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to