View previous topic :: View next topic |
Author |
Message |
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Fri Jun 08, 2012 5:38 am |
|
|
PCM programmer wrote: |
Let's configure the driver so it doesn't use the lcd's busy bit. |
Done that, still first and third line boxes and second and fourth line empty |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Fri Jun 08, 2012 7:54 am |
|
|
Hi,
Quote: |
I get 2 errors:
unidentified identifyer
unidentified identifyer ANSEL
|
Ugh, sorry, that chip has no ANSEL register. I should have researched this a bit more before posting a solution that has worked with other PIC's, but that I wasn't 100% sure was applicable to this one ........
Both I/O ports A and E have analog input capability, and there are several registers (each) that control the functionality of those ports. It might be worth looking at the .lst file generated during compile to be sure that port A and E are being configured for digital I/O.
John |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Fri Jun 08, 2012 9:12 am |
|
|
YAY, I got it to work by trying out a different PIC16F877a I had lying around and it worked! Thanks for all of your help. |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Fri Jun 08, 2012 5:11 pm |
|
|
DAMN! I somehow managed to burn the other PIC that worked. Is there a way to fix a burnt PIC? I program it using MicroPro and I get an error:
Quote: |
ROM programming error at address 0x0001
Good 0x0000
Bad 0x0020
|
Or can I fix the other PIC that somehow doesn't work with the display??
Thanks in advance, I really need an answer soon as this should be finished by Sunday. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 08, 2012 5:37 pm |
|
|
How do you know it's the PIC ? Maybe it's a programmer problem.
You didn't post the part number of your programmer. But you should
search with Google for some tips on solving the problem. Example:
http://diykit.websitetoolbox.com/post?id=1511204 |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Fri Jun 08, 2012 5:40 pm |
|
|
PCM programmer wrote: | How do you know it's the PIC ? |
I know it's the PIC because I mistakenly connected the 12v power to the 5v power lines and the PIC became very hot. So I'm 100% sure it's the PIC.
Edit: My programmer is a K128 BTW. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 08, 2012 5:53 pm |
|
|
I don't think you can fix that problem. You have to get a new PIC. |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Fri Jun 08, 2012 5:56 pm |
|
|
PCM programmer wrote: | I don't think you can fix that problem. You have to get a new PIC. |
How about the one that for some reason doesn't power the display? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 08, 2012 6:03 pm |
|
|
Maybe some of the i/o pins are not working on that PIC. Try using
pins on a different i/o port. |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Sat Jun 09, 2012 8:00 am |
|
|
PCM programmer wrote: | Maybe some of the i/o pins are not working on that PIC. Try using
pins on a different i/o port. |
I bought two new PICs and everything works except for the display... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jun 09, 2012 2:48 pm |
|
|
Post a link to a schematic for your PIC circuit, including all connections
to the PIC and to the LCD (Power, ground, signals, external components,
values of components, etc).
Use a free image hosting service such as http://www.imageshack.us
to host the schematic file (.jpg, .gif, .bmp, etc.), then post the link here. |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Sat Jun 09, 2012 5:56 pm |
|
|
PCM programmer wrote: | Post a link to a schematic for your PIC circuit, including all connections
to the PIC and to the LCD (Power, ground, signals, external components,
values of components, etc).
Use a free image hosting service such as http://www.imageshack.us
to host the schematic file (.jpg, .gif, .bmp, etc.), then post the link here. |
Nevermind, with a crapload of debugging, I found out that my screen also burned, so I bought a new screen, now I'm debugging my program... BTW, do you have an idea why the following code doesn't function properly?
Code: |
if(input_state(btn_A) && input_state(btn_B) && input_state(btn_C)) {
beep();
testScreen();
}
|
and
Code: |
while(true){
if(input_state(btn_A)){
beep();
good();
score += 10;
updateDisplay(score);
} else if(input_state(btn_B) || input_state(btn_C)){
beep();
bad();
}
}
|
Should I add between each of the {}? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jun 09, 2012 7:10 pm |
|
|
Quote: | do you have an idea why the following code doesn't function properly?
|
I need to know how your switches are wired - negative or positive logic.
Post a schematic of your push-button circuits. For example, this is the
normal way a push-button switch and its pullup resistor are connected
to a PIC i/o pin. This is negative logic. A button press causes a logic 0
to be applied to the input pin:
Code: |
+5v
|
<
> 4.7K
< ___ Switch
To | _|_|_
PIC -----------------o o------
pin |
--- GND
-
|
Quote: | Should I add break;
between each of the {}? |
If you want to break out of the while loop after a certain button event
has occurred, then yes, you need to put a break statement at the end
of the code in each set of braces. That's what break is used for. |
|
|
seifpic
Joined: 11 Mar 2012 Posts: 45 Location: Egypt
|
|
Posted: Sat Jun 09, 2012 7:49 pm |
|
|
PCM programmer wrote: | Quote: | do you have an idea why the following code doesn't function properly?
|
I need to know how your switches are wired - negative or positive logic.
|
This is how my switches are wired
Code: |
___ Switch
To _|_|_
PIC -----------------o o------ +5v
pin
|
Please reply quickly as it's 3 AM and I need some sleep. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jun 09, 2012 8:30 pm |
|
|
That switch circuit can't supply two logic states. With that circuit, the PIC
pin is either a floating input or it's a logic "1". You need to fix that.
Change them all to the schematic that I posted. You will also need to
change the logic of your code to look for a logic "0" as the active state of
the switches.
If your switches are connected to pins on PortB, then you can enable
the built-in PortB pullups and save yourself from having to add the
resistors. All you have to do in that case is change the +5v connection
to be Ground instead. |
|
|
|