$regfile = "m1284pdef.dat" 'Set the AVR to use.
$crystal = 20000000 'Set the AVR clock.
'
$hwstack = 40 'Set the capacity of the hardware stack.
$swstack = 40 'Set the capacity of the software stack.
$framesize = 40 'Set the capacity of the frame area.
$baud = 115200
'First we define that we use a graphic LCD
'Config Graphlcd = 128x64sed , Dataport = Porta , Controlport = Portc , Ce = 2 , Ce2 = 3 , Cd = 7 , Rd = 6 , Reset = 4 , Enable = 5
Config Graphlcd = 240x64 , Dataport = Porta , Controlport = Portc , Ce = 5 , Cd = 6 , Wr = 3 , Rd = 4 , Reset = 7 , Fs = 2 , Mode = 6
'The dataport is the portname that is connected to the data lines of the LCD
'The controlport is the portname which pins are used to control the lcd
'CE =CS1 Chip select
'CE2=CS2 Chip select second chip
'CD=Data/instruction
'RD=Read
'RESET = reset
'ENABLE= Chip Enable
Const Black = &B00000000
Dim Bars As Word
Dim Xpos As Byte '0 at left 122/234 the far right for 6 pixel setting 120/232 8 pixel
Dim Ypos As Byte '0 at top 56 the bottom 8 pixel only vertical
Dim Barhigh As Byte 'number of characters high
Dim Maxsteps As Byte
Dim X As Byte
Dim Y As Byte
Declare Sub Battbar(byval L As Byte , Byval C As Byte , Byval S As Byte , Byval N As Byte , Byval B As Byte)
Config Portd.6 = Output 'flashing led
Do
'Note you need to clear the screen at each update and rewrite it again
Cls
Battbar 6 , 9 , 7 , 2 , 0 'line 6 , character 9 , 7 high , number of bars 2
Wait 1
Cls
Battbar 6 , 9 , 7 , 4 , 0 'line 6 , character 9 , 7 high , number of bars 4
Wait 1
Cls
Battbar 6 , 9 , 7 , 3 , 0 'line 6 , character 9 , 7 high , number of bars 3
Wait 1
Cls
Battbar 6 , 9 , 7 , 5 , 0 'line 6 , character 9 , 7 high , number of bars 5
Wait 3
Cls
Battbar 7 , 3 , 7 , 4 , 0 'line 7 , character 3 , 7 high , number of bars 4
Battbar 6 , 9 , 6 , 4 , 0 'line 6 , character 9 , 6 high , number of bars 4
Battbar 6 , 14 , 5 , 3 , 0 'line 6 , character 14 , 5 high , number of bars 3
Wait 5
'now a bar graph chart mixer display
Cls
Battbar 7 , 2 , 7 , 4 , 1
Battbar 7 , 4 , 7 , 6 , 1
Battbar 7 , 6 , 7 , 3 , 1
Battbar 7 , 8 , 7 , 2 , 1
Battbar 7 , 10 , 7 , 6 , 1
Battbar 7 , 12 , 7 , 1 , 1
Battbar 7 , 14 , 7 , 5 , 1
Battbar 7 , 16 , 7 , 3 , 1
Battbar 7 , 18 , 7 , 4 , 1
Wait 5
Loop
End
Sub Battbar(byval L As Byte , Byval C As Byte , Byval S As Byte , Byval N As Byte , Byval B As Byte)
Local W As Byte
'6 pixel setting
Xpos = C * 6 '15 characters
Ypos = L * 8 'bottom of display
Maxsteps = S + 1
Barhigh = Maxsteps * 8
Barhigh = 64 - Barhigh
Y = Ypos + 8
For W = 1 To N
Showpic Xpos , Ypos , Vs8bar
Ypos = Ypos - 8
If B = 0 Then
Box(xpos -2 , Y) -(xpos + 9 , Barhigh ) , 255
End If
Next
End Sub
Vs8bar:
$bgf "VS8bar.bgf"
|