|
|
View previous topic :: View next topic |
Author |
Message |
Wolf
Joined: 23 Sep 2011 Posts: 32
|
A real stupid problem |
Posted: Mon Oct 03, 2011 5:54 pm |
|
|
Hey!
Ok here is my problem....I'm trouble shooting my circuit board, and all the bits on Port A, E, and 1 bit on C go directly to a socket so I can drop in an LCD screen. However, one of the bit's isn't working properly PIN_A4, or pin 6 positioned on PIC16F877. So I have hooked all the wires to LED's so I can see them work but I cannot make PIN_A4 work for the life of me. I looked at the datasheet and it says it's a bi-directional pin so I don't know.
here is my code:
Code: |
#define LCD_DB7 PIN_A0
#define LCD_DB6 PIN_A1
#define LCD_DB5 PIN_A2
#define LCD_DB4 PIN_A3
#define LCD_ENABLE PIN_A4
#define LCD_RS PIN_C2
#define BACKLIGHT_RED PIN_E0
#define BACKLIGHT_GREEN PIN_E1
#define BACKLIGHT_BLUE PIN_E2
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000) //Crystal Oscillator @ 20MHz
//#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
void StartupSettings();
void main() {
StartupSettings();
while(1) {
output_bit(LCD_DB7, 1);
output_bit(LCD_DB6, 1);
output_bit(LCD_DB5, 1);
output_bit(LCD_DB4, 1);
output_bit(LCD_ENABLE, 1);
output_bit(LCD_RS, 1);
delay_ms(1000);
output_bit(LCD_DB7, 0);
output_bit(LCD_DB6, 0);
output_bit(LCD_DB5, 0);
output_bit(LCD_DB4, 0);
output_bit(LCD_ENABLE, 0);
output_bit(LCD_RS, 0);
delay_ms(1000);
}
return;
}
void StartupSettings() {
set_tris_a(0x00);
set_tris_c(0x00);
set_tris_e(0x00);
return;
|
Any ideas? |
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
|
Posted: Mon Oct 03, 2011 6:14 pm |
|
|
Look at the datasheet again on page 42. There is a line on page 41 Quote: | The RA4/T0CKI pin is a Schmitt Trigger input and an open-drain output. | pay attention on underlined text
I had the similar experience the first time I came across this particular port.
For most application you can simply put 10k resistor to the 5V line. |
|
|
Wolf
Joined: 23 Sep 2011 Posts: 32
|
|
Posted: Mon Oct 03, 2011 6:42 pm |
|
|
Oh damn it! I guess I need to start cut up or solder parts off my circuit board. Thank you |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Mon Oct 03, 2011 10:59 pm |
|
|
Wolf wrote: | Oh damn it! I guess I need to start cut up or solder parts off my circuit board. Thank you |
No you just need to add a pull-up resistor. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|
|
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
|