|
|
View previous topic :: View next topic |
Author |
Message |
Mk Guest
|
working LCD-Keypad-Eeprom program thanks for all the help! |
Posted: Wed Apr 28, 2004 1:41 am |
|
|
// this is my first eeprom(2 dim. array) program
// i got many help from this forum,
// i post my first working eeprom program,
// i know this program may have some problems,
// but it's working.
// any beginner like me, can have fun and play
// with this program, sorry, my english is not so
// good!
//
// in this project, i use:
// a 3 x 4 keypad, a 2 x 16 LCD, and a 24lc256
// ccs c compiler
// PIC16F1877A
#define(__PCM__)
#include <16f877a.h>
#fuses HS, NOWDT, NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6, rcv=PIN_C7, errors)
#include "lcdd.c"
#include "kbdb.c"
#include "24256.c"
main()
{
char k,a;
int c,i,j;
const char record[3][17]=
{"HELLO EVERYONE! ",
"THIS IS KEYPAD ",
"LCD AND EEPROM "
};
// record[3][16] if i put 16 here, the lcd output at 16th has a un-want char
// don't know what is the right way to fix it yet!
init_ext_eeprom();
lcd_init();
kbd_init();
lcd_putc("\fSystem Ready!\n");
for (i=0; i<3; ++i)
{
for (c=0;c<17;c++) write_ext_eeprom(i*17+c,record[i][c]);
}
while (True)
{
k=kbd_getc();
if (k!=0)
{
if (k=='*')
lcd_putc('\f');
else
{
j=k-0x30; //convert CHAR into numbers
lcd_putc('\f');
lcd_putc(k);
lcd_putc('\n');
for (c=0; c<17; c++)
{
a = read_ext_eeprom(j*17+c);
lcd_putc(a);
}
}
}
}
} |
|
|
Sugiman
Joined: 12 Jan 2005 Posts: 15
|
|
Posted: Sun Jan 16, 2005 10:22 pm |
|
|
Quote: | int c,i,j;
const char record[3][17]=
{"HELLO EVERYONE! ",
"THIS IS KEYPAD ",
"LCD AND EEPROM "
};
// record[3][16] if i put 16 here, the lcd output at 16th has a un-want char
// don't know what is the right way to fix it yet! |
I don't know if you've already figured this out or not since the post was last year, but the problem is the space at the end of each text line. For example "HELLO EVERYONE! has 16 characters so if you had record[3][16] there wouldn't be space for the /NULL char at the end of the string |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|