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

16lf88 trouble getting started

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jweller



Joined: 16 Oct 2006
Posts: 7

View user's profile Send private message

16lf88 trouble getting started
PostPosted: Fri Feb 23, 2007 1:33 pm     Reply with quote

CCS version 3.249

I am trying to write a very basic program for a 16lf88 and am having no success at all. I'm sure I'm overlooking something simple.

Only thing I can think of at this point is that maybe in a newer compiler version, there is a different header file for the 16lf88 than there is for the 16f88. Microchip doesn't have separate datasheets for them so I figured it was ok to use the 16f88 header file.

this is my pic.h file
Code:

#include <16F88.h>

#device adc=8
                    
#FUSES NOWDT                    //NO Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, NO clkout
#FUSES NOPROTECT                //Code not protected from reading
#FUSES PUT                       //Power Up Timer
#FUSES BROWNOUT               //brownout reset
#FUSES NOLVP                //no low voltage programming
#FUSES HS

#use delay(clock=8000000)

#define LED PIN_B0


and my pic.c file
Code:

#include "pic.h"

void main()
{
        setup_oscillator(OSC_8MHZ|OSC_INTRC);

   while(1)
   {   
      output_low(LED);
      delay_ms(500);
      output_high(LED);
      delay_ms(500);
    }
}




I'm probing pin b0 and it just sits at ground. It never goes high.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 23, 2007 1:41 pm     Reply with quote

The topic title says you're using the LF version of the PIC. That implies
that you may be running the PIC at 3.0v (with two 1.5v batteries).
But you have the Brownout fuse enabled. The brownout voltage for
this PIC is approximately 4.0v. Therefore, the PIC will be held in
a constant state of reset. It will never run. If you're running at 3v,
then change the fuse to NOBROWNOUT.


2nd thing: You have both the INTRC_IO and the HS fuses enabled.
These are in conflict. The compiler will use the last one that it sees,
which in this case is HS. That mode requires an external crystal or
oscillator. If you want INTRC_IO, then delete the HS fuse.
jweller



Joined: 16 Oct 2006
Posts: 7

View user's profile Send private message

PostPosted: Fri Feb 23, 2007 3:05 pm     Reply with quote

Ok I changed it to NOBROWNOUT and deleted the HS fuse and still no luck.
Ttelmah
Guest







PostPosted: Fri Feb 23, 2007 3:40 pm     Reply with quote

Try adding the fuse 'CCPB3'. Otherwise the CCP1 output, may be routing to B0, and preventing the code from working.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 23, 2007 4:00 pm     Reply with quote

I tested the following program at both +5v and +3.0v and it works.
It blinks an LED on pin B0. It was compiled with vs. 3.249.
If it doesn't work for you, then I suspect you may be missing the
pull-up resistor on the MCLR pin or some other hardware problem.
Code:

#include <16F88.H>
#fuses INTRC_IO, NOWDT, NOBROWNOUT, PUT, NOLVP
#use delay(clock=8000000)

void main()
{

// Blink an LED.
while(1)
  {
   output_high(PIN_B0); 
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }

}
jweller



Joined: 16 Oct 2006
Posts: 7

View user's profile Send private message

PostPosted: Sun Feb 25, 2007 11:09 am     Reply with quote

PCM programmer wrote:
I suspect you may be missing the
pull-up resistor on the MCLR pin


I'm not at work so I can't verify it right now, but I know your suspicions are dead on the money. I forgot the pullup.


this is what happens when they let software guys work with hardware Embarassed
jweller



Joined: 16 Oct 2006
Posts: 7

View user's profile Send private message

PostPosted: Mon Feb 26, 2007 12:04 pm     Reply with quote

Ok I added the pullup and my code still did not work. I am however able to compile and run your example code. Now that I've got something working, I can move forward. Thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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