View previous topic :: View next topic |
Author |
Message |
deltatech
Joined: 22 Apr 2006 Posts: 87
|
CCS LCD Screen Keypad problem |
Posted: Fri Sep 02, 2011 4:33 pm |
|
|
Hi All, I have a CCS Software Prototyping Board with a key Pad and Lcd screen.
The LCD is plugged into the D port. The back light is on.
I am using the lcdkb.c example but i am not getting anything on LCD screen when i press any buttons.
Am i doing anything wrong or do i need to make any changes to the code before it will work?
Code: |
#include "G:\main.h"
#include <lcd.c>
#include <kbd.c>
void main() {
char k;
output_high(led);
lcd_init();
kbd_init();
lcd_putc("\fReady...\n");
while (TRUE) {
k=kbd_getc();
if(k!=0)
if(k=='*')
lcd_putc('\f');
else
lcd_putc(k);
}
} |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Sep 02, 2011 5:54 pm |
|
|
What PIC pins are used for the Keypad ? Is it on PortB ? If so, read
this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=30842&start=1
Read this thread about how to correctly put pull-up resistors on the
keypad's row pins:
http://www.ccsinfo.com/forum/viewtopic.php?t=44647
If the keypad is on PortB, you could enable the built-in pull-ups in the PIC
instead of using external resistors. But the method will depend upon your
PIC and compiler version.
What is your PIC ? (Always post your PIC).
And your compiler version ? |
|
|
deltatech
Joined: 22 Apr 2006 Posts: 87
|
|
Posted: Fri Sep 02, 2011 6:36 pm |
|
|
Hi PCM programmer thanks for your reply
PIC is 16F877.h
Key pad is on port B
compiler is 4.093
I have tried this statement you suggested it made no difference
#define use_portb_kbd 1
I don’t think the problem is the Key pad i think it is LCD
I should be getting lcd_putc("\fReady...\n");
But there is nothing on the LCD screen
The lcd screen is new it came from CCS with the Kit |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Sep 02, 2011 8:48 pm |
|
|
What is the name of the kit ? |
|
|
deltatech
Joined: 22 Apr 2006 Posts: 87
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
deltatech
Joined: 22 Apr 2006 Posts: 87
|
|
Posted: Sat Sep 03, 2011 1:10 pm |
|
|
Hi PCM programmer thanks for your reply.
It is plugged into Port D. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Sep 03, 2011 1:21 pm |
|
|
I don't have the ACE kit board or the documentation for it, but try this
simple program. I think it should probably work.
Code: |
#include <16F877.h>
#fuses HS,NOWDT,BROWNOUT,PUT,NOLVP
#use delay(clock=20M)
#use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#include <lcd.c>
//======================================
void main()
{
lcd_init();
lcd_putc("\fHello World");
while(1);
} |
|
|
|
deltatech
Joined: 22 Apr 2006 Posts: 87
|
|
Posted: Sat Sep 03, 2011 3:23 pm |
|
|
Hi PCM programmer thanks for your reply.
I tried your code but still there is nothing being displayed on the LCD |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Sep 03, 2011 3:46 pm |
|
|
Look at the schematic of the board. (I don't have one. Only you have it).
Look at the connections between the LCD and the PIC. Post a list of
those connections.
I need to know which PIC pins are connected to these LCD pins:
Code: |
LCD pin:
R/W
RS
E
DB4
DB5
DB6
DB7 |
For example, is R/W connected to PIN_D0 (also called RD0) on the PIC ?
If not, which pin is it ? (Etc.)
Also look on the schematic for a contrast control circuit for the LCD.
This will be on pin 3 of the LCD, and it may be labeled the "VO" pin.
Is there a trimpot connected to this LCD pin ? Or maybe two resistors ? |
|
|
deltatech
Joined: 22 Apr 2006 Posts: 87
|
|
Posted: Sat Sep 03, 2011 4:13 pm |
|
|
Hi PCM programmer thanks for your reply.
You were right it was the constrast setting on the trimpot it was off.
I can now see the hello world in your test code and also Ready.. from the previous code.
But the keypad buttons have no effect still. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Sep 03, 2011 4:30 pm |
|
|
Try this revised program:
Code: |
#include <16F877.h>
#fuses HS,NOWDT,BROWNOUT,PUT,NOLVP
#use delay(clock=20M)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#include <lcd.c>
#define use_portb_kbd 1
#include <kbd.c>
//======================================
void main()
{
char k;
lcd_init();
kbd_init();
port_b_pullups(TRUE); // Need to pull up the keypad row pins
lcd_putc("\fReady...\n");
while(TRUE)
{
k=kbd_getc();
if(k!=0)
if(k=='*')
lcd_putc('\f');
else
lcd_putc(k);
}
} |
|
|
|
deltatech
Joined: 22 Apr 2006 Posts: 87
|
|
Posted: Sat Sep 03, 2011 5:36 pm |
|
|
Hi PCM programmer thanks for your reply.
I tried your new code but still only ready ... is displayed on the screen LCD |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Sep 03, 2011 6:35 pm |
|
|
Look at this photo of the board:
http://www.apelectronics.co.za/Stores/toptronic/ProductImages/APCCS_C_ACE_PCW2.jpg
1. What connector is the keypad plugged into ?
2. Did you get the keypad from CCS ?
3. What color is the keypad ?
4. If you have it connected to the bottom connector, which is labeled
"keypad", then look on the schematic. What PIC pins is the keypad
connected to ? Post a list. Try to determine which of the pins are
the Column pins, and which are the Row pins on the keypad, and try
to determine which pins are they connected to on the PIC. |
|
|
deltatech
Joined: 22 Apr 2006 Posts: 87
|
|
Posted: Sun Sep 04, 2011 6:47 am |
|
|
Hi PCM programmer thanks for your reply.
I bought the Key Pad from CCS also it came with the Ace Kit
http://www.ccsinfo.com/product_info.php?products_id=lcdkeypad
It is connected to the Connector labelled Key Pad on the Kit .
There is a Schematic with the keypad the rows and columns are connected like this
B1 -Row 1
B2- Row 2
B3- Row 3
B4- Row 4
B5- Col 1
B6- Col 2
B7- Col 3
B8- NC |
|
|
|