PDA

View Full Version : LCD + bar graph



DynamoBen
- 7th September 2005, 18:51
Anyone done a bargraph on a character LCD? I want to represent a value in text and bargraph and was looking for the best method to accomplish it.

Roy
- 7th September 2005, 21:21
I saw this a couple of years ago...
www.parallax.com/dl/docs/cols/nv/vol1/col/nv8.pdf

Brgds Roy

DynamoBen
- 7th September 2005, 22:01
Not quite what I was thinking of. I'm hoping for something along the lines of a progress bar.

DynamoBen
- 7th September 2005, 22:04
I found what I need I think.

http://www.parallax.com/html_pages/robotics/machining/RPM_display.asp

Darrel Taylor
- 9th September 2005, 02:51
Hi Ben,

Probably too late for you, but in case what you found didn't work out ...

LCD BARgraphs
http://www.picbasic.co.uk/forum/showthread.php?p=12475
<br>

Martin_Nissen
- 12th September 2005, 13:48
Hi Ben,

Probably too late for you, but in case what you found didn't work out ...

LCD BARgraphs
http://www.picbasic.co.uk/forum/showthread.php?p=12475
<br>

I can't get my program compiled when using your file.. It says that my VALUE (in this case, WRD1) is an illegal opcode - With and without _ in front of the word

Darrel Taylor
- 12th September 2005, 17:44
Hi Martin,

Make sure there's a space after the @ symbol, and the CASE matches EXACTLY.

Other than that, I would need to see your code.
<br>

CocaColaKid
- 12th September 2005, 18:13
I have it working fine. Just use the example and modifiy it to your application.

Nice job Darrel.

Martin_Nissen
- 13th September 2005, 07:19
Hi Martin,

Make sure there's a space after the @ symbol, and the CASE matches EXACTLY.

Other than that, I would need to see your code.
<br>

Must be because it doesn't work in the compiler i'm using then..

Darrel Taylor
- 13th September 2005, 18:20
Must be because it doesn't work in the compiler i'm using then..
If the compiler is not PicBasic Pro, or the PBP version is prior to 2.40, then that would be the case.

Sorry about that.
<br>

ronsimpson
- 5th October 2005, 04:10
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
*******************************

Anyone done a bargraph on a character LCD? I want to represent a value in text and bargraph and was looking for the best method to accomplish it.

DynamoBen
- 5th October 2005, 04:14
I ended up using a basic stamp example as my template.

In response to your graph I just don't have the space in EEProm to do what you did. Its already full with the seven extra large digits I have created for the project.

TK5EP
- 5th October 2005, 07:28
Hi !

I had the same request last week.
I got this attached code from another user here, and also found it somewhere else on the web. It works very nicely with only a few lines of clever coding.
You can even reduce the code if you don't want to have different type of bars.

I'm now working on a addon to this code, a "holding" bar which will show the peak measure during a little time. I'm almost done with it.

Hope this helps !

Patrick


Anyone done a bargraph on a character LCD? I want to represent a value in text and bargraph and was looking for the best method to accomplish it.

DynamoBen
- 5th October 2005, 14:50
Once you have the holding bar complete please post the results.

My application doesn't need a holding bar but is does need a max limit indicator.