aren't characters in a 5x7 Matrix arranged ???

Originally Posted by
Darrel Taylor
Hi vbcoder,
You're welcome.
There are 3 bars per character, so you can get 48 per line on a 2x16.
<br>
Hi, Darrel
I know it's YOUR Bargraph example ... but 5 bars can be used with "general programming" ...
May be a Typo from yours ???
Translated and modified from a Stamp application :
' This program generates a horizontal bargraph
' with a 2x16 Intelligent LCD Display HD 44780 / KS 0062.
DEFINE OSC 20
DEFINE LCD_EBIT 1
Led var Portb.5
Scale var Portb.2
' ** Variables **
BarVal Var Word ' Value to be graphed.
Bars Var Byte ' Number of full |||/||||| bars to draw.
Balance Var Byte ' Balance left after all |||/|||||s are drawn.
Padding Var Byte ' Number of spaces to fill width.
Balf Var Byte ' Is a 'Balance' character needed? (1=yes, 0=no).
Temp Var Byte
Fullbar Var Byte
Maxbar Var Byte
' ** Constants **
BWdth Con 16
Basebar Con 0 ' ASCII value of 0 bar (blank).
IF NOT Scale THEN
Fullbar = 3
ELSE
Fullbar = 5
ENDIF
Maxbar = BWdth*Fullbar ' Max bar counts.
' Transfer the bit patterns that make up the bars into the LCD's CGRAM.
' The vertical bars are made up of 8 identical bit patterns
' A | bar consists of 0, 5 times $10, 0
' A || bar consists of 0, 5 times $14, 0
' A ||| bar consists of 0, 5 times $15, 0
' We repeat each pattern 8 times.
IF Fullbar = 3 THEN
Lcdout $FE,64,0,0,0,0,0,0,0,0 'Motif 0
Lcdout $0,$10,$10,$10,$10,$10,$10,$0 'Motif 1
Lcdout $0,$14,$14,$14,$14,$14,$14,$0 'Motif 2
Lcdout $0,$15,$15,$15,$15,$15,$15,$0 'Motif 3
ELSE
Lcdout $FE,64,0,0,0,0,0,0,0,0 'Motif 0
Lcdout $0,$10,$10,$10,$10,$10,$10,$0 'Motif 1
Lcdout $0,$18,$18,$18,$18,$18,$18,$0 'Motif 2
Lcdout $0,$1C,$1C,$1C,$1C,$1C,$1C,$0 'Motif 3
Lcdout $0,$1E,$1E,$1E,$1E,$1E,$1E,$0 'Motif 4
Lcdout $0,$1F,$1F,$1F,$1F,$1F,$1F,$0 'Motif 5
ENDIF
Goto OverBargraph
' The value in 'Bar_Val' is displayed as a horizontal bar graph
' from the current cursor location with a total width (in characters) set by the WIDTH constant.
' Each character position can represent a maximum value of 3/5 using the Fullbar character |||.
' The routine calculates how many full bars to use by dividing by 3/5.
' If there is a remainder after dividing by 3/5, the routine joins on a partial-bar character
' ( | or || or ||| or |||| or ||||| ) to represent the balance.
' Then it pads out the remainder of the bar width with spaces to erase any leftover bars
Bargraph:
Bars = (BarVal min MaxBar) / Fullbar ' One full bar for each 3/5 graph units.
Balance = (BarVal min Maxbar) //Fullbar ' Balance is the remainder after a division by 3/5.
Balf = Balance min 1
Padding = BWdth - (Bars + Balf) ' Number of spaces to fill bar width.
LCDOut Rep Fullbar\Bars,Rep (Balance + Basebar)\Balf,Rep " " \Padding
Return
OverBargraph:
For BarVal = 0 to Maxbar
Lcdout $FE,$80
Gosub Bargraph
Lcdout $FE, $C0, #BarVal," "
Pause 300
Next BarVal
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks