PDA

View Full Version : Help with 24C01C and LCD



andyfive
- 13th September 2005, 19:19
Hello everyone. First off, I would like to thank everyone here for sharing their knowledge, and helping others.

As for my problem:
I'm trying to write ASCII values to a 24C01C eeprom, and then retreive them, and send them to an lcd. All I can seem to display is funny "y" characters, with dots above them.

I've read my manual, and searched the internet, to no avail. Any help would be appreciated. P.S. Heres the code.


'PIC 16F84, 24C01C

define lcd_bits 4
define lcd_dreg portb
define lcd_dbit 4

define lcd_rsreg porta
define lcd_rsbit 0

define lcd_ereg porta
define lcd_ebit 1

define lcd_lines 2
define lcd_commandus 2000
define lcd_dataus 50

scl var porta.2
sda var porta.3

control con %10100000

address var byte
x var byte
a var byte

address = 0

main:
lcdout $fe, 1
pause 100
i2cwrite sda, scl, control, address, "A", "n", "d", "y"
pause 100

for a = 0 to 3
i2cread sda, scl, control, a, x
pause 100
lcdout x
next a

mister_e
- 14th September 2005, 00:28
first observation


i2cwrite sda, scl, control, address, "A", "n", "d", "y"

should be


i2cwrite sda, scl, control, address, ["A", "n", "d", "y"]

but i've never tried to use that way of writing ASCII character. I feel you must place them in an array before and then shoot the array

something like


MyArray var byte[4]
MyArray[0]="A"
MyArray[1]="n"
MyArray[2]="d"
MyArray[3]="y"

i2cwrite sda, scl, control, address, [str MyArray\4]


Use Bracket for I2Cread too... it's in the manual ;)

andyfive
- 14th September 2005, 01:49
Wow...Thanks. That fixed it! lol I think I should go through the manual a few more times...