PDA

View Full Version : Bargraph and 2x40 LCD problem



RFsolution
- 19th March 2010, 19:23
Hi all

I have the following problem using a seiko 2x40 LCD (4042)

http://www.shopeio.com/inventory/pdf/SeikoChar.pdf

I use a 16F876 and read AD0 and AD1 which I want to display on line 1 and 2

followed by a bargraph

All works ok if the COL position is not bigger than 15
If I use 16 it erase the the text and the bargraph starts on 1st line 1st character

anyidea ?


lcd_main:
Lcdout $fe, 1
LCDOUT "Forw: ",dec4 fwd_pwr," Watt"
pause 10
; syntax- BARgraph Value, Row, Col, Width, Range, Style
@ BARgraph _fwd_pwr, 1, 15, 25, 1024, boxed ' OK
; @ BARgraph _fwd_pwr, 1, 16, 25, 1024, boxed ' not OK
return

Darrel Taylor
- 19th March 2010, 19:58
Try using a variable for the starting column and BAR width.

COL VAR BYTE
Width VAR BYTE

lcd_main:
Lcdout $fe, 1
LCDOUT "Forw: ",dec4 fwd_pwr," Watt"
pause 10
COL = 16 : Width = 25
; syntax- BARgraph Value, Row, Col, Width, Range, Style
@ BARgraph _fwd_pwr, 1, _COL,_Width, 1024, boxed ' OK
; @ BARgraph _fwd_pwr, 1, 16, 25, 1024, boxed ' not OK
return
The routines use a "trick" method to determine if the parameters being passed are constants or variables.

Anything less than 16 is assumed to be a constant, and anything over that is taken to be the address of a variable.
If it went up to 40, it could mistake a variable as a constant.

On anything wider than 16 chars, you should use a variable for Col and Width.

hth,

RFsolution
- 19th March 2010, 20:05
Thanks Mel

This works great

RFsolution
- 19th March 2010, 20:05
Oeps Darrel !!!

Darrel Taylor
- 19th March 2010, 23:40
Understandable.

We do look alot alike. :D

http://www.pbpgroup.com/files/Mel_DT1.jpg

Byte_Butcher
- 20th March 2010, 00:19
Ohh, man... Don't do that to me!!!

I had to go out to the shop and grab my spare keyboard. It'll take me forever to get all the beer spray out of the other one!
Jeez, most of it came up through my nose... (mmmm, hoppy.)

I always suspected that you and Melanie might be twins. :)


steve

malc-c
- 20th March 2010, 11:34
Understandable.

We do look alot alike. :D

http://www.pbpgroup.com/files/Mel_DT1.jpg

LOL - Darrel, Mel's gonna give you one hell of a slap for that !!

That's brightened up one dull Saturday morning !:D

SKOLS1
- 25th January 2011, 22:15
Can anybode make a code for this example?
Please I need it.

ScaleRobotics
- 26th January 2011, 00:21
Do a search on bargraph and you will be amazed.