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

LCD help for a noob
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
RatFink



Joined: 01 May 2004
Posts: 49

View user's profile Send private message

PostPosted: Tue May 11, 2004 12:16 pm     Reply with quote

Cool, I'll try that, I just happen to have a O-Scope, it's an old Burroughs 465, but it's a O-scope. Very Happy
Guest








Re: LCD help for a noob
PostPosted: Wed Nov 09, 2005 2:29 pm     Reply with quote

RatFink wrote:
I'm trying to see if I can get an LCD to work with my PIC16F877A. I'm using the lcd.c driver and have one of CrystalFontz 2x8 LCD's with a HD44780compatible controller. right now I'm just seeing if I can get one small thing to print to the LCD. Everything in my code works untill I try to incorperate the LCD, when I do that I get an error message that says "Could not detect target chip"

This is the code up to the only print statement I have;

Code:
#bit Heat = PORTD.4
#bit Fan_Slow = PORTD.5
#bit Fan_Fast = PORTD.6
#bit Vent = PORTD.7


#bit Timed1 = READ.0
#bit Timed2 = READ.1

/* Define Inputs */
#bit PB_Preheat = PORTD.0
#bit PB_Plastic = PORTD.1
#bit PB_Metal = PORTD.2



#use delay(clock=20000000)
//#use rs232(DEBUGGER)
//#use rs232(baud=9600, xmit=PIN_c6,rcv=PIN_c7)
#include <lcd.c>


   void main(void)

{

   lcd_init();
   
   ADCON0 = 0x41;      /* Fosc/8, A/D enabled */
   OPTION = 0x07;      /* TMR0 prescaller, 1:256, PORTB pullups */
   ADCON1 = 0x0E;      /* Left justify, 1 analog channel, VDD and Vss references */





   //TRISA = 0x0f;      /* PORTA required inputs*/
   //TRISB = 0x07;      /* PORTB requred inputs */
   //TRISC = 0;      /* PORTA all outputs */
   TRISD = 0x0F;         /* PORTD Inputs and 0utputs */
   PORTD =0x0F;       /*Sets up PORTD*/
   Timed1 =0;
   Timed2 = 0;

BACK:   do
{;}
   while (PB_Preheat&&PB_Plastic&&PB_Metal == 1);



   if (PB_Preheat == 0)
   {
      Heat = 1;
      Fan_Slow = 1;
      Fan_Fast = 0;
      Vent = 0;
      Timed1 = 0;
      Timed2 = 0;
      printf(lcd_putc, "Warming.");

   }


the lcd.c file is the one that comes with the ccs compiler except that I add this, #device PIC16F877A because the compiler kept yelling for a device statement,

Code:
#device PIC16F877A
struct lcd_pin_map {                 // This structure is overlayed
           boolean enable;           // on to an I/O port to gain
           boolean rs;               // access to the LCD pins.
           boolean rw;               // The bits are allocated from
           boolean unused;           // low order up.  ENABLE will
           int     data : 4;         // be pin B0.
        } lcd;


all my connections are just as indicated in the driver, and the power is hooked up as;

pin 1 to ground
pin 2 to vcc (5V)
pin 3 tp the wiper on a 10k pot.

What in all of this would make it so I get the "Could not target chip" error?
newguy



Joined: 24 Jun 2004
Posts: 1946

View user's profile Send private message

PostPosted: Wed Nov 09, 2005 2:45 pm     Reply with quote

I'm assuming your trouble starts when you try to program the 16F877A while the LCD is attached?

The issue is that the program data and program clock lines on the PIC (B6 & B7) are also connected to the LCD module. In general, if you want to maintain ICSP functionality, you can't have anything else connected to those lines*.

*However (there's always a however), things like buttons are okay, since they don't present any "load" to the programmer and/or "fight" the programmer's efforts to set those lines high/low as it pleases.

Try removing the LCD's connection to B6 & B7 and program the PIC. The programmer should now work. Once it's programmed, then hook up B6 & B7 to the LCD and reset the PIC.

.....Or just move the LCD to port D.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Nov 10, 2005 9:24 am     Reply with quote

This thread is several months old. Some goofball is quoting old posts again. Probably just wants to see if anybody will respond without looking at the date. Evil or Very Mad
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