My improvement of the help example of " Swordfish".
A procedure " Baragraph" Parameterized and now easy to use:
Parameters:
1) Y (ordered).
2) X (X-coordinate).
3) Resolution = Many columns.
4) Value max for Complete Bargraph.
5) Value Sent.
Merry programming .....
-------------> The declaration and Two Mains :
Const CGRAM(32) As Byte = ($00,$00,$00,$00,$00,$00,$00,$00, // base bar
$10,$10,$10,$10,$10,$10,$10,$00, // 8 x %10000 = |
$14,$14,$14,$14,$14,$14,$14,$00, // 8 x %10100 = ||
$15,$15,$15,$15,$15,$15,$15,$00) // 8 x %10101 = ||
NoInline Sub Rep(pValue, pRepValue As Byte)
Dim Index As Byte
Index = 0
While Index < pRepValue
LCD.Write(pValue)
Inc(Index)
Wend
End Sub
// display the bar...
NoInline Sub Bargraph(pLine,xLine,Max_Col_BarGraph As Byte,Max_Val_BarGraph As Word ,Bar_Value As Word)
Dim Div_Reste_Vl as word
Dim pBarValue As word
Dim BAR_WIDTH As Byte
Dim MAX_BAR_COUNT As Word
Const BASE_BAR = 0
Const FULL_BAR = 3
Dim NumberOfBars As Byte
Dim Balance As Byte
Dim BalanceChar As Byte
BAR_WIDTH = Max_Col_BarGraph
MAX_BAR_COUNT = BAR_WIDTH * FULL_BAR
pBarValue = (float(Bar_Value) / float(Max_Val_BarGraph)) * MAX_BAR_COUNT
NumberOfBars = pBarValue / FULL_BAR
Balance = pBarValue Mod FULL_BAR
MoveCursor(pLine,xLine)
Rep(FULL_BAR,NumberOfBars)
Write(Balance)
Rep(BASE_BAR,BAR_WIDTH - (NumberOfBars + Min(Balance,1)))
End Sub
BARGRAPH improvement.Now Easy To use every Where.........
Moderators: David Barker, Jerry Messina
BARGRAPH improvement.Now Easy To use every Where.........
My first interest is working with a PWM signal.
Motor : 24 Volts 4 or 5 A.
Motor : 24 Volts 4 or 5 A.
Forget the Invert Function !
HEllo !
To get a DESC Bargraph Function, you just have to add at the last Parameter : MaxValue - Value sent.
For Example : Bargraph(2,1,19,Max_List,Max_List-Its)
To get a DESC Bargraph Function, you just have to add at the last Parameter : MaxValue - Value sent.
For Example : Bargraph(2,1,19,Max_List,Max_List-Its)
My first interest is working with a PWM signal.
Motor : 24 Volts 4 or 5 A.
Motor : 24 Volts 4 or 5 A.