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

keypad problem??

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



Joined: 05 Nov 2007
Posts: 3

View user's profile Send private message

keypad problem??
PostPosted: Mon Nov 05, 2007 12:48 am     Reply with quote

HI
i m new on CCS forum.i have tried to make a project with keypad many times but i havent achieved it.i use kbd.c file.and i use pic16f877.when i press any key so i want to show this key on lcd.
PORTB 1-2-3-4 pins are rows
PORTB 5-6-7 pins are columns.

and i added pull up resistor to columns.

and i use lcd port PORTD.Please anyone help me.my codes are:
#include "C:\Users\keyexample.h"
#define use_portd_lcd TRUE
#include <LCD.C>
#include <kbd.c>


void main()
{
char key;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
lcd_init();

for(;;)
{
key=kbd_getc();
lcd_gotoxy(1,1);
lcd_putc(key);
}
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 05, 2007 1:01 am     Reply with quote

Quote:
and i added pull up resistor to columns.

The pull-up resistors should be on the Row pins.


Quote:
for(;;)
{
key=kbd_getc();
lcd_gotoxy(1,1);
lcd_putc(key);
}

This is not the correct way to call the CCS keypad driver. Look at
how they do it in this example file. You should do it the same way:
Quote:
c:\Program Files\PICC\Examples\Ex_lcdkb.c
mir_as82



Joined: 05 Nov 2007
Posts: 3

View user's profile Send private message

PostPosted: Mon Nov 05, 2007 1:37 am     Reply with quote

i cant do it:( .why i cant do it.i m not really so ameteur.
will i connect columns to portb bits directly?i use proteus-isis simulation programme.i tried your notifications but still cant work.there is not problem in lcd cause i write it character.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Nov 05, 2007 7:23 am     Reply with quote

Lately this is a recursive subject in this forum.
Proteus like other tools is a virtual simulator that generates a good approach
with the real world with no need to see a simple cable. The use of this type of tools
has the disadvantage that if it does not work as expected, is very difficult to offer aid
because 99% of the error possibilities would be given by the selected operating
parameters and other simulator setups.
The helps in hardware related to CCS Complier running in PIC MCU´s that this forum
can offer is based on the skills and experience of most of us with the "real"
hardware, that give us the possibility of being able to make electrical determinations
of voltage levels and other measurements in the real -non virtual- world.

Concretely, you are using some programs of the CCS package that had been tested
extensively and whose operation is guaranteed, but running in a simulator environment
they do not behave as expected.
I strongly suggest you to redirect this question to a forum related to Proteus simulator.


Humberto
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