CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

have no one any solution for my question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hayee



Joined: 05 Sep 2007
Posts: 252

View user's profile Send private message

have no one any solution for my question
PostPosted: Sat Sep 08, 2007 1:37 am     Reply with quote

HI,everyone
I want to display the data on my lcd which is stored in the eeprom.
actually i am entering different numbers from keypad and the numbers are stored in eeprom.i am using LCD.c as a driver file and using PIC16F877A.my code is as follows


#include "eeprom.h"
#include "ctype.h"

#include "string.h"
char str[17];
char a[16]="TESTING EEPROM";

#define r1 PIN_B0
#define r2 PIN_B1
#define r3 PIN_B2
#define r4 PIN_B3
#define c1 PIN_B4
#define c2 PIN_B5
#define c3 PIN_B6
#define c4 PIN_B7
#include "lcd.c"


int key();
BYTE gethex();
BYTE gethex1();

void main()
{
BYTE i,address,value;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
SET_TRIS_B(0xF0);
// TODO: USER CODE!!
initLCD();
printStringXY_LCD(a,0,0);
do
{
printf("\r\n\n TESTING EEPROM:\r\n\n");
for(i=1;i<=3;i++)
{
printf(" %x",read_eeprom(i));
}

printf("\r\n\n LOCATION TO CHANGE:\r\n");
address=gethex();
printf("\r\n\n NEW VALUE:\r\n");
value=gethex();
write_eeprom(address,value);
}
while(1);
}

BYTE gethex()
{
int hi,b,lo;
{
hi=gethex1();
if (hi!=255)
{
for(b=0;b<10;b++)
delay_ms(10);
}
else
continue;
lo=gethex1();
if (lo!=255)
{
for (b=0;b<10;b++)
delay_ms(10);
}
else
continue;
}
if (lo==221)
return(hi);
else
return (hi*16+lo);
}


BYTE gethex1()
{
char digit;
digit=key();
printf("%d",digit);
delay_ms(10);
return (digit);
}

int key()
{
while(1)
{
output_bit(r1,0);
output_bit(r1,1);
delay_ms(10);
if (input(c1))
return (0x0a);
if (input(c2))
return (3);
if (input(c3))
return (2);
if (input(c4))
return (1);
output_bit(r1,0);
output_bit(r2,1);
delay_ms(10);
if (input(c1))
return (0x0b);
if (input(c2))
return (6);
if (input(c3))
return (5);
if (input(c4))
return (4);
output_bit(r2,0);
output_bit(r3,1);
delay_ms(10);
if (input(c1))
return (0x0c);
if (input(c2))
return (9);
if (input(c3))
return (8);
if (input(c4))
return (7);
output_bit(r3,0);
output_bit(r4,1);
delay_ms(10);
if (input(c1))
return (0x0f);
if (input(c2))
return (0x0e);
if (input(c3))
return (0);
if (input(c4))
return (0x0d);
output_bit(r4,0);
}
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Sep 08, 2007 2:57 am     Reply with quote

The reason your previous posts were ignored is because you need to
do the following things before you can get help from people:

1. Post your code with proper indentation and formatting, so it looks
good and is easy to read.
Post it in a "code block" to preserve the indentation. Use the Code
button to do this. Use the Preview button to check that it looks
correct (in a Code block) before you click the Submit button.
Make corrections and check it several times, if necessary.

2. Explain what parts of your program work properly, and what parts
do not work. Show the correct output that you would like to get
from the program, and show the "bad" output that you get now.

3. Tell us the manufacturer and part numbers of all devices that you
are using in your program (such as the keypad).

4. Post all #include, #fuses, and #use statements.

5. Post your compiler version. This is a 4-digit number such as 3.249,
4.013, or 4.054, etc. You can find it at the start of the .LST file,
which is in your project directory.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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