LCD Bargraph with different styles: Unterschied zwischen den Versionen

Aus ProjectWiki
Wechseln zu:Navigation, Suche
(Created page with "== How to use it == In the top of your main program, just add these lines: Const Lcd_bar_style = 1 $include "..\inc\lcd_bar.bas" To draw the Bargraph on the LCD: Locat...")
 
Zeile 2: Zeile 2:
  
 
In the top of your main program, just add these lines:
 
In the top of your main program, just add these lines:
   Const Lcd_bar_style = 1
+
   Const Lcd_bar_style = [Style]
   $include "..\inc\lcd_bar.bas"
+
   $include "lcd_bar.bas"
  
 
To draw the Bargraph on the LCD:
 
To draw the Bargraph on the LCD:
 
   Locate [x] , [y]
 
   Locate [x] , [y]
 
   Lcd_bar [value] , [x-size]
 
   Lcd_bar [value] , [x-size]
 +
  
 
== Sample ==
 
== Sample ==
  
 
Main File:
 
Main File:
  $regfile = "m32def.dat"
+
<pre>
  $crystal = 16000000
+
$regfile = "m32def.dat"
 +
$crystal = 16000000
 +
$hwstack = 32
 +
$swstack = 16
 +
$framesize = 32
  
  $hwstack = 32
+
$sim
  $swstack = 16
 
  $framesize = 32
 
  
  $sim
+
Config Lcd = 16 * 2
 +
Const Lcd_bar_style = 1
 +
$include "..\inc\lcd_bar.bas"
  
  Config Lcd = 16 * 2
+
Dim Value As Byte
  
   Const Lcd_bar_style = 1
+
Cls
   $include "..\inc\lcd_bar.bas"
+
Do
 +
   Locate 1 , 1
 +
   Lcd_bar Value , 5
  
   Dim Value As Byte
+
   Value = Value + 1
 +
  If Value = 101 Then Value = 0
  
   Cls
+
   'Waitms 50
 +
Loop
 +
End
 +
</pre>
  
  Do
+
This simply draws a bar at the position [1, 1] and sweeps from 0-100%.
      Locate 1 , 1
 
      Lcd_bar Value , 5
 
      Value = Value + 2
 
      If Value = 102 Then Value = 0
 
      'Waitms 50
 
  Loop
 
  
This simply draws a bar at the position 1, 1 and sweeps from 0-100%.
 
  
 
== What it looks like ==
 
== What it looks like ==
 +
 +
* Const Lcd_bar_style = 0
 +
 +
* Const Lcd_bar_style = 1
 +
 +
* Const Lcd_bar_style = 2
 +
 +
* Const Lcd_bar_style = 3
 +
 +
* Const Lcd_bar_style = 4
 +
 +
 +
== Download ==

Version vom 31. Mai 2011, 02:22 Uhr

How to use it

In the top of your main program, just add these lines:

  Const Lcd_bar_style = [Style]
  $include "lcd_bar.bas"

To draw the Bargraph on the LCD:

  Locate [x] , [y]
  Lcd_bar [value] , [x-size]


Sample

Main File:

$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 16
$framesize = 32

$sim

Config Lcd = 16 * 2
Const Lcd_bar_style = 1
$include "..\inc\lcd_bar.bas"

Dim Value As Byte

Cls
Do
   Locate 1 , 1
   Lcd_bar Value , 5

   Value = Value + 1
   If Value = 101 Then Value = 0

   'Waitms 50
Loop
End

This simply draws a bar at the position [1, 1] and sweeps from 0-100%.


What it looks like

  • Const Lcd_bar_style = 0
  • Const Lcd_bar_style = 1
  • Const Lcd_bar_style = 2
  • Const Lcd_bar_style = 3
  • Const Lcd_bar_style = 4


Download