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 CCS Technical Support

code doesn't work on every 16f688
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 25, 2007 12:25 pm     Reply with quote

You said your code is never displaying output on the LCD.
This could mean:

1. The PIC is not running at all.

2. The code is locking up at some point, perhaps in a polling loop,
and thus it never reaches the section that outputs to the LCD.

3. The lcd is not being properly initialized.

4. You're using two of the LCD pins for the UART at certain times.
The UART may not really be disabled by the time the code reaches
the LCD output section. The UART does a "TRIS override" on its
i/o pins when it's active. This condition may still be in effect.

5. There could be some bug in the PIC. But I would tend towards
items #2 and #4. You're re-using pins. That's unusual. That
area is my first suspicion.


First prove if the code is actually reaching the section that displays
output on the LCD. Use a spare pin to light up an LED right before
the LCD code is reached. Normally, I use a UART (or even a soft
UART, with just a Tx pin) to show the progress of a program, if it's
locking up somewhere.

It really helps if you have some extra pins. Do you have any ?
Maybe there are pins that are used for external circuits, that could be
temporarily disconnected and be used for the LCD instead. By putting
the LCD on its own separate pins, you could prove if it's the UART that's
killing the LCD.
dan king



Joined: 22 Sep 2003
Posts: 119

View user's profile Send private message

PostPosted: Fri May 25, 2007 2:00 pm     Reply with quote

Thanks for the comments.

Quote:
1. The PIC is not running at all.


2. The code is locking up at some point, perhaps in a polling loop,
and thus it never reaches the section that outputs to the LCD.

First prove if the code is actually reaching the section that displays
output on the LCD. Use a spare pin to light up an LED right before
the LCD code is reached. Normally, I use a UART (or even a soft
UART, with just a Tx pin) to show the progress of a program, if it's
locking up somewhere.


I have used another I/O as a flag and the code is indeed reaching the routines that should display text so no lock up or infinte loop.

Quote:
3. The lcd is not being properly initialized.


The blocks that normally indicate uninitialized LCD go away and the LCD clears so I believe this means it's initing OK

Quote:
4. You're using two of the LCD pins for the UART at certain times.
The UART may not really be disabled by the time the code reaches
the LCD output section. The UART does a "TRIS override" on its
i/o pins when it's active. This condition may still be in effect.


This is where I think the issue is as well. That's why I attemped to override the uart settings with
SPEN = 0;
TXEN = 0;
CREN = 0;
RCIE = 0;

This has been, and still is, my area to focus on.


Quote:
5. There could be some bug in the PIC. But I would tend towards
items #2 and #4. You're re-using pins. That's unusual. That
area is my first suspicion.


kind of doubt bad silicon now as well since the uart works and the LCD works just not at the same time

Quote:
It really helps if you have some extra pins. Do you have any ?
Maybe there are pins that are used for external circuits, that could be
temporarily disconnected and be used for the LCD instead. By putting
the LCD on its own separate pins, you could prove if it's the UART that's
killing the LCD.


No, I'm out that's why I'm sharing pins but I will look at sharing something less critical. It is my first attempt at doing this but I figured regardless of whick pins get shared, I need them under my control.

I'll keep investigating and thanks for the questions/comments because it gives me more areas to look and keep me honest Smile

dan
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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