|
|
View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 05, 2006 5:41 pm |
|
|
Quote: |
for some reason , i burned a 16f877 and a 16f84A ,
when using the keypad and lcd in the same port...
could you please help ? i posted about these before,
but no-one answered.- |
You can put the keypad and lcd on Port B. I did this just now with
a PicDem2-Plus board and a keypad. I used the following CCS files:
ex_lcdkb.c
lcd.c
kbd.c
These files are located in these folders:
c:\Program Files\Picc\Examples
c:\Program Files\Picc\Drivers
I made the following changes to EX_LCDKB.C:
1. I'm using a PicDem2-Plus board, so I changed the oscillator to XT
(it was HS) and the #use delay() to 4 MHz, to match the board.
Quote: |
#include <16F877.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOPROTECT,NOLVP
#use delay(clock=4000000)
|
2. Just above the #include statements for the driver files, I added
two #define statements to tell the drivers to use Port B.
Quote: |
#define use_portb_lcd 1
#define use_portb_kbd 1
#include <lcd.c>
#include <kbd.c>
|
3. I also had to enable Port B pull-up resistors by adding the line
shown in bold below.
Quote: |
void main() {
char k;
lcd_init();
kbd_init();
port_b_pullups(TRUE);
|
4. I'm using a keypad similar to the "Black keypad" mentioned in the
KBD.C file. The black keypad is selected by default. You don't have
to change anything in KBD.C to use it.
That takes care of the software changes.
---------------
For hardware, I had to make the following changes:
1. On the PicDem2-Plus board, the LCD is on Port D and Port A.
I soldered in 7 jumper wires to also connect it to Port B.
I used the same list of connections as is given at the start
of the LCD.C file, except they now go to Port B:
Quote: |
PortB LCD
RB0 enable
RB1 rs
RB2 rw
RB4 D4
RB5 D5
RB6 D6
RB7 D7
(RB3 is not used)
|
2. I connected my keypad to Port B. My keypad is similar to the
"Black keypad" that CCS mentions in the KBD.C file. So the
connections look like this:
Quote: |
keypad PortB
COL0 RB5
COL1 RB6
COL2 RB7
ROW0 RB1
ROW1 RB2
ROW2 RB3
ROW3 RB4
(RB0 is not used)
|
You will have to look at the data sheet for your keypad, in order to
make the correct connections as shown above.
Also, the ICD2 programmer did not like having the LCD on pins B6 and
B7 (which are used for debugging). It would not recognize the 16F877,
so I had to program the PIC on another board, and then insert it into
the PicDem2-Plus.
After I did all these things, then it worked. |
|
|
criss_m Guest
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 05, 2006 5:59 pm |
|
|
I feel that I provided a complete explanation of how to do it
(at least with my hardware), with minimal changes to the CCS
example and drivers. I don't think I can do anymore. |
|
|
criss_m Guest
|
|
Posted: Sun Mar 05, 2006 7:27 pm |
|
|
thanx so much , but , i only need to know , if you have any pull up resistor conected to the "black keyboard" ...
i think ,this damaged 2 of my chips...
Thanx ... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 05, 2006 7:34 pm |
|
|
There are no external pull-up resistors on Port B on my board. |
|
|
Calamar
Joined: 07 Sep 2003 Posts: 60 Location: Buenos Aires (Argentina)
|
|
Posted: Sun Mar 05, 2006 7:42 pm |
|
|
Quote: | for some reason , i burned a 16f877 and a 16f84A , when using the keypad |
It could be that were two pins (output function)
with deferents voltage level, you must sure that
nethier combination of pressed key (one, two,...)
join these pins without a resistor to limit te current,
look up r9, r10, r11, r12 at:
http://picmania.garcia-cuervo.com/images/EDUPIC_Keyboard.JPG _________________ Best Regards
Daniel H. Sagarra
La Plata (Argentina) |
|
|
freedom
Joined: 10 Jul 2011 Posts: 54
|
what about ICSP |
Posted: Thu Aug 22, 2013 3:07 am |
|
|
Ok , Fantastic solution .
Thanks to PCM programmer.
I want to use port B of PIC16F877a for both LCD & keypad. But If I want to use ICSP with those then what or how to do?
is this solution support driver Flex_LCD420.c and Flex_KBD_4X3.c ? |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu Aug 22, 2013 4:27 pm |
|
|
criss_m wrote: | thanx so much , but , i only need to know , if you have any pull up resistor conected to the "black keyboard" ...
i think ,this damaged 2 of my chips...
Thanx ... |
Assuming the circuit is correctly soldered, and you have not omitted to tell us anything, then it is very very difficult to damage the PIC.
If you are breadboarding the circuit then it is VERY EASY to kill the PIC. If the ground pin of the voltage regulator does not actually connect to ground (loose connection in the breadboard) then the output of the voltage regulator will be the same as the input voltage to the regulator. IN your schematic, it could be 30 volts. This will definitely kill the PIC. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Thu Aug 22, 2013 4:45 pm |
|
|
This a very old thread from back in 2005... _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|
|
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
|