This bargraph is not near as slick as the one by Darrel.
My graph displays 128 levels using 16 character LCD
This bargraph uses 8 user defined characters that are downloaded first.
There are 16 characters each subdivided into 1/8. 16X8=128
I needed to display an 8 bit value but I could not so I divided the value by 2 and displayed a 7 bit number.
Here are the working parts:
Attached is the entire project but below is the working parts for the graph.
rons.
*******************************
'hardware
'microChip used 16F873
' 4k ROM
'192 RAM
'128 EEPROM
DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_BITS 8 '8 bit mode
DEFINE LCD_RSREG PORTC 'RS port
DEFINE LCD_RSBIT 2 'RS bit
DEFINE LCD_EREG PORTC 'E port
DEFINE LCD_EBIT 0 'E bit
DEFINE LCD_RWREG PORTC 'R/W port
DEFINE LCD_RWBIT 1 'R/W bit
DEFINE LCD_LINES 2 'lines
LCD_rs var portc.1
'EEPROM tables graphic downloaded to LCD
DATA @ 0 , %00000000
DATA @ 1 , %00000000
DATA @ 2 , %00000000
DATA @ 3 , %00000000
DATA @ 4 , %00000000
DATA @ 5 , %00000000
DATA @ 6 , %00000000
DATA @ 7 , %00000000
DATA @ 8 , %00000000
DATA @ 9 , %00000000
DATA @10 , %00000000
DATA @11 , %00010000
DATA @12 , %00010000
DATA @13 , %00010000
DATA @14 , %00010000
DATA @15 , %00010000
DATA @16 , %00010000
DATA @17 , %00010000
DATA @18 , %00010000
DATA @19 , %00010000
DATA @20 , %00010000
DATA @21 , %00010000
DATA @22 , %00010000
DATA @23 , %00010000
DATA @24 , %00010000
DATA @25 , %00011000
DATA @26 , %00011000
DATA @27 , %00011000
DATA @28 , %00011000
DATA @29 , %00011000
DATA @30 , %00011000
DATA @31 , %00011000
DATA @32 , %00011000
DATA @33 , %00011000
DATA @34 , %00011000
DATA @35 , %00011000
DATA @36 , %00011100
DATA @37 , %00011100
DATA @38 , %00011100
DATA @39 , %00011100
DATA @40 , %00011100
DATA @41 , %00011100
DATA @42 , %00011100
DATA @43 , %00011100
DATA @44 , %00011100
DATA @45 , %00011100
DATA @46 , %00011100
DATA @47 , %00011110
DATA @48 , %00011100
DATA @49 , %00011100
DATA @50 , %00011110
DATA @51 , %00011110
DATA @52 , %00011110
DATA @53 , %00011110
DATA @54 , %00011110
DATA @55 , %00011110
DATA @56 , %00011110
DATA @57 , %00011110
DATA @58 , %00011110
DATA @59 , %00011110
DATA @60 , %00011110
DATA @61 , %00011111
DATA @62 , %00011111
DATA @63 , %00011111
LCD_rs=0
ADCON1 = 7 'PIC16F87X PORTa ANALOG OFF DIGITAL ON
start: pause 500 'wait for LCD to startup
lcdout $fe, $40 'set CG address to 0
for i = 0 to 63 'down load CGtable
read i,j
lcdout j
next i
lcdout $fe,1 'clear LCD screen
pause 100
error1:
lcdout $fe,$10,$fe,$10,hex DATA_ 'hex data
'LCD has only 8 user defignable char. so: 1/2
lcdout $fe,2 'home LCD
DATA_ = Data_ / 2 ' 1/2 make 8 bit value 7 bit value
j = DATA_ & $07 'ger 3 bits
for i = 8 to 128 step 8
if DATA_ >= i then 'bargraph
lcdout $ff 'Write black characters to make bar
else
lcdout j 'output one of 8 downloaded characters
j = " " 'next pass output blank characters
endif
next i
GOTO loop
*******************************
Originally Posted by DynamoBen
Bookmarks